consider this code:
fn f1() -> &str {
let s = String::from("amogus");
s.as_str()
}
fn f2() {
let string = f1();
// f2 takes ownership of s
}
Currently this obviously errors, because s stops existing. But what if it didn't? Intuitively in case of such an error it should be possible to simply defer the ownership of the out-of-scope variable to whoever is calling the function. It'd also make passing references beween closures around a lot easier.
There's probably a very good reason this isn't possible, but I'm very curious what that reason is
