forked from rust-lang/rust-clippy
-
-
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#7170 - flip1995:revert_drop_order, r=llogiq
Fix stack overflow issue in `redundant_pattern_matching` Fixes rust-lang#7169 ~~cc `@Jarcho` Since tomorrow is release day and we need to get this also fixed in beta, I'll just revert the PR instead of looking into the root issue. Your changes are good, so if you have an idea what could cause this stack overflow and know how to fix it, please open a PR that reverts this revert with a fix.~~ r? `@llogiq` changelog: none (fixes stack overflow, but this was introduced in this release cycle)
- Loading branch information
Showing
3 changed files
with
31 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[derive(Default)] | ||
struct A<T> { | ||
a: Vec<A<T>>, | ||
b: T, | ||
} | ||
|
||
fn main() { | ||
if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {} | ||
} |
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,10 @@ | ||
error: redundant pattern matching, consider using `is_ok()` | ||
--> $DIR/ice-7169.rs:8:12 | ||
| | ||
LL | if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {} | ||
| -------^^^^^-------------------------------------- help: try this: `if Ok::<_, ()>(A::<String>::default()).is_ok()` | ||
| | ||
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|