The SCCs of the region graph are not a reliable heuristic to use for blaming an interesting constraint for diagnostics. For region errors, if the outlived region is `'static`, or the involved types are invariant in their lifetiems, there will be cycles in the constraint graph containing both the target region and the most interesting constraints to blame. To get better diagnostics in these cases, this commit removes that heuristic.
16 lines
350 B
Rust
16 lines
350 B
Rust
use std::cell::RefCell;
|
|
use std::io::Read;
|
|
|
|
fn main() {}
|
|
|
|
fn inner(mut foo: &[u8]) {
|
|
let refcell = RefCell::new(&mut foo);
|
|
//~^ ERROR `foo` does not live long enough
|
|
let read = &refcell as &RefCell<dyn Read>;
|
|
|
|
read_thing(read);
|
|
//~^ ERROR borrowed data escapes outside of function
|
|
}
|
|
|
|
fn read_thing(refcell: &RefCell<dyn Read>) {}
|