Skip to content

Commit 14f094f

Browse files
authored
Merge pull request rust-lang#116 from oli-obk/master
fix drop impls for clike enums
2 parents 52ae8eb + 18f4ca3 commit 14f094f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/terminator/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
776776
return Ok(()); // nothing to do, this is zero sized (e.g. `None`)
777777
}
778778
},
779+
Layout::CEnum { .. } => return Ok(()),
779780
_ => bug!("{:?} is not an adt layout", layout),
780781
};
781782
let tcx = self.tcx;

tests/run-pass/issue-15063.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![allow(dead_code)]
12+
13+
enum Two { A, B }
14+
impl Drop for Two {
15+
fn drop(&mut self) {
16+
}
17+
}
18+
fn main() {
19+
let _k = Two::A;
20+
}

0 commit comments

Comments
 (0)