mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
20 lines
488 B
Rust
20 lines
488 B
Rust
// Don't ICE when trying to annotate signature and we see `&()`
|
|
|
|
fn f<'a, T>(_: &'static &'a (), x: &'a T) -> &'static T {
|
|
x
|
|
}
|
|
trait W<'a> {
|
|
fn g<T>(self, x: &'a T) -> &'static T;
|
|
}
|
|
|
|
// Frankly this error message is impossible to parse, but :shrug:.
|
|
impl<'a> W<'a> for &'static () {
|
|
fn g<T>(self, x: &'a T) -> &'static T {
|
|
f(&self, x)
|
|
//~^ ERROR borrowed data escapes outside of method
|
|
//~| ERROR `self` does not live long enough
|
|
}
|
|
}
|
|
|
|
fn main() {}
|