Closed
Description
I have encountered this problem several times while compiling versions of rustc with errors, but this is the first self-contained example I have found.
STR
pub struct Foo { a: u32 }
pub struct Pass<'a, 'tcx: 'a>(&'a mut &'a (), &'a &'tcx ());
impl<'a, 'tcx> Pass<'a, 'tcx>
{
pub fn tcx(&self) -> &'a &'tcx () { self.1 }
fn lol(&mut self, b: &Foo)
{
b.c;
self.tcx();
}
}
fn main() {}
Expected Result
A single error as the field c
does not exist
Actual Result
<anon>:9:9: 9:12 error: attempted access of field `c` on type `&Foo`, but no field with that name was found
<anon>:9 b.c;
^~~
<anon>:10:14: 10:19 error: cannot infer an appropriate lifetime for lifetime parameter `'tcx` due to conflicting requirements [E0495]
<anon>:10 self.tcx();
^~~~~
<anon>:7:5: 11:6 help: consider using an explicit lifetime parameter as shown: fn lol(&mut self, b: &Foo)
<anon>: 7 fn lol(&mut self, b: &Foo)
<anon>: 8 {
<anon>: 9 b.c;
<anon>:10 self.tcx();
<anon>:11 }
error: aborting due to 2 previous errors
Note the fat cascading region error. This reproduces on 1.5/1.6 and current nightly.