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

Print captures precisely in borrow checker #36

Closed
arora-aman opened this issue Jan 12, 2021 · 3 comments · Fixed by rust-lang/rust#84358
Closed

Print captures precisely in borrow checker #36

arora-aman opened this issue Jan 12, 2021 · 3 comments · Fixed by rust-lang/rust#84358
Assignees

Comments

@arora-aman
Copy link
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.

@arora-aman
Copy link
Member Author

@arora-aman
Copy link
Member Author

arora-aman commented Feb 12, 2021

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

@arora-aman
Copy link
Member Author

arora-aman commented Mar 17, 2021

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

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 2, 2021
…_rebased, r=nikomatsakis

Update closure capture error logging for disjoint captures for disjoint captures

Improved error logging when `#![feature(capture_disjoint_fields)]` is used.

Closes rust-lang/project-rfc-2229#8
Closes rust-lang/project-rfc-2229#36
Closes rust-lang/project-rfc-2229#39
Closes rust-lang#76005
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 2, 2021
…_rebased, r=nikomatsakis

Update closure capture error logging for disjoint captures for disjoint captures

Improved error logging when `#![feature(capture_disjoint_fields)]` is used.

Closes rust-lang/project-rfc-2229#8
Closes rust-lang/project-rfc-2229#36
Closes rust-lang/project-rfc-2229#39
Closes rust-lang#76005
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants