Closed
Description
#[crate_type="lib"];
struct A {
a: ~str
}
fn borrow<'a>(binding: &'a A) -> &'a str {
match binding.a.as_slice() {
"in" => &'a "in_",
"ref" => &'a "ref_",
ident => ident
}
}
foo.rs:8:11: 8:33 error: cannot infer an appropriate lifetime for autoref due to conflicting requirements
foo.rs:8 match binding.a.as_slice() {
^~~~~~~~~~~~~~~~~~~~~~
foo.rs:8:11: 8:20 note: first, the lifetime cannot outlive the expression at 8:10...
foo.rs:8 match binding.a.as_slice() {
^~~~~~~~~
foo.rs:8:11: 8:20 note: ...so that automatically reference is valid at the time of borrow
foo.rs:8 match binding.a.as_slice() {
^~~~~~~~~
foo.rs:8:11: 8:33 note: but, the lifetime must be valid for the method call at 8:10...
foo.rs:8 match binding.a.as_slice() {
^~~~~~~~~~~~~~~~~~~~~~
foo.rs:8:11: 8:20 note: ...so that method receiver is valid for the method call
foo.rs:8 match binding.a.as_slice() {
^~~~~~~~~
This used to work.