Skip to content

Ungreat diagnostic error borrowed data escapes outside of function #62953

Closed
@spastorino

Description

@spastorino

On an change I was implementing in the compiler I got the following error ...

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

I don't remember how the code looked like exactly but we can probably rebuild an example that shows this behavior.

More info https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/borrowed.20data.20escapes.20outside.20of.20function

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions