Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Print captures precisely in borrow checker #36

@arora-aman

Description

@arora-aman
Member

The borrow checker just prints the root variable when printing captures from within the context of the closure, we should update this to be print the captured path precisely.

Ideally, we do this once rust-lang/rust#80635 lands because it introduces a function to prints paths precisely.

Activity

arora-aman

arora-aman commented on Feb 12, 2021

@arora-aman
MemberAuthor

Search for FIXME(project-rfc_2229#36); https://oli-obk.github.io/fixmeh/

arora-aman

arora-aman commented on Mar 17, 2021

@arora-aman
MemberAuthor
error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
  --> $DIR/borrowck-2.rs:12:17
   |
LL |     let y = &p.y;
   |             ---- immutable borrow occurs here
LL |     let mut c = || {
   |                 ^^ mutable borrow occurs here
LL |        println!("{:?}", p);
   |                         - `p` is captured because of use here
LL |        let x = &mut p.x;
   |                     --- `p` is borrowed mutably because of use  here
...
LL |     println!("{}", y);
   |                    - immutable borrow later used here
added a commit that references this issue on May 2, 2021
35c6902
added a commit that references this issue on May 2, 2021
a00edce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Participants

    @nikomatsakis@arora-aman@ChrisPardy

    Issue actions

      Print captures precisely in borrow checker · Issue #36 · rust-lang/project-rfc-2229