blob: 75e5e7fd4211a9514b7a88b7d057566c160bb89f [file] [log] [blame]
// Check that when we clone a `&T` pointer we properly relate the
// lifetime of the pointer which results to the pointer being cloned.
// Bugs in method resolution have sometimes broken this connection.
// Issue #19261.
fn leak<'a, T>(x: T) -> &'a T {
(&x).clone() //~ ERROR cannot return value referencing function parameter `x`
}
fn main() { }