]> git.lizzy.rs Git - rust.git/blob - tests/ui/generics/post_monomorphization_error_backtrace.rs
Rollup merge of #105784 - yanns:update_stdarch, r=Amanieu
[rust.git] / tests / ui / generics / post_monomorphization_error_backtrace.rs
1 // build-fail
2
3 fn assert_zst<T>() {
4     struct F<T>(T);
5     impl<T> F<T> {
6         const V: () = assert!(std::mem::size_of::<T>() == 0);
7         //~^ ERROR: evaluation of `assert_zst::F::<u32>::V` failed [E0080]
8         //~| NOTE: in this expansion of assert!
9         //~| NOTE: the evaluated program panicked
10         //~| ERROR: evaluation of `assert_zst::F::<i32>::V` failed [E0080]
11         //~| NOTE: in this expansion of assert!
12         //~| NOTE: the evaluated program panicked
13     }
14     let _ = F::<T>::V;
15 }
16
17 fn foo<U>() {
18     assert_zst::<U>()
19     //~^ NOTE: the above error was encountered while instantiating `fn assert_zst::<u32>`
20     //~| NOTE: the above error was encountered while instantiating `fn assert_zst::<i32>`
21 }
22
23
24 fn bar<V>() {
25     foo::<V>()
26 }
27
28 fn main() {
29     bar::<()>();
30     bar::<u32>();
31     bar::<u32>();
32     bar::<i32>();
33 }