diff options
| author | Ben Kimock <kimockb@gmail.com> | 2025-08-10 01:45:38 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-10 01:45:38 +0000 |
| commit | 85c8d7089035d60c63a0594b07ff48981399f2ed (patch) | |
| tree | f126cf7695965577ab96b9c27e5a9c5c491f8dd2 /compiler/rustc_pattern_analysis | |
| parent | ee1b237215ee90df2c0102457fa2d0e9c2df8753 (diff) | |
| parent | 6e83b592cddec5ab61f1e4307134fd8f4069351e (diff) | |
| download | rust-85c8d7089035d60c63a0594b07ff48981399f2ed.tar.gz rust-85c8d7089035d60c63a0594b07ff48981399f2ed.zip | |
Merge pull request #4518 from rust-lang/rustup-2025-08-09
Automatic Rustup
Diffstat (limited to 'compiler/rustc_pattern_analysis')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/constructor.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_pattern_analysis/tests/exhaustiveness.rs | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 9a9e0db964c..12f653a1337 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -1130,16 +1130,16 @@ impl<Cx: PatCx> ConstructorSet<Cx> { seen_false = true; } } - if seen_false { - present.push(Bool(false)); - } else { - missing.push(Bool(false)); - } if seen_true { present.push(Bool(true)); } else { missing.push(Bool(true)); } + if seen_false { + present.push(Bool(false)); + } else { + missing.push(Bool(false)); + } } ConstructorSet::Integers { range_1, range_2 } => { let seen_ranges: Vec<_> = diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs index 14ca0d057f0..4ad64f81560 100644 --- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs +++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs @@ -176,6 +176,9 @@ fn test_witnesses() { ), vec!["Enum::Variant1(_)", "Enum::Variant2(_)", "_"], ); + + // Assert we put `true` before `false`. + assert_witnesses(AllOfThem, Ty::Bool, Vec::new(), vec!["true", "false"]); } #[test] |
