]> git.lizzy.rs Git - rust.git/blob - tests/ui/generics/generic-lifetime-trait-impl.rs
Rollup merge of #107331 - GuillaumeGomez:cleanup-js, r=notriddle
[rust.git] / tests / ui / generics / generic-lifetime-trait-impl.rs
1 // This code used to produce an ICE on the definition of trait Bar
2 // with the following message:
3 //
4 // Type parameter out of range when substituting in region 'a (root
5 // type=fn(Self) -> 'astr) (space=FnSpace, index=0)
6 //
7 // Regression test for issue #16218.
8
9 trait Bar<'a> {
10     fn dummy(&'a self);
11 }
12
13 trait Foo<'a> {
14     fn dummy(&'a self) { }
15     fn bar<'b, T: Bar<'b>>(self) -> &'b str;
16 }
17
18 impl<'a> Foo<'a> for &'a str {
19     fn bar<T: Bar<'a>>(self) -> &'a str { panic!() } //~ ERROR lifetime
20 }
21
22 fn main() {
23 }