Skip to content

Commit 876d5f3

Browse files
committed
Rename and document a relaxed bound reason
1 parent 82c1c87 commit 876d5f3

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
20692069
{
20702070
RelaxedBoundPolicy::Allowed
20712071
} else {
2072-
RelaxedBoundPolicy::Forbidden(RelaxedBoundForbiddenReason::LateBoundVarsInScope)
2072+
RelaxedBoundPolicy::Forbidden(RelaxedBoundForbiddenReason::WhereBound)
20732073
};
20742074
hir::WherePredicateKind::BoundPredicate(hir::WhereBoundPredicate {
20752075
bound_generic_params: self.lower_generic_params(

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ enum RelaxedBoundForbiddenReason {
329329
SuperTrait,
330330
TraitAlias,
331331
AssocTyBounds,
332-
LateBoundVarsInScope,
332+
/// We do not allow where bounds doing relaxed bounds,
333+
/// except if it's for generic parameters of the current item.
334+
WhereBound,
333335
}
334336

335337
/// Context of `impl Trait` in code, which determines whether it is allowed in an HIR subtree,
@@ -2268,7 +2270,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
22682270
return;
22692271
}
22702272
RelaxedBoundForbiddenReason::AssocTyBounds
2271-
| RelaxedBoundForbiddenReason::LateBoundVarsInScope => {}
2273+
| RelaxedBoundForbiddenReason::WhereBound => {}
22722274
};
22732275
}
22742276
}

0 commit comments

Comments
 (0)