forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve diagnostics for Precise Capture
- Loading branch information
1 parent
fcbd305
commit 2624b3e
Showing
14 changed files
with
581 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/test/ui/closures/2229_closure_analysis/capture-analysis-1.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
#![feature(capture_disjoint_fields)] | ||
//~^ WARNING: the feature `capture_disjoint_fields` is incomplete | ||
//~| NOTE: `#[warn(incomplete_features)]` on by default | ||
//~| NOTE: see issue #53488 <https://github.com/rust-lang/rust/issues/53488> | ||
#![feature(rustc_attrs)] | ||
|
||
#[derive(Debug)] | ||
struct Point { | ||
x: i32, | ||
y: i32, | ||
} | ||
|
||
fn main() { | ||
let p = Point { x: 10, y: 10 }; | ||
let q = Point { x: 10, y: 10 }; | ||
|
||
let c = #[rustc_capture_analysis] | ||
//~^ ERROR: attributes on expressions are experimental | ||
//~| NOTE: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> | ||
|| { | ||
//~^ First Pass analysis includes: | ||
//~| Min Capture analysis includes: | ||
println!("{:?}", p); | ||
//~^ NOTE: Capturing p[] -> ImmBorrow | ||
//~| NOTE: Min Capture p[] -> ImmBorrow | ||
println!("{:?}", p.x); | ||
//~^ NOTE: Capturing p[(0, 0)] -> ImmBorrow | ||
|
||
println!("{:?}", q.x); | ||
//~^ NOTE: Capturing q[(0, 0)] -> ImmBorrow | ||
println!("{:?}", q); | ||
//~^ NOTE: Capturing q[] -> ImmBorrow | ||
//~| NOTE: Min Capture q[] -> ImmBorrow | ||
}; | ||
} |
Oops, something went wrong.