Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve lifetime arguments are not allowed on error message #98268

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2195,8 +2195,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
"{kind} arguments are not allowed on {this_type}",
);
err.span_label(last_span, format!("{kind} argument{s} not allowed"));
for (_, span) in types_and_spans {
err.span_label(span, "not allowed on this");
for (what, span) in types_and_spans {
err.span_label(span, format!("not allowed on {what}"));
}
extend(&mut err);
err.emit();
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/derives/issue-97343.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on type parameter `Irrelevant`
LL | #[derive(Debug)]
| -----
| |
| not allowed on this
| not allowed on type parameter `Irrelevant`
| in this derive macro expansion
LL | pub struct Irrelevant<Irrelevant> {
| ^^^^^^^^^^ type argument not allowed
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0109.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type
LL | type X = u32<i32>;
| --- ^^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
help: primitive type `u32` doesn't have generic parameters
|
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0110.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: lifetime arguments are not allowed on this type
LL | type X = u32<'static>;
| --- ^^^^^^^ lifetime argument not allowed
| |
| not allowed on this
| not allowed on this type
|
help: primitive type `u32` doesn't have generic parameters
|
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-22706.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `marker`
LL | fn is_copy<T: ::std::marker<i32>::Copy>() {}
| ------ ^^^ type argument not allowed
| |
| not allowed on this
| not allowed on module `marker`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-57924.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on self constructor
LL | Self::<E>(e)
| ---- ^ type argument not allowed
| |
| not allowed on this
| not allowed on self constructor

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-60989.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ error[E0109]: type arguments are not allowed on local variable
LL | c1::<()>;
| -- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on local variable

error[E0109]: type arguments are not allowed on local variable
--> $DIR/issue-60989.rs:16:10
|
LL | c1::<dyn Into<B>>;
| -- ^^^^^^^^^^^ type argument not allowed
| |
| not allowed on this
| not allowed on local variable

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/mod-subitem-as-enum-variant.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on module `Mod`
LL | Mod::<i32>::FakeVariant(0);
| --- ^^^ type argument not allowed
| |
| not allowed on this
| not allowed on module `Mod`

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/structs/struct-path-associated-type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0109]: type arguments are not allowed on this type
LL | let z = T::A::<u8> {};
| - ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0071]: expected struct, variant or union type, found associated type
--> $DIR/struct-path-associated-type.rs:14:13
Expand All @@ -30,7 +30,7 @@ error[E0109]: type arguments are not allowed on this type
LL | let z = T::A::<u8> {};
| - ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0223]: ambiguous associated type
--> $DIR/struct-path-associated-type.rs:32:13
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/structs/struct-path-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ error[E0109]: type arguments are not allowed on self type
LL | let z = Self::<u8> {};
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
help: the `Self` type doesn't accept type parameters
|
Expand All @@ -36,7 +36,7 @@ error[E0109]: type arguments are not allowed on self type
LL | let z = Self::<u8> {};
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `S`
--> $DIR/struct-path-self.rs:1:8
Expand All @@ -58,7 +58,7 @@ error[E0109]: type arguments are not allowed on self type
LL | let z = Self::<u8> {};
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `S`
--> $DIR/struct-path-self.rs:1:8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on self type
--> $DIR/enum-variant-generic-args.rs:17:16
|
LL | Self::<()>::TSVariant(());
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand Down Expand Up @@ -71,7 +71,7 @@ error[E0109]: type arguments are not allowed on self type
LL | Self::<()>::TSVariant::<()>(());
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand All @@ -92,7 +92,7 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::<()>::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0308]: mismatched types
--> $DIR/enum-variant-generic-args.rs:26:29
Expand All @@ -112,7 +112,7 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand All @@ -139,7 +139,7 @@ error[E0109]: type arguments are not allowed on self type
LL | Self::<()>::SVariant { v: () };
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand Down Expand Up @@ -172,7 +172,7 @@ error[E0109]: type arguments are not allowed on self type
LL | Self::<()>::SVariant::<()> { v: () };
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand All @@ -193,7 +193,7 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::<()>::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand All @@ -220,15 +220,15 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on self type
--> $DIR/enum-variant-generic-args.rs:43:16
|
LL | Self::<()>::UVariant;
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand All @@ -249,7 +249,7 @@ error[E0109]: type arguments are not allowed on self type
LL | Self::<()>::UVariant::<()>;
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on self type
|
note: `Self` is of type `Enum<T>`
--> $DIR/enum-variant-generic-args.rs:7:6
Expand All @@ -270,39 +270,39 @@ error[E0109]: type arguments are not allowed on this type
LL | Self::<()>::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:54:29
|
LL | Enum::<()>::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:57:24
|
LL | Alias::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:59:30
|
LL | Alias::<()>::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:62:29
|
LL | AliasFixed::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/enum-variant-generic-args.rs:64:5
Expand Down Expand Up @@ -338,15 +338,15 @@ error[E0109]: type arguments are not allowed on this type
LL | AliasFixed::<()>::TSVariant::<()>(());
| --------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:72:28
|
LL | Enum::<()>::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters

Expand All @@ -356,7 +356,7 @@ error[E0109]: type arguments are not allowed on this type
LL | Alias::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand All @@ -371,7 +371,7 @@ error[E0109]: type arguments are not allowed on this type
LL | Alias::<()>::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand All @@ -386,7 +386,7 @@ error[E0109]: type arguments are not allowed on this type
LL | AliasFixed::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand Down Expand Up @@ -429,7 +429,7 @@ error[E0109]: type arguments are not allowed on this type
LL | AliasFixed::<()>::SVariant::<()> { v: () };
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
= note: enum variants can't have type parameters
help: you might have meant to specity type parameters on enum `Enum`
Expand All @@ -444,31 +444,31 @@ error[E0109]: type arguments are not allowed on this type
LL | Enum::<()>::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:93:23
|
LL | Alias::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:95:29
|
LL | Alias::<()>::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0109]: type arguments are not allowed on this type
--> $DIR/enum-variant-generic-args.rs:98:28
|
LL | AliasFixed::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error[E0107]: this type alias takes 0 generic arguments but 1 generic argument was supplied
--> $DIR/enum-variant-generic-args.rs:100:5
Expand Down Expand Up @@ -504,7 +504,7 @@ error[E0109]: type arguments are not allowed on this type
LL | AliasFixed::<()>::UVariant::<()>;
| -------- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error: aborting due to 39 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0109]: type arguments are not allowed on this type
LL | let _ = Alias::None::<u8>;
| ---- ^^ type argument not allowed
| |
| not allowed on this
| not allowed on this type

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/type/issue-91268.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ error[E0109]: type arguments are not allowed on this type
LL | 0: u8(ţ
| -- ^ type argument not allowed
| |
| not allowed on this
| not allowed on this type
|
help: primitive type `u8` doesn't have generic parameters
|
Expand Down
Loading