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

Incorrect diagnostic when the feature isn't enabled #39

Closed
ChrisPardy opened this issue Feb 3, 2021 · 1 comment · Fixed by rust-lang/rust#84358
Closed

Incorrect diagnostic when the feature isn't enabled #39

ChrisPardy opened this issue Feb 3, 2021 · 1 comment · Fixed by rust-lang/rust#84358
Assignees
Labels
bug Something isn't working diagnostics
Projects

Comments

@ChrisPardy
Copy link
Member

ChrisPardy commented Feb 3, 2021

Compiling tte following code using the old capture logic

#![feature(rustc_attrs)]

struct S(i32);

fn foo() {
    let b = Box::new(S(10));
    
    let c = #[rustc_capture_analysis] || {
        let _b = b.0;
    };
    
    c();
}

prints the following diagnostic when compiled(view on playground):

note: Min Capture b[] -> ImmBorrow
  --> src/lib.rs:9:39
   |
9  |       let c = #[rustc_capture_analysis] || {
   |  _______________________________________^
10 | |         let _b = b.0;
   | |                  ^^^ b[] captured as ImmBorrow here
11 | |     };
   | |_____^ b[] used here

It should instead look something like:

note: Min Capture b[] -> ImmBorrow
  --> /users/cpardy/example2.rs:10:18
   |
10 |         let _b = b.0;
   |                  ^^^
@ChrisPardy ChrisPardy added the bug Something isn't working label Feb 3, 2021
@ChrisPardy ChrisPardy added this to To-do in RFC-2229 via automation Feb 3, 2021
@ChrisPardy ChrisPardy self-assigned this Feb 3, 2021
@arora-aman arora-aman changed the title Incorrect diagnostic when using old capture analysis Incorrect diagnostic when the feature isn't enabled Feb 3, 2021
@arora-aman arora-aman moved this from To-do to In progress in RFC-2229 Feb 3, 2021
@arora-aman
Copy link
Member

This only looks weird when debugging the compiler using #[rustc_capture_analysis] and indicates that the compiler didn't find a complete use of that path and was essentially faked. Users won't be impacted as fallback will be implemented by #8

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
RFC-2229 automation moved this from In progress to Done May 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working diagnostics
Projects
RFC-2229
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants