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.
Add test for warning emitting if
match
is too complex
- Loading branch information
1 parent
797780a
commit 74f9bb3
Showing
2 changed files
with
13 additions
and
42 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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
error: reached pattern complexity limit | ||
--> $DIR/complexity_limit.rs:39:5 | ||
warning: this pattern-match expression is taking a long time to analyze | ||
--> $DIR/complexity_limit.rs:31:5 | ||
| | ||
LL | / match command { | ||
LL | | BaseCommand { field01: true, .. } => {} | ||
LL | | BaseCommand { field02: true, .. } => {} | ||
LL | | BaseCommand { field03: true, .. } => {} | ||
... | | ||
LL | | BaseCommand { field30: false, .. } => {} | ||
LL | | BaseCommand { field18: false, .. } => {} | ||
LL | | } | ||
| |_____^ | ||
| | ||
= help: to speed up checking, break it up into smaller `match`es and/or replace some patterns with guards | ||
= note: match checking can take exponential time when many different fields of structs/tuples/arrays are involved | ||
|
||
error: aborting due to 1 previous error | ||
warning: 1 warning emitted | ||
|