diff options
| author | Alona Enraght-Moony <code@alona.page> | 2023-11-28 22:31:53 +0000 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2023-11-30 16:53:37 -0800 |
| commit | 98d3e99b8c1aaf745be6e53c121e052d1e9ae31a (patch) | |
| tree | 13e1d8fbba8bf63215cd19ccd96372de1d1046fc /tests/ui | |
| parent | cb4f87af3490997fa31e751ecf62647acd058bd3 (diff) | |
| download | rust-98d3e99b8c1aaf745be6e53c121e052d1e9ae31a.tar.gz rust-98d3e99b8c1aaf745be6e53c121e052d1e9ae31a.zip | |
Rename and add another test
(cherry picked from commit 6e956c0a383444a25cc0e690cbc9fa6f859b07b4)
Diffstat (limited to 'tests/ui')
| -rw-r--r-- | tests/ui/const_prop/overwrite_with_const_with_params.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/const_prop/overwrite_with_const_with_params.rs b/tests/ui/const_prop/overwrite_with_const_with_params.rs new file mode 100644 index 00000000000..6f533919a47 --- /dev/null +++ b/tests/ui/const_prop/overwrite_with_const_with_params.rs @@ -0,0 +1,21 @@ +// compile-flags: -O +// run-pass + +// Regression test for https://github.com/rust-lang/rust/issues/118328 + +#![allow(unused_assignments)] + +struct SizeOfConst<T>(std::marker::PhantomData<T>); +impl<T> SizeOfConst<T> { + const SIZE: usize = std::mem::size_of::<T>(); +} + +fn size_of<T>() -> usize { + let mut a = 0; + a = SizeOfConst::<T>::SIZE; + a +} + +fn main() { + assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>()); +} |
