about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-06-19 19:25:50 -0700
committerMichael Goulet <michael@errs.io>2022-06-19 19:44:00 -0700
commit047de83e028f50f21560a5805baaef3f697837f4 (patch)
tree0c1bf5da4152dd682f3afc53573cdbc74144a25a
parent018c319b211eb7e42f1c8afabdcce5b5272c0614 (diff)
downloadrust-047de83e028f50f21560a5805baaef3f697837f4.tar.gz
rust-047de83e028f50f21560a5805baaef3f697837f4.zip
Don't suggest adding Self as a type parameter
-rw-r--r--compiler/rustc_resolve/src/late/diagnostics.rs2
-rw-r--r--src/test/ui/type-alias/issue-62364-self-ty-arg.stderr5
2 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs
index 6b0b83d2cb5..27bce60df2b 100644
--- a/compiler/rustc_resolve/src/late/diagnostics.rs
+++ b/compiler/rustc_resolve/src/late/diagnostics.rs
@@ -1807,7 +1807,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
         path: &[Segment],
     ) -> Option<(Span, &'static str, String, Applicability)> {
         let (ident, span) = match path {
-            [segment] if !segment.has_generic_args => {
+            [segment] if !segment.has_generic_args && segment.ident.name != kw::SelfUpper => {
                 (segment.ident.to_string(), segment.ident.span)
             }
             _ => return None,
diff --git a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
index 6063512e294..7e15e42e3cc 100644
--- a/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
+++ b/src/test/ui/type-alias/issue-62364-self-ty-arg.stderr
@@ -2,9 +2,8 @@ error[E0411]: cannot find type `Self` in this scope
   --> $DIR/issue-62364-self-ty-arg.rs:5:29
    |
 LL | type Alias<'a> = Struct<&'a Self>;
-   |      -----   -              ^^^^ `Self` is only available in impls, traits, and type definitions
-   |      |       |
-   |      |       help: you might be missing a type parameter: `, Self`
+   |      -----                  ^^^^ `Self` is only available in impls, traits, and type definitions
+   |      |
    |      `Self` not allowed in a type alias
 
 error: aborting due to previous error