Move an impl-Trait check from AST validation to AST lowering

This commit is contained in:
León Orell Valerian Liehr 2024-10-27 06:21:24 +01:00
parent 6faf0bd3e5
commit 442f39582d
No known key found for this signature in database
GPG key ID: D17A07215F68E713
13 changed files with 78 additions and 153 deletions

View file

@ -1203,15 +1203,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
err.emit()
} else if let Err(reported) = qself_ty.error_reported() {
reported
} else if let ty::Alias(ty::Opaque, alias_ty) = qself_ty.kind() {
// `<impl Trait as OtherTrait>::Assoc` makes no sense.
struct_span_code_err!(
self.dcx(),
tcx.def_span(alias_ty.def_id),
E0667,
"`impl Trait` is not allowed in path parameters"
)
.emit() // Already reported in an earlier stage.
} else {
self.maybe_report_similar_assoc_fn(span, qself_ty, qself)?;