From 4f310a34ea5ccea95687e2b728422c8834836f00 Mon Sep 17 00:00:00 2001 From: Alona Enraght-Moony Date: Tue, 28 Nov 2023 22:31:53 +0000 Subject: [PATCH] Rename and add another test --- .../overwrite_with_const_with_params.rs | 23 +++++++++++++++++++ ..._const_with_params.size_of.ConstProp.diff} | 0 .../overwrite_with_const_with_params.rs} | 6 +++-- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/mir-opt/const_prop/overwrite_with_const_with_params.rs rename tests/mir-opt/const_prop/{issue_118328.size_of.ConstProp.diff => overwrite_with_const_with_params.size_of.ConstProp.diff} (100%) rename tests/{mir-opt/const_prop/issue_118328.rs => ui/const_prop/overwrite_with_const_with_params.rs} (82%) diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs new file mode 100644 index 0000000000000..c46a511b8b843 --- /dev/null +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs @@ -0,0 +1,23 @@ +// unit-test: ConstProp +// compile-flags: -O +// skip-filecheck + +// Regression test for https://github.com/rust-lang/rust/issues/118328 + +#![allow(unused_assignments)] + +struct SizeOfConst(std::marker::PhantomData); +impl SizeOfConst { + const SIZE: usize = std::mem::size_of::(); +} + +// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff +fn size_of() -> usize { + let mut a = 0; + a = SizeOfConst::::SIZE; + a +} + +fn main() { + assert_eq!(size_of::(), std::mem::size_of::()); +} diff --git a/tests/mir-opt/const_prop/issue_118328.size_of.ConstProp.diff b/tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff similarity index 100% rename from tests/mir-opt/const_prop/issue_118328.size_of.ConstProp.diff rename to tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff diff --git a/tests/mir-opt/const_prop/issue_118328.rs b/tests/ui/const_prop/overwrite_with_const_with_params.rs similarity index 82% rename from tests/mir-opt/const_prop/issue_118328.rs rename to tests/ui/const_prop/overwrite_with_const_with_params.rs index 5072091ddfc30..f299218c23858 100644 --- a/tests/mir-opt/const_prop/issue_118328.rs +++ b/tests/ui/const_prop/overwrite_with_const_with_params.rs @@ -1,6 +1,8 @@ -// unit-test: ConstProp // compile-flags: -O -// skip-filecheck +// run-pass + +// Regression test for https://github.com/rust-lang/rust/issues/118328 + #![allow(unused_assignments)] struct SizeOfConst(std::marker::PhantomData);