-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #55554 - pietroalbini:beta-rollup, r=pietroalbini
[beta] Rollup backports Merged and approved: * #55494: borrowck=migrate must look at parents of closures * #55343: rustbuild: fix remap-debuginfo when building a release * #55412: Fix an ICE in the min_const_fn analysis Rolled up PRs: * #55550: [beta] Update the boostrap compiler r? @ghost
- Loading branch information
Showing
17 changed files
with
303 additions
and
76 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
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
55 changes: 55 additions & 0 deletions
55
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr
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,55 @@ | ||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:22 | ||
| | ||
LL | let mut c1 = |y: &'static mut isize| x = y; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably | ||
help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | ||
| | ||
LL | x | ||
| | ||
|
||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22 | ||
| | ||
LL | let mut c1 = |z: &'static mut isize| { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably | ||
help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | ||
| | ||
LL | x | ||
| | ||
|
||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9 | ||
| | ||
LL | pub fn capture_assign_whole(x: (i32,)) { | ||
| - help: make this binding mutable: `mut x` | ||
LL | || { x = (1,); }; | ||
| ^^ cannot borrow mutably | ||
|
||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9 | ||
| | ||
LL | pub fn capture_assign_part(x: (i32,)) { | ||
| - help: make this binding mutable: `mut x` | ||
LL | || { x.0 = 1; }; | ||
| ^^ cannot borrow mutably | ||
|
||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 | ||
| | ||
LL | pub fn capture_reborrow_whole(x: (i32,)) { | ||
| - help: make this binding mutable: `mut x` | ||
LL | || { &mut x; }; | ||
| ^^ cannot borrow mutably | ||
|
||
error[E0595]: closure cannot assign to immutable argument `x` | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9 | ||
| | ||
LL | pub fn capture_reborrow_part(x: (i32,)) { | ||
| - help: make this binding mutable: `mut x` | ||
LL | || { &mut x.0; }; | ||
| ^^ cannot borrow mutably | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0595`. |
54 changes: 54 additions & 0 deletions
54
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr
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,54 @@ | ||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46 | ||
| | ||
LL | pub fn e(x: &'static mut isize) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | static mut Y: isize = 3; | ||
LL | let mut c1 = |y: &'static mut isize| x = y; | ||
| ^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 | ||
| | ||
LL | pub fn ee(x: &'static mut isize) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
... | ||
LL | let mut c2 = |y: &'static mut isize| x = y; | ||
| ^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 | ||
| | ||
LL | pub fn capture_assign_whole(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { x = (1,); }; | ||
| ^^^^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 | ||
| | ||
LL | pub fn capture_assign_part(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { x.0 = 1; }; | ||
| ^^^^^^^ cannot assign | ||
|
||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | ||
| | ||
LL | pub fn capture_reborrow_whole(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { &mut x; }; | ||
| ^^^^^^ cannot borrow as mutable | ||
|
||
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 | ||
| | ||
LL | pub fn capture_reborrow_part(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { &mut x.0; }; | ||
| ^^^^^^^^ cannot borrow as mutable | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors occurred: E0594, E0596. | ||
For more information about an error, try `rustc --explain E0594`. |
54 changes: 54 additions & 0 deletions
54
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr
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,54 @@ | ||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:21:46 | ||
| | ||
LL | pub fn e(x: &'static mut isize) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | static mut Y: isize = 3; | ||
LL | let mut c1 = |y: &'static mut isize| x = y; | ||
| ^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 | ||
| | ||
LL | pub fn ee(x: &'static mut isize) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
... | ||
LL | let mut c2 = |y: &'static mut isize| x = y; | ||
| ^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x`, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 | ||
| | ||
LL | pub fn capture_assign_whole(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { x = (1,); }; | ||
| ^^^^^^^^ cannot assign | ||
|
||
error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 | ||
| | ||
LL | pub fn capture_assign_part(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { x.0 = 1; }; | ||
| ^^^^^^^ cannot assign | ||
|
||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | ||
| | ||
LL | pub fn capture_reborrow_whole(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { &mut x; }; | ||
| ^^^^^^ cannot borrow as mutable | ||
|
||
error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable | ||
--> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 | ||
| | ||
LL | pub fn capture_reborrow_part(x: (i32,)) { | ||
| - help: consider changing this to be mutable: `mut x` | ||
LL | || { &mut x.0; }; | ||
| ^^^^^^^^ cannot borrow as mutable | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
Some errors occurred: E0594, E0596. | ||
For more information about an error, try `rustc --explain E0594`. |
61 changes: 61 additions & 0 deletions
61
src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.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,61 @@ | ||
// rust-lang/rust#55492: errors detected during MIR-borrowck's | ||
// analysis of a closure body may only be caught when AST-borrowck | ||
// looks at some parent. | ||
|
||
// revisions: ast migrate nll | ||
|
||
// Since we are testing nll (and migration) explicitly as a separate | ||
// revisions, don't worry about the --compare-mode=nll on this test. | ||
|
||
// ignore-compare-mode-nll | ||
|
||
//[ast]compile-flags: -Z borrowck=ast | ||
//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows | ||
//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows | ||
|
||
|
||
// transcribed from borrowck-closures-unique.rs | ||
mod borrowck_closures_unique { | ||
pub fn e(x: &'static mut isize) { | ||
static mut Y: isize = 3; | ||
let mut c1 = |y: &'static mut isize| x = y; | ||
unsafe { c1(&mut Y); } | ||
} | ||
} | ||
|
||
mod borrowck_closures_unique_grandparent { | ||
pub fn ee(x: &'static mut isize) { | ||
static mut Z: isize = 3; | ||
let mut c1 = |z: &'static mut isize| { | ||
let mut c2 = |y: &'static mut isize| x = y; | ||
c2(z); | ||
}; | ||
unsafe { c1(&mut Z); } | ||
} | ||
} | ||
|
||
// adapted from mutability_errors.rs | ||
mod mutability_errors { | ||
pub fn capture_assign_whole(x: (i32,)) { | ||
|| { x = (1,); }; | ||
} | ||
pub fn capture_assign_part(x: (i32,)) { | ||
|| { x.0 = 1; }; | ||
} | ||
pub fn capture_reborrow_whole(x: (i32,)) { | ||
|| { &mut x; }; | ||
} | ||
pub fn capture_reborrow_part(x: (i32,)) { | ||
|| { &mut x.0; }; | ||
} | ||
} | ||
|
||
fn main() { | ||
static mut X: isize = 2; | ||
unsafe { borrowck_closures_unique::e(&mut X); } | ||
|
||
mutability_errors::capture_assign_whole((1000,)); | ||
mutability_errors::capture_assign_part((2000,)); | ||
mutability_errors::capture_reborrow_whole((3000,)); | ||
mutability_errors::capture_reborrow_part((4000,)); | ||
} |
Oops, something went wrong.