Skip to content

Commit 4f310a3

Browse files
committed
Rename and add another test
1 parent 9121a41 commit 4f310a3

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// unit-test: ConstProp
2+
// compile-flags: -O
3+
// skip-filecheck
4+
5+
// Regression test for https://github.com/rust-lang/rust/issues/118328
6+
7+
#![allow(unused_assignments)]
8+
9+
struct SizeOfConst<T>(std::marker::PhantomData<T>);
10+
impl<T> SizeOfConst<T> {
11+
const SIZE: usize = std::mem::size_of::<T>();
12+
}
13+
14+
// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff
15+
fn size_of<T>() -> usize {
16+
let mut a = 0;
17+
a = SizeOfConst::<T>::SIZE;
18+
a
19+
}
20+
21+
fn main() {
22+
assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>());
23+
}

tests/mir-opt/const_prop/issue_118328.rs renamed to tests/ui/const_prop/overwrite_with_const_with_params.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
// unit-test: ConstProp
21
// compile-flags: -O
3-
// skip-filecheck
2+
// run-pass
3+
4+
// Regression test for https://github.com/rust-lang/rust/issues/118328
5+
46
#![allow(unused_assignments)]
57

68
struct SizeOfConst<T>(std::marker::PhantomData<T>);

0 commit comments

Comments
 (0)