diff options
Diffstat (limited to 'compiler/rustc_hir_analysis')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/check.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/wfcheck.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/errors.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/impl_wf_check.rs | 3 |
4 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 0135cdf1e90..16eeb57b2b9 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -1564,7 +1564,7 @@ fn check_type_alias_type_params_are_used<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalD // * compare the param span to the pred span to detect lone user-written `Sized` bounds let has_explicit_bounds = bounded_params.is_empty() || (*bounded_params).get(¶m.index).is_some_and(|&&pred_sp| pred_sp != span); - let const_param_help = (!has_explicit_bounds).then_some(()); + let const_param_help = !has_explicit_bounds; let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter { span, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index bdf2914fc50..d4b2c3f8a87 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1972,8 +1972,7 @@ fn report_bivariance<'tcx>( } let const_param_help = - matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds) - .then_some(()); + matches!(param.kind, hir::GenericParamKind::Type { .. } if !has_explicit_bounds); let mut diag = tcx.dcx().create_err(errors::UnusedGenericParameter { span: param.span, diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 7034735aec0..821f79505f0 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1606,7 +1606,7 @@ pub(crate) struct UnusedGenericParameter { #[subdiagnostic] pub help: UnusedGenericParameterHelp, #[help(hir_analysis_const_param_help)] - pub const_param_help: Option<()>, + pub const_param_help: bool, } #[derive(Diagnostic)] @@ -1643,9 +1643,9 @@ pub(crate) struct UnconstrainedGenericParameter { pub param_name: Symbol, pub param_def_kind: &'static str, #[note(hir_analysis_const_param_note)] - pub const_param_note: Option<()>, + pub const_param_note: bool, #[note(hir_analysis_const_param_note2)] - pub const_param_note2: Option<()>, + pub const_param_note2: bool, } #[derive(Diagnostic)] diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check.rs b/compiler/rustc_hir_analysis/src/impl_wf_check.rs index ab441ed4cde..02520c472b9 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check.rs @@ -137,8 +137,7 @@ fn enforce_impl_params_are_constrained( } }; if err { - let const_param_note = - matches!(param.kind, ty::GenericParamDefKind::Const { .. }).then_some(()); + let const_param_note = matches!(param.kind, ty::GenericParamDefKind::Const { .. }); let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter { span: tcx.def_span(param.def_id), param_name: param.name, |
