I'm getting this error on a change I'm trying to do
error[E0521]: borrowed data escapes outside of function --> src/librustc_codegen_ssa/mir/analyze.rs:228:9 | 218 | fn visit_place(&mut self, | --------- `self` is declared here, outside of the function body 219 | place: &mir::Place<'tcx>, | ----- `place` is a reference that is only valid in the function body ... 228 | self.process_place(place_ref, context, location); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `place` escapes the function body here error: aborting due to previous error
place is a reference to
Place that has
then I'm building a
PlaceRef struct which is a different data structure that holds references to
I guess I should state that the references that
PlaceRef hold do not outlive the reference to
but unsure how to do it exactly
but also, I'm not understanding properly the error message
just in case, this is the code ... https://github.com/rust-lang/rust/pull/60913/commits/2cf35e58d7eee9891784ca530e8639051d2c70ef
ok, was doing a silly thing, fixed
still the error message I think is not great
/cc @nikomatsakis @oli @Esteban Küber opinions?
At the very least the "outside of the function body" needs to be fixed in https://github.com/rust-lang/rust/blob/9606f6fa64926a84d82e3c62dbdc57f5c10f756d/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs#L498-L575
but the error itself is not nice at all in this context
yeah the error is pretty wildly inappropriate. not quite sure why that is happening.
@Santiago Pastorino do you think you can file an issue with a minimal reproduction?
maybe cc me and I'll try to add some notes at some point
@nikomatsakis going to open an issue, yeah :)