forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
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 rust-lang#116077 - matthiaskrgr:rollup-2y1buzg, r=matth…
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#115770 (Match on elem first while building move paths) - rust-lang#115999 (Capture scrutinee of if let guards correctly) - rust-lang#116056 (Make unsized casts illegal) - rust-lang#116061 (Remove TaKO8Ki from review rotation) - rust-lang#116062 (Change `start` to `#[start]` in some diagnosis) - rust-lang#116067 (Open the FileEncoder file for reading and writing) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
23 changed files
with
334 additions
and
67 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
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,6 @@ | ||
pub struct Data([u8]); | ||
|
||
fn main(){ | ||
const _: *const Data = &[] as *const Data; | ||
//~^ ERROR: casting `&[_; 0]` as `*const Data` is invalid | ||
} |
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,9 @@ | ||
error[E0606]: casting `&[_; 0]` as `*const Data` is invalid | ||
--> $DIR/unsized-struct-cast.rs:4:28 | ||
| | ||
LL | const _: *const Data = &[] as *const Data; | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0606`. |
33 changes: 33 additions & 0 deletions
33
tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2018.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,33 @@ | ||
error[E0505]: cannot move out of `value` because it is borrowed | ||
--> $DIR/if-let-guards-errors.rs:16:13 | ||
| | ||
LL | let f = |x: &E| { | ||
| ------- borrow of `value` occurs here | ||
LL | match &x { | ||
LL | E::Number(_) if let E::Number(ref mut n) = *value => { } | ||
| ------ borrow occurs due to use in closure | ||
... | ||
LL | let x = value; | ||
| ^^^^^ move out of `value` occurs here | ||
LL | | ||
LL | drop(f); | ||
| - borrow later used here | ||
|
||
error[E0382]: use of moved value: `value` | ||
--> $DIR/if-let-guards-errors.rs:28:13 | ||
| | ||
LL | fn if_let_move(value: Box<E>) { | ||
| ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait | ||
LL | let f = |x: &E| { | ||
| ------- value moved into closure here | ||
LL | match &x { | ||
LL | E::Number(_) if let E::String(s) = *value => { } | ||
| ------ variable moved due to use in closure | ||
... | ||
LL | let x = value; | ||
| ^^^^^ value used here after move | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0382, E0505. | ||
For more information about an error, try `rustc --explain E0382`. |
33 changes: 33 additions & 0 deletions
33
tests/ui/closures/2229_closure_analysis/match/if-let-guards-errors.e2021.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,33 @@ | ||
error[E0505]: cannot move out of `value` because it is borrowed | ||
--> $DIR/if-let-guards-errors.rs:16:13 | ||
| | ||
LL | let f = |x: &E| { | ||
| ------- borrow of `*value` occurs here | ||
LL | match &x { | ||
LL | E::Number(_) if let E::Number(ref mut n) = *value => { } | ||
| ------ borrow occurs due to use in closure | ||
... | ||
LL | let x = value; | ||
| ^^^^^ move out of `value` occurs here | ||
LL | | ||
LL | drop(f); | ||
| - borrow later used here | ||
|
||
error[E0382]: use of moved value: `value` | ||
--> $DIR/if-let-guards-errors.rs:28:13 | ||
| | ||
LL | fn if_let_move(value: Box<E>) { | ||
| ----- move occurs because `value` has type `Box<E>`, which does not implement the `Copy` trait | ||
LL | let f = |x: &E| { | ||
| ------- value moved into closure here | ||
LL | match &x { | ||
LL | E::Number(_) if let E::String(s) = *value => { } | ||
| ------ variable moved due to use in closure | ||
... | ||
LL | let x = value; | ||
| ^^^^^ value used here after move | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0382, E0505. | ||
For more information about an error, try `rustc --explain E0382`. |
Oops, something went wrong.