Don't suggest adding Self as a type parameter

This commit is contained in:
Michael Goulet 2022-06-19 19:25:50 -07:00
parent 018c319b21
commit 047de83e02
2 changed files with 3 additions and 4 deletions

View file

@ -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,

View file

@ -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