Skip to content

Commit 047de83

Browse files
Don't suggest adding Self as a type parameter
1 parent 018c319 commit 047de83

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

compiler/rustc_resolve/src/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
18071807
path: &[Segment],
18081808
) -> Option<(Span, &'static str, String, Applicability)> {
18091809
let (ident, span) = match path {
1810-
[segment] if !segment.has_generic_args => {
1810+
[segment] if !segment.has_generic_args && segment.ident.name != kw::SelfUpper => {
18111811
(segment.ident.to_string(), segment.ident.span)
18121812
}
18131813
_ => return None,

src/test/ui/type-alias/issue-62364-self-ty-arg.stderr

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ error[E0411]: cannot find type `Self` in this scope
22
--> $DIR/issue-62364-self-ty-arg.rs:5:29
33
|
44
LL | type Alias<'a> = Struct<&'a Self>;
5-
| ----- - ^^^^ `Self` is only available in impls, traits, and type definitions
6-
| | |
7-
| | help: you might be missing a type parameter: `, Self`
5+
| ----- ^^^^ `Self` is only available in impls, traits, and type definitions
6+
| |
87
| `Self` not allowed in a type alias
98

109
error: aborting due to previous error

0 commit comments

Comments
 (0)