Skip to content

Commit

Permalink
Add a note about feature(explicit_generic_args_with_impl_trait) to th…
Browse files Browse the repository at this point in the history
…e relevant error message
  • Loading branch information
meithecatte committed Nov 8, 2021
1 parent 3e3890c commit 048e1c9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions compiler/rustc_typeck/src/astconv/generics.rs
Expand Up @@ -672,6 +672,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
err.span_label(span, "explicit generic argument not allowed");
}

err.note(
"see issue #83701 <https://github.com/rust-lang/rust/issues/83701> \
for more information",
);
if tcx.sess.is_nightly_build() {
err.help(
"add `#![feature(explicit_generic_args_with_impl_trait)]` \
to the crate attributes to enable",
);
}

err.emit();
}

Expand Down
Expand Up @@ -3,6 +3,9 @@ error[E0632]: cannot provide explicit generic arguments when `impl Trait` is use
|
LL | assert_eq!(f::<4usize>(Usizable), 20usize);
| ^^^^^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
Expand Up @@ -3,6 +3,9 @@ error[E0632]: cannot provide explicit generic arguments when `impl Trait` is use
|
LL | foo::<str>("".to_string());
| ^^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/impl-trait/issues/universal-issue-48703.stderr
Expand Up @@ -3,6 +3,9 @@ error[E0632]: cannot provide explicit generic arguments when `impl Trait` is use
|
LL | foo::<String>('a');
| ^^^^^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
Expand Up @@ -5,6 +5,9 @@ LL | evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
| ^^^^^^^^^ ^^^^^^^^^^^^^ explicit generic argument not allowed
| |
| explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error: aborting due to previous error

Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/synthetic-param.stderr
Expand Up @@ -3,18 +3,27 @@ error[E0632]: cannot provide explicit generic arguments when `impl Trait` is use
|
LL | func::<u8>(42);
| ^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/synthetic-param.rs:23:17
|
LL | Foo::func::<u8>(42);
| ^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/synthetic-param.rs:26:23
|
LL | Bar::<i8>::func::<u8>(42);
| ^^ explicit generic argument not allowed
|
= note: see issue #83701 <https://github.com/rust-lang/rust/issues/83701> for more information
= help: add `#![feature(explicit_generic_args_with_impl_trait)]` to the crate attributes to enable

error: aborting due to 3 previous errors

Expand Down

0 comments on commit 048e1c9

Please sign in to comment.