Skip to content

Commit

Permalink
Rollup merge of rust-lang#65614 - varkor:apit-explicit-generics, r=ma…
Browse files Browse the repository at this point in the history
…tthewjasper

Improve error message for APIT with explicit generic arguments

This is disallowed with type or const generics. cc rust-lang#61410.
  • Loading branch information
Centril authored Oct 20, 2019
2 parents c9c32a7 + 2f7c9a2 commit 4de42a7
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
tcx.sess,
span,
E0632,
"cannot provide explicit type parameters when `impl Trait` is \
used in argument position."
"cannot provide explicit generic arguments when `impl Trait` is \
used in argument position"
};

err.emit();
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5048,8 +5048,8 @@ the future, [RFC 2091] prohibits their implementation without a follow-up RFC.
// E0612, // merged into E0609
// E0613, // Removed (merged with E0609)
E0627, // yield statement outside of generator literal
E0632, // cannot provide explicit type parameters when `impl Trait` is used
// in argument position.
E0632, // cannot provide explicit generic arguments when `impl Trait` is
// used in argument position
E0634, // type has conflicting packed representaton hints
E0640, // infer outlives requirements
E0641, // cannot cast to/from a pointer with an unknown kind
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/issues/universal-issue-48703.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ use std::fmt::Debug;
fn foo<T>(x: impl Debug) { }

fn main() {
foo::<String>('a'); //~ ERROR cannot provide explicit type parameters
foo::<String>('a'); //~ ERROR cannot provide explicit generic arguments
}
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/issues/universal-issue-48703.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/universal-issue-48703.rs:8:5
|
LL | foo::<String>('a');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ struct TestEvent(i32);
fn main() {
let mut evt = EventHandler {};
evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
//~^ ERROR cannot provide explicit type parameters
//~^ ERROR cannot provide explicit generic arguments
});
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/universal-turbofish-in-method-issue-50950.rs:14:9
|
LL | evt.handle_event::<TestEvent, fn(TestEvent)>(|_evt| {
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/synthetic-param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ impl<S> Bar<S> {
}

fn main() {
func::<u8>(42); //~ ERROR cannot provide explicit type parameters
func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
func(42); // Ok

Foo::func::<u8>(42); //~ ERROR cannot provide explicit type parameters
Foo::func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
Foo::func(42); // Ok

Bar::<i8>::func::<u8>(42); //~ ERROR cannot provide explicit type parameters
Bar::<i8>::func::<u8>(42); //~ ERROR cannot provide explicit generic arguments
Bar::<i8>::func(42); // Ok
}
6 changes: 3 additions & 3 deletions src/test/ui/synthetic-param.stderr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/synthetic-param.rs:20:5
|
LL | func::<u8>(42);
| ^^^^^^^^^^

error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/synthetic-param.rs:23:5
|
LL | Foo::func::<u8>(42);
| ^^^^^^^^^^^^^^^

error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/synthetic-param.rs:26:5
|
LL | Bar::<i8>::func::<u8>(42);
Expand Down

0 comments on commit 4de42a7

Please sign in to comment.