Rollup merge of #135150 - lcnr:unconstrained-lts-comment, r=oli-obk
move footnote to ordinary comment cc #135057
This commit is contained in:
commit
c5c05c2528
1 changed files with 15 additions and 15 deletions
|
@ -128,21 +128,7 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained(
|
||||||
for param in &impl_generics.own_params {
|
for param in &impl_generics.own_params {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
ty::GenericParamDefKind::Lifetime => {
|
ty::GenericParamDefKind::Lifetime => {
|
||||||
let param_lt = cgp::Parameter::from(param.to_early_bound_region_data());
|
// This is a horrible concession to reality. I think it'd be
|
||||||
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
|
|
||||||
// better to just ban unconstrained lifetimes outright, but in
|
// better to just ban unconstrained lifetimes outright, but in
|
||||||
// practice people do non-hygienic macros like:
|
// 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
|
// permit those, so long as the lifetimes aren't used in
|
||||||
// associated types. I believe this is sound, because lifetimes
|
// associated types. I believe this is sound, because lifetimes
|
||||||
// used elsewhere are not projected back out.
|
// 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 { .. } => {
|
ty::GenericParamDefKind::Type { .. } | ty::GenericParamDefKind::Const { .. } => {
|
||||||
// Enforced in `enforce_impl_non_lifetime_params_are_constrained`.
|
// Enforced in `enforce_impl_non_lifetime_params_are_constrained`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue