summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_resolve/src/ident.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:12:43 +0000
commitcf94bdc0742c13e2a0cac864c478b8626b266e1b (patch)
tree044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /compiler/rustc_resolve/src/ident.rs
parentAdding debian version 1.65.0+dfsg1-2. (diff)
downloadrustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz
rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--compiler/rustc_resolve/src/ident.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs
index 2287aa1eb..e0542d547 100644
--- a/compiler/rustc_resolve/src/ident.rs
+++ b/compiler/rustc_resolve/src/ident.rs
@@ -1162,7 +1162,7 @@ impl<'a> Resolver<'a> {
return Res::Err;
}
}
- Res::Def(DefKind::TyParam, _) | Res::SelfTy { .. } => {
+ Res::Def(DefKind::TyParam, _) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => {
for rib in ribs {
let has_generic_params: HasGenericParams = match rib.kind {
NormalRibKind
@@ -1182,11 +1182,21 @@ impl<'a> Resolver<'a> {
if !(trivial == ConstantHasGenerics::Yes
|| features.generic_const_exprs)
{
- // HACK(min_const_generics): If we encounter `Self` in an anonymous constant
- // we can't easily tell if it's generic at this stage, so we instead remember
- // this and then enforce the self type to be concrete later on.
- if let Res::SelfTy { trait_, alias_to: Some((def, _)) } = res {
- res = Res::SelfTy { trait_, alias_to: Some((def, true)) }
+ // HACK(min_const_generics): If we encounter `Self` in an anonymous
+ // constant we can't easily tell if it's generic at this stage, so
+ // we instead remember this and then enforce the self type to be
+ // concrete later on.
+ if let Res::SelfTyAlias {
+ alias_to: def,
+ forbid_generic: _,
+ is_trait_impl,
+ } = res
+ {
+ res = Res::SelfTyAlias {
+ alias_to: def,
+ forbid_generic: true,
+ is_trait_impl,
+ }
} else {
if let Some(span) = finalize {
self.report_error(