1
Fork 0

Rollup merge of #111020 - cjgillot:validate-self-ctor, r=petrochenkov

Validate resolution for SelfCtor too.

Fixes https://github.com/rust-lang/rust/issues/89868

r? `@petrochenkov`
This commit is contained in:
Matthias Krüger 2023-05-04 08:09:04 +02:00 committed by GitHub
commit 1187ce7213
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 2 deletions

View file

@ -550,7 +550,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let sm = self.tcx.sess.source_map();
let def_id = match outer_res {
Res::SelfTyParam { .. } => {
Res::SelfTyParam { .. } | Res::SelfCtor(_) => {
err.span_label(span, "can't use `Self` here");
return err;
}

View file

@ -1171,7 +1171,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
return Res::Err;
}
}
Res::Def(DefKind::TyParam, _) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => {
Res::Def(DefKind::TyParam, _)
| Res::SelfTyParam { .. }
| Res::SelfTyAlias { .. }
| Res::SelfCtor(_) => {
for rib in ribs {
let has_generic_params: HasGenericParams = match rib.kind {
NormalRibKind