From 37f28755882da96e0ef47cef042f3961bf85c5e0 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 5 Jan 2025 01:03:32 +0000 Subject: [PATCH 1/8] Add doc aliases for `libm` and IEEE names Searching "fma" in the Rust documentation returns results for `intrinsics::fma*`, but does not point to the user-facing `mul_add`. Add aliases for `fma*` and the IEEE operation name `fusedMultiplyAdd`. Add the IEEE name to `sqrt` as well, `squareRoot`. --- library/std/src/f128.rs | 2 ++ library/std/src/f16.rs | 2 ++ library/std/src/f32.rs | 2 ++ library/std/src/f64.rs | 2 ++ 4 files changed, 8 insertions(+) diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs index e93e915159e40..4f37e18a8cd76 100644 --- a/library/std/src/f128.rs +++ b/library/std/src/f128.rs @@ -227,6 +227,7 @@ impl f128 { /// ``` #[inline] #[rustc_allow_incoherent_impl] + #[doc(alias = "fmaf128", alias = "fusedMultiplyAdd")] #[unstable(feature = "f128", issue = "116909")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn mul_add(self, a: f128, b: f128) -> f128 { @@ -384,6 +385,7 @@ impl f128 { /// # } /// ``` #[inline] + #[doc(alias = "squareRoot")] #[rustc_allow_incoherent_impl] #[unstable(feature = "f128", issue = "116909")] #[must_use = "method returns a new number and does not mutate the original value"] diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs index 5b7fcaa28e064..42cd6e3fe2a5f 100644 --- a/library/std/src/f16.rs +++ b/library/std/src/f16.rs @@ -228,6 +228,7 @@ impl f16 { #[inline] #[rustc_allow_incoherent_impl] #[unstable(feature = "f16", issue = "116909")] + #[doc(alias = "fmaf16", alias = "fusedMultiplyAdd")] #[must_use = "method returns a new number and does not mutate the original value"] pub fn mul_add(self, a: f16, b: f16) -> f16 { unsafe { intrinsics::fmaf16(self, a, b) } @@ -384,6 +385,7 @@ impl f16 { /// # } /// ``` #[inline] + #[doc(alias = "squareRoot")] #[rustc_allow_incoherent_impl] #[unstable(feature = "f16", issue = "116909")] #[must_use = "method returns a new number and does not mutate the original value"] diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs index 7cb285bbff5f7..438d77b1626be 100644 --- a/library/std/src/f32.rs +++ b/library/std/src/f32.rs @@ -210,6 +210,7 @@ impl f32 { /// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0); /// ``` #[rustc_allow_incoherent_impl] + #[doc(alias = "fmaf", alias = "fusedMultiplyAdd")] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] @@ -360,6 +361,7 @@ impl f32 { /// assert!(negative.sqrt().is_nan()); /// assert!(negative_zero.sqrt() == negative_zero); /// ``` + #[doc(alias = "squareRoot")] #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs index 47163c272de32..9bb4bfbab2a0f 100644 --- a/library/std/src/f64.rs +++ b/library/std/src/f64.rs @@ -210,6 +210,7 @@ impl f64 { /// assert_eq!(one_plus_eps * one_minus_eps + minus_one, 0.0); /// ``` #[rustc_allow_incoherent_impl] + #[doc(alias = "fma", alias = "fusedMultiplyAdd")] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] #[inline] @@ -360,6 +361,7 @@ impl f64 { /// assert!(negative.sqrt().is_nan()); /// assert!(negative_zero.sqrt() == negative_zero); /// ``` + #[doc(alias = "squareRoot")] #[rustc_allow_incoherent_impl] #[must_use = "method returns a new number and does not mutate the original value"] #[stable(feature = "rust1", since = "1.0.0")] From 58718678086cf9e6691fd4fe3c15c4cb78777e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Mon, 6 Jan 2025 01:27:47 +0800 Subject: [PATCH 2/8] triagebot: label `src/doc/rustc-dev-guide` changes with `A-rustc-dev-guide` --- triagebot.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index 436c88541a5f7..1e3ac860f29e3 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -498,6 +498,11 @@ trigger_files = [ "src/tools/compiletest" ] +[autolabel."A-rustc-dev-guide"] +trigger_files = [ + "src/doc/rustc-dev-guide", +] + [notify-zulip."I-prioritize"] zulip_stream = 245100 # #t-compiler/wg-prioritization/alerts topic = "#{number} {title}" From 2cc114c6da536e85117a103a50298e13944a2475 Mon Sep 17 00:00:00 2001 From: Boxy Date: Sun, 5 Jan 2025 18:39:43 +0000 Subject: [PATCH 3/8] rustc-dev-guide changes ping group --- triagebot.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/triagebot.toml b/triagebot.toml index 436c88541a5f7..8c2c9d541fdfd 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -990,6 +990,10 @@ https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. """ cc = ["@ehuss"] +[mentions."src/doc/rustc-dev-guide"] +message = "The rustc-dev-guide subtree was changed. If this PR *only* touches the dev guide consider submitting a PR directly to [rust-lang/rustc-dev-guide](https://github.com/rust-lang/rustc-dev-guide/pulls) otherwise thank you for updating the dev guide with your changes." +cc = ["@BoxyUwU", "@jieyouxu", "@kobzol"] + [assign] warn_non_default_branch.enable = true contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html" @@ -1208,7 +1212,7 @@ project-exploit-mitigations = [ "/src/doc/nomicon" = ["@ehuss"] "/src/doc/reference" = ["@ehuss"] "/src/doc/rust-by-example" = ["@ehuss"] -"/src/doc/rustc-dev-guide" = ["@kobzol", "@jieyouxu"] +"/src/doc/rustc-dev-guide" = ["compiler"] "/src/doc/rustdoc" = ["rustdoc"] "/src/doc/style-guide" = ["style-team"] "/src/etc" = ["@Mark-Simulacrum"] From 2a96478dd80802ca98f358ffeeea17c7a508ced7 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Sun, 5 Jan 2025 17:06:47 -0800 Subject: [PATCH 4/8] Mention `unnameable_types` in `unreachable_pub` documentation. This link makes sense because someone who wishes to avoid unusable `pub` is likely, but not guaranteed, to be interested in avoiding unnameable types. Also fixed some grammar problems I noticed in the area. Fixes #116604. --- compiler/rustc_lint/src/builtin.rs | 8 +++++--- compiler/rustc_lint_defs/src/builtin.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 2feed5e80dc58..e74fb9d92e9e0 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1244,8 +1244,8 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller { declare_lint! { /// The `unreachable_pub` lint triggers for `pub` items not reachable from other crates - that - /// means neither directly accessible, nor reexported, nor leaked through things like return - /// types. + /// means neither directly accessible, nor reexported (with `pub use`), nor leaked through + /// things like return types (which the [`unnameable_types`] lint can detect if desired). /// /// ### Example /// @@ -1272,8 +1272,10 @@ declare_lint! { /// intent that the item is only visible within its own crate. /// /// This lint is "allow" by default because it will trigger for a large - /// amount existing Rust code, and has some false-positives. Eventually it + /// amount of existing Rust code, and has some false-positives. Eventually it /// is desired for this to become warn-by-default. + /// + /// [`unnameable_types`]: #unnameable-types pub UNREACHABLE_PUB, Allow, "`pub` items not reachable from crate root" diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 2f23ab27492ca..8399f4c12f4f5 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -4362,7 +4362,7 @@ declare_lint! { /// ### Explanation /// /// It is often expected that if you can obtain an object of type `T`, then - /// you can name the type `T` as well, this lint attempts to enforce this rule. + /// you can name the type `T` as well; this lint attempts to enforce this rule. /// The recommended action is to either reexport the type properly to make it nameable, /// or document that users are not supposed to be able to name it for one reason or another. /// From 3560a2b399ea30b8cd62d9c91a326f03a728e92a Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 6 Jan 2025 03:14:04 +0000 Subject: [PATCH 5/8] Improve span when temporary receiver is dropped in edition 2024 --- .../src/diagnostics/explain_borrow.rs | 34 +++++++++++++++++++ .../lifetimes/tail-expr-in-nested-expr.stderr | 3 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 22f7f708419b9..87017460e8ec3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -17,6 +17,7 @@ use rustc_middle::mir::{ }; use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt}; +use rustc_middle::util::CallKind; use rustc_span::{DesugaringKind, Span, Symbol, kw, sym}; use rustc_trait_selection::error_reporting::traits::FindExprBySpan; use tracing::{debug, instrument}; @@ -635,6 +636,39 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> { // Used in a closure. (LaterUseKind::ClosureCapture, capture_kind_span, Some(path_span)) } + // In the case that the borrowed value (probably a temporary) + // overlaps with the method's receiver, then point at the method. + UseSpans::FnSelfUse { + var_span: span, + kind: CallKind::Normal { desugaring: None, .. }, + .. + } if span + .overlaps(self.body.local_decls[borrow.assigned_place.local].source_info.span) => + { + if let TerminatorKind::Call { func, call_source: CallSource::Normal, .. } = + &self.body.basic_blocks[location.block].terminator().kind + { + // Just point to the function, to reduce the chance of overlapping spans. + let function_span = match func { + Operand::Constant(c) => c.span, + Operand::Copy(place) | Operand::Move(place) => { + if let Some(l) = place.as_local() { + let local_decl = &self.body.local_decls[l]; + if self.local_names[l].is_none() { + local_decl.source_info.span + } else { + span + } + } else { + span + } + } + }; + (LaterUseKind::Call, function_span, None) + } else { + (LaterUseKind::Other, span, None) + } + } UseSpans::PatUse(span) | UseSpans::OtherUse(span) | UseSpans::FnSelfUse { var_span: span, .. } => { diff --git a/tests/ui/lifetimes/tail-expr-in-nested-expr.stderr b/tests/ui/lifetimes/tail-expr-in-nested-expr.stderr index 6770da091ce8d..09801a1aad24a 100644 --- a/tests/ui/lifetimes/tail-expr-in-nested-expr.stderr +++ b/tests/ui/lifetimes/tail-expr-in-nested-expr.stderr @@ -2,11 +2,10 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/tail-expr-in-nested-expr.rs:4:15 | LL | let _ = { String::new().as_str() }.len(); - | ^^^^^^^^^^^^^--------- + | ^^^^^^^^^^^^^ - --- borrow later used by call | | | | | temporary value is freed at the end of this statement | creates a temporary value which is freed while still in use - | borrow later used here | = note: consider using a `let` binding to create a longer lived value From cd65cd27db8a8fc11f3191d3e461d331ed0db968 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 6 Jan 2025 03:17:04 +0000 Subject: [PATCH 6/8] Improve find_self_call with reborrowed receiver --- .../rustc_middle/src/util/find_self_call.rs | 41 ++++++++++--------- tests/ui/lint/lint-const-item-mutation.stderr | 7 +++- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_middle/src/util/find_self_call.rs b/compiler/rustc_middle/src/util/find_self_call.rs index ec6051d0a771a..0fdd352073860 100644 --- a/compiler/rustc_middle/src/util/find_self_call.rs +++ b/compiler/rustc_middle/src/util/find_self_call.rs @@ -17,26 +17,29 @@ pub fn find_self_call<'tcx>( debug!("find_self_call(local={:?}): terminator={:?}", local, body[block].terminator); if let Some(Terminator { kind: TerminatorKind::Call { func, args, .. }, .. }) = &body[block].terminator + && let Operand::Constant(box ConstOperand { const_, .. }) = func + && let ty::FnDef(def_id, fn_args) = *const_.ty().kind() + && let Some(ty::AssocItem { fn_has_self_parameter: true, .. }) = + tcx.opt_associated_item(def_id) + && let [Spanned { node: Operand::Move(self_place) | Operand::Copy(self_place), .. }, ..] = + **args { - debug!("find_self_call: func={:?}", func); - if let Operand::Constant(box ConstOperand { const_, .. }) = func { - if let ty::FnDef(def_id, fn_args) = *const_.ty().kind() { - if let Some(ty::AssocItem { fn_has_self_parameter: true, .. }) = - tcx.opt_associated_item(def_id) - { - debug!("find_self_call: args={:?}", fn_args); - if let [ - Spanned { - node: Operand::Move(self_place) | Operand::Copy(self_place), .. - }, - .., - ] = **args - { - if self_place.as_local() == Some(local) { - return Some((def_id, fn_args)); - } - } - } + if self_place.as_local() == Some(local) { + return Some((def_id, fn_args)); + } + + // Handle the case where `self_place` gets reborrowed. + // This happens when the receiver is `&T`. + for stmt in &body[block].statements { + if let StatementKind::Assign(box (place, rvalue)) = &stmt.kind + && let Some(reborrow_local) = place.as_local() + && self_place.as_local() == Some(reborrow_local) + && let Rvalue::Ref(_, _, deref_place) = rvalue + && let PlaceRef { local: deref_local, projection: [ProjectionElem::Deref] } = + deref_place.as_ref() + && deref_local == local + { + return Some((def_id, fn_args)); } } } diff --git a/tests/ui/lint/lint-const-item-mutation.stderr b/tests/ui/lint/lint-const-item-mutation.stderr index 747c38b800764..0e405c306fe46 100644 --- a/tests/ui/lint/lint-const-item-mutation.stderr +++ b/tests/ui/lint/lint-const-item-mutation.stderr @@ -75,10 +75,15 @@ warning: taking a mutable reference to a `const` item --> $DIR/lint-const-item-mutation.rs:42:5 | LL | (&mut MY_STRUCT).use_mut(); - | ^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: each usage of a `const` item creates a new temporary = note: the mutable reference will refer to this temporary, not the original `const` item +note: mutable reference created due to call to this method + --> $DIR/lint-const-item-mutation.rs:9:5 + | +LL | fn use_mut(&mut self) {} + | ^^^^^^^^^^^^^^^^^^^^^ note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:27:1 | From 339902908eba714abb3fbb7ec9014393392ea7f6 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 6 Jan 2025 03:45:02 +0000 Subject: [PATCH 7/8] Remove CallKind::Deref hack from UseSpans It's not really necessary --- compiler/rustc_borrowck/src/diagnostics/mod.rs | 9 --------- tests/ui/moves/move-deref-coercion.stderr | 4 ++-- tests/ui/no-capture-arc.stderr | 4 ++-- tests/ui/no-reuse-move-arc.stderr | 4 ++-- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 180046ca25620..ebbdfea302cd3 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -661,9 +661,6 @@ impl UseSpans<'_> { UseSpans::ClosureUse { args_span: span, .. } | UseSpans::PatUse(span) | UseSpans::OtherUse(span) => span, - UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => { - fn_call_span - } UseSpans::FnSelfUse { var_span, .. } => var_span, } } @@ -674,9 +671,6 @@ impl UseSpans<'_> { UseSpans::ClosureUse { path_span: span, .. } | UseSpans::PatUse(span) | UseSpans::OtherUse(span) => span, - UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => { - fn_call_span - } UseSpans::FnSelfUse { var_span, .. } => var_span, } } @@ -687,9 +681,6 @@ impl UseSpans<'_> { UseSpans::ClosureUse { capture_kind_span: span, .. } | UseSpans::PatUse(span) | UseSpans::OtherUse(span) => span, - UseSpans::FnSelfUse { fn_call_span, kind: CallKind::DerefCoercion { .. }, .. } => { - fn_call_span - } UseSpans::FnSelfUse { var_span, .. } => var_span, } } diff --git a/tests/ui/moves/move-deref-coercion.stderr b/tests/ui/moves/move-deref-coercion.stderr index 5760f4a7fdc35..25639075a3f4e 100644 --- a/tests/ui/moves/move-deref-coercion.stderr +++ b/tests/ui/moves/move-deref-coercion.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of partially moved value: `val` LL | let _val = val.first; | --------- value partially moved here LL | val.inner; - | ^^^^^^^^^ value borrowed here after partial move + | ^^^ value borrowed here after partial move | = note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait = note: borrow occurs due to deref coercion to `NotCopy` @@ -20,7 +20,7 @@ error[E0382]: borrow of partially moved value: `val` LL | let _val = val.first; | --------- value partially moved here LL | val.inner_method(); - | ^^^^^^^^^^^^^^^^^^ value borrowed here after partial move + | ^^^ value borrowed here after partial move | = note: partial move occurs because `val.first` has type `NotCopy`, which does not implement the `Copy` trait = note: borrow occurs due to deref coercion to `NotCopy` diff --git a/tests/ui/no-capture-arc.stderr b/tests/ui/no-capture-arc.stderr index 38432c851c522..4a51ddb67a39d 100644 --- a/tests/ui/no-capture-arc.stderr +++ b/tests/ui/no-capture-arc.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `arc_v` - --> $DIR/no-capture-arc.rs:14:16 + --> $DIR/no-capture-arc.rs:14:18 | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc>`, which does not implement the `Copy` trait @@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[3], 4); | ----- variable moved due to use in closure ... LL | assert_eq!((*arc_v)[2], 3); - | ^^^^^^^^ value borrowed here after move + | ^^^^^ value borrowed here after move | = note: borrow occurs due to deref coercion to `Vec` diff --git a/tests/ui/no-reuse-move-arc.stderr b/tests/ui/no-reuse-move-arc.stderr index cdeb6eadc174f..61f4837dc0e66 100644 --- a/tests/ui/no-reuse-move-arc.stderr +++ b/tests/ui/no-reuse-move-arc.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `arc_v` - --> $DIR/no-reuse-move-arc.rs:12:16 + --> $DIR/no-reuse-move-arc.rs:12:18 | LL | let arc_v = Arc::new(v); | ----- move occurs because `arc_v` has type `Arc>`, which does not implement the `Copy` trait @@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[3], 4); | ----- variable moved due to use in closure ... LL | assert_eq!((*arc_v)[2], 3); - | ^^^^^^^^ value borrowed here after move + | ^^^^^ value borrowed here after move | = note: borrow occurs due to deref coercion to `Vec` From ae6a3313cfe1df34cebd6613423581d75567c526 Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 6 Jan 2025 07:37:52 +0100 Subject: [PATCH 8/8] footnote to ordinary comment --- .../rustc_hir_analysis/src/impl_wf_check.rs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check.rs b/compiler/rustc_hir_analysis/src/impl_wf_check.rs index bb122009593b9..42034736ad674 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check.rs @@ -128,21 +128,7 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained( for param in &impl_generics.own_params { match param.kind { ty::GenericParamDefKind::Lifetime => { - let param_lt = cgp::Parameter::from(param.to_early_bound_region_data()); - if lifetimes_in_associated_types.contains(¶m_lt) // (*) - && !input_parameters.contains(¶m_lt) - { - let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter { - span: tcx.def_span(param.def_id), - param_name: param.name, - param_def_kind: tcx.def_descr(param.def_id), - const_param_note: false, - const_param_note2: false, - }); - diag.code(E0207); - res = Err(diag.emit()); - } - // (*) This is a horrible concession to reality. I think it'd be + // This is a horrible concession to reality. I think it'd be // better to just ban unconstrained lifetimes outright, but in // practice people do non-hygienic macros like: // @@ -160,6 +146,20 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained( // permit those, so long as the lifetimes aren't used in // associated types. I believe this is sound, because lifetimes // used elsewhere are not projected back out. + let param_lt = cgp::Parameter::from(param.to_early_bound_region_data()); + if lifetimes_in_associated_types.contains(¶m_lt) + && !input_parameters.contains(¶m_lt) + { + let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter { + span: tcx.def_span(param.def_id), + param_name: param.name, + param_def_kind: tcx.def_descr(param.def_id), + const_param_note: false, + const_param_note2: false, + }); + diag.code(E0207); + res = Err(diag.emit()); + } } ty::GenericParamDefKind::Type { .. } | ty::GenericParamDefKind::Const { .. } => { // Enforced in `enforce_impl_non_lifetime_params_are_constrained`.