Closed
Description
This compiles, runs, and is UB (with NLL) - it errors correctly the return type is specified explicitly.
#![feature(nll)]
struct Foo<'a>(&'a ());
trait Bar {
type Assoc;
fn get(self) -> Self::Assoc;
}
impl<'a> Bar for Foo<'a> {
type Assoc = &'a u32;
// using `-> &'a u32` here results in a correct error
fn get(self) -> Self::Assoc {
let local = 42;
&local
}
}
fn main() {
let f = Foo(&()).get();
println!("{}", f);
}