]> git.lizzy.rs Git - rust.git/blob - tests/ui/impl-header-lifetime-elision/ref-underscore.rs
Do not eagerly recover for bad impl-trait in macros
[rust.git] / tests / ui / impl-header-lifetime-elision / ref-underscore.rs
1 // Test that `impl MyTrait for &i32` works and is equivalent to any lifetime.
2
3 // run-pass
4
5 #![allow(warnings)]
6
7 trait MyTrait { }
8
9 impl MyTrait for &i32 {
10 }
11
12 fn impls_my_trait<T: MyTrait>() { }
13
14 fn impls_my_trait_val<T: MyTrait>(_: T) {
15     impls_my_trait::<T>();
16 }
17
18 fn random_where_clause()
19 where for<'a> &'a i32: MyTrait { }
20
21 fn main() {
22     let x = 22;
23     let f = &x;
24
25     impls_my_trait_val(f);
26
27     impls_my_trait::<&'static i32>();
28
29     random_where_clause();
30 }