about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-30 19:13:29 +0000
committerbors <bors@rust-lang.org>2024-09-30 19:13:29 +0000
commitfb4aebddd18d258046ddb51fd41589295259a0fa (patch)
tree9cf3e406a149c628a2cb34551d2e8d2ac5c82576 /compiler/rustc_hir_analysis
parent63a0bdd5622eaf6b9524702f055bb4525acfc9f2 (diff)
parentfd67755554100f47b11b70937690cd83319ffc7a (diff)
downloadrust-fb4aebddd18d258046ddb51fd41589295259a0fa.tar.gz
rust-fb4aebddd18d258046ddb51fd41589295259a0fa.zip
Auto merge of #131069 - matthiaskrgr:rollup-jg1icf9, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #131023 (Copy correct path to clipboard for modules/keywords/primitives)
 - #131035 (Preserve brackets around if-lets and skip while-lets)
 - #131038 (Fix `adt_const_params` leaking `{type error}` in error msg)
 - #131053 (Improve `--print=check-cfg` documentation)
 - #131056 (enable compiler fingerprint logs in verbose mode)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_hir_analysis')
-rw-r--r--compiler/rustc_hir_analysis/src/check/wfcheck.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index a71e14ce463..70b0b3f5788 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -961,13 +961,20 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
                         hir_ty.span,
                         "using raw pointers as const generic parameters is forbidden",
                     ),
-                    _ => tcx.dcx().struct_span_err(
-                        hir_ty.span,
-                        format!("`{}` is forbidden as the type of a const generic parameter", ty),
-                    ),
+                    _ => {
+                        // Avoid showing "{type error}" to users. See #118179.
+                        ty.error_reported()?;
+
+                        tcx.dcx().struct_span_err(
+                            hir_ty.span,
+                            format!(
+                                "`{ty}` is forbidden as the type of a const generic parameter",
+                            ),
+                        )
+                    }
                 };
 
-                diag.note("the only supported types are integers, `bool` and `char`");
+                diag.note("the only supported types are integers, `bool`, and `char`");
 
                 let cause = ObligationCause::misc(hir_ty.span, param.def_id);
                 let adt_const_params_feature_string =