diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-07-18 12:51:44 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-07-20 13:30:25 +0200 |
| commit | 788fb08bdb375eb811d682b4f24566d0aad1baca (patch) | |
| tree | 566af0e2637308b5ae21cb62c517c1bd13fc4579 /compiler/rustc_ast_lowering/src/lib.rs | |
| parent | 81af9d45698a19183b8552079cbc7bf893fad1e5 (diff) | |
| download | rust-788fb08bdb375eb811d682b4f24566d0aad1baca.tar.gz rust-788fb08bdb375eb811d682b4f24566d0aad1baca.zip | |
Reject relaxed bounds inside associated type bounds
Diffstat (limited to 'compiler/rustc_ast_lowering/src/lib.rs')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 533ee9bff54..d3e8f62618f 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -296,6 +296,7 @@ enum RelaxedBoundPolicy<'a> { enum RelaxedBoundForbiddenReason { TraitObjectTy, SuperTrait, + AssocTyBounds, LateBoundVarsInScope, } @@ -1102,9 +1103,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { &*self.arena.alloc(self.ty(constraint.span, hir::TyKind::Err(guar))); hir::AssocItemConstraintKind::Equality { term: err_ty.into() } } else { - // FIXME(#135229): These should be forbidden! - let bounds = - self.lower_param_bounds(bounds, RelaxedBoundPolicy::Allowed, itctx); + let bounds = self.lower_param_bounds( + bounds, + RelaxedBoundPolicy::Forbidden(RelaxedBoundForbiddenReason::AssocTyBounds), + itctx, + ); hir::AssocItemConstraintKind::Bound { bounds } } } @@ -2117,7 +2120,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { diag.emit(); return; } - RelaxedBoundForbiddenReason::LateBoundVarsInScope => {} + RelaxedBoundForbiddenReason::AssocTyBounds + | RelaxedBoundForbiddenReason::LateBoundVarsInScope => {} }; } } |
