]> git.proxmox.com Git - rustc.git/blame - src/test/ui/typeck/typeck-default-trait-impl-precedence.rs
New upstream version 1.45.0+dfsg1
[rustc.git] / src / test / ui / typeck / typeck-default-trait-impl-precedence.rs
CommitLineData
c34b1796
AL
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
2c00a5a8 3// other words, the auto impl only applies if there are no existing
c34b1796
AL
4// impls whose types unify.
5
6#![feature(optin_builtin_traits)]
ba9703b0 7#![feature(negative_impls)]
c34b1796 8
2c00a5a8 9auto trait Defaulted { }
c34b1796
AL
10impl<'a,T:Signed> Defaulted for &'a T { }
11impl<'a,T:Signed> Defaulted for &'a mut T { }
12fn is_defaulted<T:Defaulted>() { }
13
9346a6ac 14trait Signed { }
c34b1796
AL
15impl Signed for i32 { }
16
17fn main() {
18 is_defaulted::<&'static i32>();
19 is_defaulted::<&'static u32>();
54a0048b 20 //~^ ERROR `u32: Signed` is not satisfied
c34b1796 21}