forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#122637 - matthiaskrgr:rollup-bczj5bp, r=matth…
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#121236 (Don't show suggestion if slice pattern is not top-level) - rust-lang#121787 (run change tracker even when config parse fails) - rust-lang#122633 (avoid unnecessary collect()) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
9 changed files
with
137 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
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
20 changes: 20 additions & 0 deletions
20
tests/ui/suggestions/suppress-consider-slicing-issue-120605.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,20 @@ | ||
pub struct Struct { | ||
a: Vec<Struct>, | ||
} | ||
|
||
impl Struct { | ||
pub fn test(&self) { | ||
if let [Struct { a: [] }] = &self.a { | ||
//~^ ERROR expected an array or slice | ||
//~| ERROR expected an array or slice | ||
println!("matches!") | ||
} | ||
|
||
if let [Struct { a: [] }] = &self.a[..] { | ||
//~^ ERROR expected an array or slice | ||
println!("matches!") | ||
} | ||
} | ||
} | ||
|
||
fn main() {} |
23 changes: 23 additions & 0 deletions
23
tests/ui/suggestions/suppress-consider-slicing-issue-120605.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,23 @@ | ||
error[E0529]: expected an array or slice, found `Vec<Struct>` | ||
--> $DIR/suppress-consider-slicing-issue-120605.rs:7:16 | ||
| | ||
LL | if let [Struct { a: [] }] = &self.a { | ||
| ^^^^^^^^^^^^^^^^^^ ------- help: consider slicing here: `&self.a[..]` | ||
| | | ||
| pattern cannot match with input type `Vec<Struct>` | ||
|
||
error[E0529]: expected an array or slice, found `Vec<Struct>` | ||
--> $DIR/suppress-consider-slicing-issue-120605.rs:7:29 | ||
| | ||
LL | if let [Struct { a: [] }] = &self.a { | ||
| ^^ pattern cannot match with input type `Vec<Struct>` | ||
|
||
error[E0529]: expected an array or slice, found `Vec<Struct>` | ||
--> $DIR/suppress-consider-slicing-issue-120605.rs:13:29 | ||
| | ||
LL | if let [Struct { a: [] }] = &self.a[..] { | ||
| ^^ pattern cannot match with input type `Vec<Struct>` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0529`. |