1 // Unit test for the "user substitutions" that are annotated on each
4 // compile-flags:-Zverbose
6 #![feature(rustc_attrs)]
8 // Note: we reference the names T and U in the comments below.
10 fn method<U>(&self, arg: T, arg2: U) { }
13 impl<S, T> Bazoom<T> for S {
16 fn foo<'a, T>(_: T) { }
18 #[rustc_dump_user_substs]
20 // Here: nothing is given, so we don't have any annotation.
24 // Here: `u32` is given, which doesn't contain any lifetimes, so we don't
25 // have any annotation.
29 let x = foo::<&'static u32>; //~ ERROR [&ReStatic u32]
32 // Here: we only want the `T` to be given, the rest should be variables.
34 // (`T` refers to the declaration of `Bazoom`)
35 let x = <_ as Bazoom<u32>>::method::<_>; //~ ERROR [^0, u32, ^1]
38 // Here: all are given and definitely contain no lifetimes, so we
39 // don't have any annotation.
40 let x = <u8 as Bazoom<u16>>::method::<u32>;
43 // Here: all are given and we have a lifetime.
44 let x = <u8 as Bazoom<&'static u16>>::method::<u32>; //~ ERROR [u8, &ReStatic u16, u32]
47 // Here: we want in particular that *only* the method `U`
48 // annotation is given, the rest are variables.
50 // (`U` refers to the declaration of `Bazoom`)
52 y.method::<u32>(44, 66); //~ ERROR [^0, ^1, u32]
54 // Here: nothing is given, so we don't have any annotation.