Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lint for 2229 migrations #80629

Merged
merged 7 commits into from
Feb 2, 2021
Merged

Conversation

arora-aman
Copy link
Member

@arora-aman arora-aman commented Jan 2, 2021

Implements the first for RFC 2229 where we make the decision to migrate a root variable based on if the type of the variable needs Drop and if the root variable would be moved into the closure when the feature isn't enabled.

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 9000/11242
.................................................................................................... 9100/11242
.................................................................................................... 9200/11242
......................................i......i...................................................... 9300/11242
.............................................................................iiiiii..iiiiii.i....... 9400/11242
.................................................................................................... 9600/11242
.................................................................................................... 9700/11242
.................................................................................................... 9800/11242
.................................................................................................... 9900/11242
---
Suite("src/test/assembly") not skipped for "bootstrap::test::Assembly" -- not in ["src/tools/tidy"]
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 27 tests
iiiiiiiiiiiiiiiiiiiiiiiiiii

Suite("src/test/incremental") not skipped for "bootstrap::test::Incremental" -- not in ["src/tools/tidy"]
 finished in 0.087 seconds
Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
---
 finished in 11.790 seconds
Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)

running 116 tests
iiiiiiiiii.i.i..i..i..ii....i..i...ii..........iiii.........i.....i...i.......ii.i.ii.....iiii.....i 100/116
test result: ok. 78 passed; 0 failed; 38 ignored; 0 measured; 0 filtered out; finished in 2.53s

 finished in 2.619 seconds
Suite("src/test/ui-fulldeps") not skipped for "bootstrap::test::UiFullDeps" -- not in ["src/tools/tidy"]
---
running 80 tests
i.iF...i......i...........ii......................i.............i...............
failures:

---- src/builtin.rs - builtin::DISJOINT_CAPTURE_DROP_REORDER (line 2953) stdout ----
error: Drop order affected for closure because of `capture_disjoint_fields`
   |
17 |     let c = || {
   |  ___________^
18 | |      let x = p.x;
18 | |      let x = p.x;
19 | |   };
   | |___^
   |
note: the lint level is defined here
  --> src/builtin.rs:2954:9
   |
2  | #![deny(disjoint_capture_drop_reorder)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: let (p) = (p);
error: aborting due to previous error

Couldn't compile the test.

---

error: test failed, to rerun pass '--doc'


command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--features" " llvm" "--manifest-path" "/checkout/compiler/rustc/Cargo.toml" "-p" "rustc_lint_defs" "--" "--quiet"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:27:10

@bors
Copy link
Contributor

bors commented Jan 13, 2021

☔ The latest upstream changes (presumably #76219) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By and large, this looks great. I left a few nits.

compiler/rustc_lint_defs/src/builtin.rs Show resolved Hide resolved
compiler/rustc_lint_defs/src/builtin.rs Show resolved Hide resolved
compiler/rustc_lint_defs/src/builtin.rs Show resolved Hide resolved
self.compute_min_captures(closure_def_id, delegate.capture_information);

let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
if should_do_migration_analysis(self.tcx, closure_hir_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we pull the body of this if out into a separate method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


let is_moved = root_var_min_capture_list
.iter()
.find(|capture| matches!(capture.info.capture_kind, ty::UpvarCapture::ByValue(_)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can use .any() instead =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// 2. If we only capture one path starting at the root variable, it's still possible
// that it isn't the root variable completely.
if is_moved
&& ((root_var_min_capture_list.len() > 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe simpler to do root_var_min_capture_list.iter().any(|l| l.place.projections.len() > 0) ?

would we ever capture a and a.b? no, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

let (level, _) =
tcx.lint_level_at_node(lint::builtin::DISJOINT_CAPTURE_DROP_REORDER, closure_id);

!matches!(level, lint::Level::Allow)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we want to consider the Edition too .. e.g., in Edition 2021, maybe this lint should be a no-op

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I initially wrote this the PR to introduce 2021 edition was in progress, so I didn't think too much at the time. I don't know if we should just ignore lints that are no-op without letting the user know about it.


// Test migration analysis in case of Drop + Non Drop aggregates.
// Note we need migration here only because the non-copy (because Drop type) is captured,
// otherwise we won't need to, since we can get away with just by ref capture in that case.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need migration here, right? The only drop that will run is still going to run at the same point either way (when the closure is dropped). I agree the analysis as implemented in this PR would be expected to warn, it's just that it's overly conservative.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need migrations here, but this PR doesn't implement the precise path yet. I can add another String to the tuple so that we don't need to move the test when I implement the precise path.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
Checking which error codes lack tests...
Found 435 error codes
Found 0 error codes with no tests
Done!
tidy error: /checkout/compiler/rustc_lint_defs/src/builtin.rs: too many lines (3039) (add `// ignore-tidy-filelength` to the file to suppress this error)
some tidy checks failed

command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "/checkout/obj/build"
expected success, got: exit code: 1

@arora-aman arora-aman force-pushed the migrations_1 branch 3 times, most recently from f6e6601 to eea0668 Compare January 26, 2021 09:39
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 27, 2021

📌 Commit eea0668100c15869891597eec40c0ac2a1b84712 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 27, 2021
@bors
Copy link
Contributor

bors commented Jan 28, 2021

☔ The latest upstream changes (presumably #81461) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 28, 2021
@bors
Copy link
Contributor

bors commented Jan 29, 2021

☔ The latest upstream changes (presumably #81493) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors delegate+

@bors
Copy link
Contributor

bors commented Jan 30, 2021

📌 Commit 11abaa1 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 30, 2021
@bors
Copy link
Contributor

bors commented Jan 30, 2021

✌️ @arora-aman can now approve this pull request

Cargo.lock Outdated
@@ -5388,7 +5388,7 @@ dependencies = [
"chrono",
"lazy_static",
"matchers",
"parking_lot 0.11.0",
"parking_lot 0.9.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change to Cargo.lock intentional?

m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 30, 2021
…sakis

Add lint for 2229 migrations

Implements the first for RFC 2229 where we make the decision to migrate a root variable based on if the type of the variable needs Drop and if the root variable would be moved into the closure when the feature isn't enabled.

r? `@nikomatsakis`
@jonas-schievink
Copy link
Contributor

@bors r- based on #80629 (comment)

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 31, 2021
@camelid camelid added A-closures Area: Closures (`|…| { … }`) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. labels Feb 1, 2021
- This allows us add fake information after handling migrations if
  needed.
- Capture analysis also priortizes what we see earlier, which means
  fake information should go in last.
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-9 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
.................................................................................................... 1000/11335
...........................................................................i........................ 1100/11335
.................................................................................................... 1200/11335
.................................................................................................... 1300/11335
F....F..........................................................ii.i.............i.................. 1400/11335
.................................................................................................... 1600/11335
.................................................................................................... 1700/11335
.....................................................................................i.............. 1800/11335
.................................................................................................... 1900/11335
---
.................................................................................................... 9100/11335
.................................................................................................... 9200/11335
.................................................................................................... 9300/11335
................i......i............................................................................ 9400/11335
........................................................iiiiiiiiiiii.i.............................. 9500/11335
.................................................................................................... 9700/11335
.................................................................................................... 9800/11335
.................................................................................................... 9900/11335
.................................................................................................... 10000/11335
---

---- [ui] ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs stdout ----
diff of stderr:

- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
3    |
4 LL |       let c = || {

18    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19    = note: drop(&(t, t1, t2));
20 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
23    |
24 LL |       let c = || {

33    |
33    |
34    = note: drop(&(t, t1));
35 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
38    |
39 LL |       let c = || {

47    |
47    |
48    = note: drop(&(t));
49 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
52    |
53 LL |       let c = || {

61    |
61    |
62    = note: drop(&(t));
63 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
66    |
67 LL |       let c = || {

75    |
75    |
76    = note: drop(&(t));
77 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
80    |
80    |
81 LL |       let c = move || {
88    |
88    |
89    = note: drop(&(t1, t));
90 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
93    |
94 LL |       let c = || {



The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop/insignificant_drop.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args closures/2229_closure_analysis/migrations/insignificant_drop.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t, t1, t2));
LL | |         let _t = t.0;
LL | |         let _t1 = t1.0;
LL | |         let _t2 = t2.0;
LL | |     };
   |
note: the lint level is defined here
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs:1:9
   |
   |
LL | #![deny(disjoint_capture_drop_reorder)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: drop(&(t, t1, t2));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t, t1));
LL | |         let _t = t.0;
LL | |         let _t1 = t1.0;
LL | |         let _t2 = t2;
LL | |     };
   |
   |
   = note: drop(&(t, t1));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |         println!("{}", t1.1);
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |         let _t1 = t1.0;
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |         let _s = s.0;
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
   |
LL |       let c = move || {
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t1, t));
LL | |         println!("{} {}", t1.1, t.1);
LL | |     };
   |
   |
   = note: drop(&(t1, t));

error: drop order affected for closure because of `capture_disjoint_fields`
   |
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |     };
   |
   |
   = note: drop(&(t));
error: aborting due to 7 previous errors


------------------------------------------
------------------------------------------


---- [ui] ui/closures/2229_closure_analysis/migrations/significant_drop.rs stdout ----


- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
3    |
4 LL |       let c = || {

18    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19    = note: drop(&(t, t1, t2));
20 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
23    |
24 LL |       let c = || {

33    |
33    |
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
34    = note: drop(&(t, t1));
35 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
38    |
39 LL |       let c = || {

47    |
47    |
48    = note: drop(&(t));
49 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
52    |
53 LL |       let c = || {

60    |
60    |
61    = note: drop(&(t));
62 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
65    |
66 LL |       let c = || {

73    |
73    |
74    = note: drop(&(t));
75 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
78    |
79 LL |       let c = || {

86    |
86    |
87    = note: drop(&(t));
88 
- error: Drop order affected for closure because of `capture_disjoint_fields`
+ error: drop order affected for closure because of `capture_disjoint_fields`
91    |
91    |
92 LL |       let c = move || {

The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/significant_drop/significant_drop.stderr
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/significant_drop/significant_drop.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args closures/2229_closure_analysis/migrations/significant_drop.rs`
error: 1 errors occurred comparing output.
status: exit code: 1
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/significant_drop" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/closures/2229_closure_analysis/migrations/significant_drop/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:24:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t, t1, t2));
LL | |         let _t = t.0;
LL | |         let _t1 = t1.0;
LL | |         let _t2 = t2.0;
LL | |     };
   |
note: the lint level is defined here
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:1:9
   |
   |
LL | #![deny(disjoint_capture_drop_reorder)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: drop(&(t, t1, t2));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:42:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t, t1));
LL | |         let _t = t.0;
LL | |         let _t1 = t1.0;
LL | |         let _t2 = t2;
LL | |     };
   |
   |
   = note: drop(&(t, t1));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:58:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |         println!("{:?}", t1.1);
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:75:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:90:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.0;
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:105:13
LL |       let c = || {
   |  _____________^
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t));
LL | |         let _t = t.1;
LL | |     };
   |
   |
   = note: drop(&(t));

error: drop order affected for closure because of `capture_disjoint_fields`
  --> /checkout/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs:120:13
   |
LL |       let c = move || {
   |  _____________^
LL | |     //~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
LL | |     //~| NOTE: drop(&(t1, t));
LL | |         println!("{:?} {:?}", t1.1, t.1);
LL | |     };
   |
   |
   = note: drop(&(t1, t));
error: aborting due to 7 previous errors


------------------------------------------
---
test result: FAILED. 11245 passed; 2 failed; 88 ignored; 0 measured; 0 filtered out; finished in 136.91s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-9/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "9.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:15:45

@arora-aman
Copy link
Member Author

Updated PR to handle issues some conflict with #80092

@arora-aman
Copy link
Member Author

@bors r+

@bors
Copy link
Contributor

bors commented Feb 2, 2021

📌 Commit 84f0a0a has been approved by arora-aman

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 2, 2021
@arora-aman
Copy link
Member Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 2, 2021

💡 This pull request was already approved, no need to approve it again.

  • There's another pull request that is currently being tested, blocking this pull request: Update cargo #81651

@bors
Copy link
Contributor

bors commented Feb 2, 2021

📌 Commit 84f0a0a has been approved by nikomatsakis

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2021
…as-schievink

Rollup of 11 pull requests

Successful merges:

 - rust-lang#80629 (Add lint for 2229 migrations)
 - rust-lang#81022 (Add Frames Iterator for Backtrace)
 - rust-lang#81481 (move some tests)
 - rust-lang#81485 (Add some tests for associated-type-bounds issues)
 - rust-lang#81492 (rustdoc: Note why `rustdoc::html::markdown` is public)
 - rust-lang#81577 (const_evaluatable: consider sub-expressions to be evaluatable)
 - rust-lang#81599 (Implement `TrustedLen` for `Fuse<I: TrustedLen>`)
 - rust-lang#81608 (Improve handling of spans around macro result parse errors)
 - rust-lang#81609 (Remove the remains of query categories)
 - rust-lang#81630 (Fix overflowing text on mobile when sidebar is displayed)
 - rust-lang#81631 (Remove unneeded `mut` variable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a188791 into rust-lang:master Feb 2, 2021
@rustbot rustbot added this to the 1.51.0 milestone Feb 2, 2021
rust-timer added a commit to rust-timer/rust that referenced this pull request Feb 9, 2021
Original message:
Rollup merge of rust-lang#80629 - sexxi-goose:migrations_1, r=nikomatsakis

Add lint for 2229 migrations

Implements the first for RFC 2229 where we make the decision to migrate a root variable based on if the type of the variable needs Drop and if the root variable would be moved into the closure when the feature isn't enabled.

r? `@nikomatsakis`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants