diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 0cfdde26c2b8f..fd0544a47bb7c 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -613,7 +613,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { param_counts.consts + named_type_param_count - default_counts.types - default_counts.consts - - synth_type_param_count }; debug!("expected_min: {:?}", expected_min); debug!("arg_counts.lifetimes: {:?}", gen_args.num_lifetime_params()); diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index 739e55e294381..3add0429d2d58 100644 --- a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -1,12 +1,12 @@ -error[E0107]: this function takes at most 1 generic argument but 2 generic arguments were supplied +error[E0107]: this function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/explicit-generic-args-for-impl.rs:6:5 | LL | foo::("".to_string()); | ^^^ ------ help: remove this generic argument | | - | expected at most 1 generic argument + | expected 1 generic argument | -note: function defined here, with at most 1 generic parameter: `T` +note: function defined here, with 1 generic parameter: `T` --> $DIR/explicit-generic-args-for-impl.rs:3:4 | LL | fn foo(_f: impl AsRef) {} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs new file mode 100644 index 0000000000000..e2ee63821ae74 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/issue-87718.rs @@ -0,0 +1,9 @@ +// check-pass + +#![feature(explicit_generic_args_with_impl_trait)] + +fn f(_: impl AsRef, _: impl AsRef) {} + +fn main() { + f::<[u8]>("a", b"a"); +} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs new file mode 100644 index 0000000000000..ffb0582fe8df4 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.rs @@ -0,0 +1,8 @@ +#![feature(explicit_generic_args_with_impl_trait)] + +fn f(_: impl AsRef, _: impl AsRef) {} + +fn main() { + f::<[u8]>("a", b"a"); + //~^ ERROR: this function takes 2 generic arguments but 1 generic argument was supplied +} diff --git a/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr new file mode 100644 index 0000000000000..233b47445db02 --- /dev/null +++ b/src/test/ui/impl-trait/explicit-generic-args-with-impl-trait/not-enough-args.stderr @@ -0,0 +1,21 @@ +error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/not-enough-args.rs:6:5 + | +LL | f::<[u8]>("a", b"a"); + | ^ ---- supplied 1 generic argument + | | + | expected 2 generic arguments + | +note: function defined here, with 2 generic parameters: `T`, `U` + --> $DIR/not-enough-args.rs:3:4 + | +LL | fn f(_: impl AsRef, _: impl AsRef) {} + | ^ - - +help: add missing generic argument + | +LL | f::<[u8], U>("a", b"a"); + | ^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`.