-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 #51094 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 3 pull requests Successful merges: - #51049 (Fix behaviour of divergence in while loop conditions) - #51057 (make ui tests robust with respect to NLL) - #51092 ([master] Release notes for 1.26.1) Failed merges:
- Loading branch information
Showing
74 changed files
with
841 additions
and
366 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
48 changes: 37 additions & 11 deletions
48
src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.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 |
---|---|---|
@@ -1,14 +1,40 @@ | ||
error: compilation successful | ||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:12:1 | ||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable | ||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:17:13 | ||
| | ||
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 | ||
LL | | // Original borrow ends at end of function | ||
LL | | let mut x = 1; | ||
LL | | let y = &mut x; | ||
... | | ||
LL | | //~^ immutable borrow occurs here | ||
LL | | } | ||
| |_^ | ||
LL | let y = &mut x; | ||
| ------ mutable borrow occurs here | ||
LL | //~^ mutable borrow occurs here | ||
LL | let z = &x; //~ ERROR cannot borrow | ||
| ^^ immutable borrow occurs here | ||
... | ||
LL | y.use_mut(); | ||
| - borrow later used here | ||
|
||
error: aborting due to previous error | ||
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable | ||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:30:21 | ||
| | ||
LL | let y = &x; | ||
| -- immutable borrow occurs here | ||
LL | //~^ immutable borrow occurs here | ||
LL | let z = &mut x; //~ ERROR cannot borrow | ||
| ^^^^^^ mutable borrow occurs here | ||
... | ||
LL | y.use_ref(); | ||
| - borrow later used here | ||
|
||
error[E0499]: cannot borrow `x` as mutable more than once at a time | ||
--> $DIR/borrowck-report-with-custom-diagnostic.rs:45:17 | ||
| | ||
LL | let y = &mut x; | ||
| ------ first mutable borrow occurs here | ||
LL | //~^ first mutable borrow occurs here | ||
LL | let z = &mut x; //~ ERROR cannot borrow | ||
| ^^^^^^ second mutable borrow occurs here | ||
... | ||
LL | y.use_mut(); | ||
| - borrow later used here | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors occurred: E0499, E0502. | ||
For more information about an error, try `rustc --explain E0499`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
error: compilation successful | ||
--> $DIR/mut-borrow-outside-loop.rs:13:1 | ||
error[E0499]: cannot borrow `void` as mutable more than once at a time | ||
--> $DIR/mut-borrow-outside-loop.rs:17:18 | ||
| | ||
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 | ||
LL | | let mut void = (); | ||
LL | | | ||
LL | | let first = &mut void; | ||
... | | ||
LL | | } | ||
LL | | } | ||
| |_^ | ||
LL | let first = &mut void; | ||
| --------- first mutable borrow occurs here | ||
LL | let second = &mut void; //~ ERROR cannot borrow | ||
| ^^^^^^^^^ second mutable borrow occurs here | ||
LL | first.use_mut(); | ||
| ----- borrow later used here | ||
|
||
error: aborting due to previous error | ||
error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | ||
--> $DIR/mut-borrow-outside-loop.rs:25:28 | ||
| | ||
LL | let inner_first = &mut inner_void; | ||
| --------------- first mutable borrow occurs here | ||
LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow | ||
| ^^^^^^^^^^^^^^^ second mutable borrow occurs here | ||
LL | inner_second.use_mut(); | ||
LL | inner_first.use_mut(); | ||
| ----------- borrow later used here | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0499`. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![feature(never_type)] | ||
|
||
fn main() { | ||
// The `if false` expressions are simply to | ||
// make sure we don't avoid checking everything | ||
// simply because a few expressions are unreachable. | ||
|
||
if false { | ||
let _: ! = { //~ ERROR mismatched types | ||
'a: while break 'a {}; | ||
}; | ||
} | ||
|
||
if false { | ||
let _: ! = { | ||
while false { //~ ERROR mismatched types | ||
break | ||
} | ||
}; | ||
} | ||
|
||
if false { | ||
let _: ! = { | ||
while false { //~ ERROR mismatched types | ||
return | ||
} | ||
}; | ||
} | ||
} |
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,43 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/break-while-condition.rs:19:20 | ||
| | ||
LL | let _: ! = { //~ ERROR mismatched types | ||
| ____________________^ | ||
LL | | 'a: while break 'a {}; | ||
LL | | }; | ||
| |_________^ expected !, found () | ||
| | ||
= note: expected type `!` | ||
found type `()` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/break-while-condition.rs:26:13 | ||
| | ||
LL | fn main() { | ||
| - expected `()` because of default return type | ||
... | ||
LL | / while false { //~ ERROR mismatched types | ||
LL | | break | ||
LL | | } | ||
| |_____________^ expected !, found () | ||
| | ||
= note: expected type `!` | ||
found type `()` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/break-while-condition.rs:34:13 | ||
| | ||
LL | fn main() { | ||
| - expected `()` because of default return type | ||
... | ||
LL | / while false { //~ ERROR mismatched types | ||
LL | | return | ||
LL | | } | ||
| |_____________^ expected !, found () | ||
| | ||
= note: expected type `!` | ||
found type `()` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
error: compilation successful | ||
--> $DIR/issue-11715.rs:97:1 | ||
error[E0499]: cannot borrow `x` as mutable more than once at a time | ||
--> $DIR/issue-11715.rs:100:13 | ||
| | ||
LL | / fn main() { #![rustc_error] // rust-lang/rust#49855 | ||
LL | | let mut x = "foo"; | ||
LL | | let y = &mut x; | ||
LL | | let z = &mut x; //~ ERROR cannot borrow | ||
LL | | } | ||
| |_^ | ||
LL | let y = &mut x; | ||
| ------ first mutable borrow occurs here | ||
LL | let z = &mut x; //~ ERROR cannot borrow | ||
| ^^^^^^ second mutable borrow occurs here | ||
LL | z.use_mut(); | ||
LL | y.use_mut(); | ||
| - borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0499`. |
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
Oops, something went wrong.