]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-16048.rs
Enable full revision in const generics ui tests
[rust.git] / src / test / ui / issues / issue-16048.rs
1 trait NoLifetime {
2     fn get<'p, T : Test<'p>>(&self) -> T;
3     //~^ NOTE lifetimes in impl do not match this method in trait
4 }
5
6 trait Test<'p> {
7     fn new(buf: &'p mut [u8]) -> Self;
8 }
9
10 struct Foo<'a> {
11     buf: &'a mut [u8],
12 }
13
14 impl<'a> Test<'a> for Foo<'a> {
15     fn new(buf: &'a mut [u8]) -> Foo<'a> {
16         Foo { buf: buf }
17     }
18 }
19
20 impl<'a> NoLifetime for Foo<'a> {
21     fn get<'p, T: Test<'a> + From<Foo<'a>>>(&self) -> T {
22     //~^ ERROR E0195
23     //~| NOTE lifetimes do not match method in trait
24         return *self as T;
25         //~^ ERROR non-primitive cast: `Foo<'a>` as `T`
26         //~| NOTE an `as` expression can only be used to convert between primitive types
27     }
28 }
29
30 fn main() {}