-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #81062 - sexxi-goose:precise_capture_diagnostics, r=n…
…ikomatsakis Improve diagnostics for Precise Capture This is just the capture analysis part and borrow checker logging will updated as part of rust-lang/project-rfc-2229#8 Closes rust-lang/project-rfc-2229#22
- Loading branch information
Showing
18 changed files
with
773 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
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
#![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.