Skip to content

Instantly share code, notes, and snippets.

@stepancheg
Created July 30, 2013 00:17
Show Gist options
  • Save stepancheg/6109046 to your computer and use it in GitHub Desktop.
Save stepancheg/6109046 to your computer and use it in GitHub Desktop.
./tmp.rs:14:27: 14:31 error: cannot infer an appropriate lifetime due to conflicting requirements
./tmp.rs:14 let bar: &Bar = foo as &Bar;
^~~~
note: first, the lifetime cannot outlive lifetime re_bound(br_anon(0))...
./tmp.rs:15:8: 15:11 note: ...due to the following expression
./tmp.rs:15 baz(bar);
^~~
./tmp.rs:13:18: 16:1 note: but, the lifetime must be valid for the block at 13:18...
./tmp.rs:13 fn foo(foo: &Foo) {
./tmp.rs:14 let bar: &Bar = foo as &Bar;
./tmp.rs:15 baz(bar);
./tmp.rs:16 }
./tmp.rs:14:8: 14:11 note: ...due to the following expression
./tmp.rs:14 let bar: &Bar = foo as &Bar;
^~~
error: aborting due to previous error
struct Foo {
dummy: bool,
}
trait Bar {
}
impl Bar for Foo {
}
fn baz(bar: &Bar) {}
fn foo(foo: &Foo) {
let bar: &Bar = foo as &Bar;
baz(bar);
}
fn main() {
foo(&Foo { dummy: false });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment