]> git.lizzy.rs Git - rust.git/blob - src/test/ui/auto-traits/typeck-default-trait-impl-precedence.rs
Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as_const, r=joshtr...
[rust.git] / src / test / ui / auto-traits / typeck-default-trait-impl-precedence.rs
1 // Test that declaring that `&T` is `Defaulted` if `T:Signed` implies
2 // that other `&T` is NOT `Defaulted` if `T:Signed` does not hold. In
3 // other words, the auto impl only applies if there are no existing
4 // impls whose types unify.
5
6 #![feature(auto_traits)]
7 #![feature(negative_impls)]
8
9 auto trait Defaulted { }
10 impl<'a,T:Signed> Defaulted for &'a T { }
11 impl<'a,T:Signed> Defaulted for &'a mut T { }
12 fn is_defaulted<T:Defaulted>() { }
13
14 trait Signed { }
15 impl Signed for i32 { }
16
17 fn main() {
18     is_defaulted::<&'static i32>();
19     is_defaulted::<&'static u32>();
20     //~^ ERROR `u32: Signed` is not satisfied
21 }