diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-07-28 15:14:26 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-07-29 14:56:50 +1000 |
| commit | db05b0fd343e8204460b0e1f3e261cc4ae940e0a (patch) | |
| tree | 4c71da84e5d71866a92355a2f7471dffe601588e /compiler/rustc_pattern_analysis/src/errors.rs | |
| parent | e1fc4a997ddac2b949ef6bb4037f1fb196c44f08 (diff) | |
| download | rust-db05b0fd343e8204460b0e1f3e261cc4ae940e0a.tar.gz rust-db05b0fd343e8204460b0e1f3e261cc4ae940e0a.zip | |
Encapsulate the printing of `WitnessPat`
This hides the fact that we print `WitnessPat` by converting it to `thir::Pat` and then printing that.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/errors.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/errors.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_pattern_analysis/src/errors.rs b/compiler/rustc_pattern_analysis/src/errors.rs index bad41ac77f0..1f7852e5190 100644 --- a/compiler/rustc_pattern_analysis/src/errors.rs +++ b/compiler/rustc_pattern_analysis/src/errors.rs @@ -26,19 +26,13 @@ impl Uncovered { where 'tcx: 'p, { - let witness_1 = cx.hoist_witness_pat(witnesses.get(0).unwrap()).to_string(); + let witness_1 = cx.print_witness_pat(witnesses.get(0).unwrap()); Self { span, count: witnesses.len(), // Substitute dummy values if witnesses is smaller than 3. These will never be read. - witness_2: witnesses - .get(1) - .map(|w| cx.hoist_witness_pat(w).to_string()) - .unwrap_or_default(), - witness_3: witnesses - .get(2) - .map(|w| cx.hoist_witness_pat(w).to_string()) - .unwrap_or_default(), + witness_2: witnesses.get(1).map(|w| cx.print_witness_pat(w)).unwrap_or_default(), + witness_3: witnesses.get(2).map(|w| cx.print_witness_pat(w)).unwrap_or_default(), witness_1, remainder: witnesses.len().saturating_sub(3), } |
