Don't allow implementing trait directly on type-alias-impl-trait
This is specifically disallowed by the RFC, but we never added a check for it. Fixes #76202
This commit is contained in:
parent
59fb88d061
commit
367efa86d5
3 changed files with 45 additions and 0 deletions
|
@ -230,6 +230,14 @@ impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if let ty::Opaque(def_id, _) = *trait_ref.self_ty().kind() {
|
||||
self.tcx
|
||||
.sess
|
||||
.struct_span_err(sp, "cannot implement trait on type alias impl trait")
|
||||
.span_note(self.tcx.def_span(def_id), "type alias impl trait defined here")
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue