Add regression tests

This commit is contained in:
Giacomo Stevanato 2021-08-03 13:38:48 +02:00
parent 2fd874d0d5
commit ae313da4ba
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,9 @@
// check-pass
#![feature(explicit_generic_args_with_impl_trait)]
fn f<T: ?Sized>(_: impl AsRef<T>, _: impl AsRef<T>) {}
fn main() {
f::<[u8]>("a", b"a");
}

View File

@ -0,0 +1,8 @@
#![feature(explicit_generic_args_with_impl_trait)]
fn f<T: ?Sized, U: ?Sized>(_: impl AsRef<T>, _: impl AsRef<U>) {}
fn main() {
f::<[u8]>("a", b"a");
//~^ ERROR: this function takes 2 generic arguments but 1 generic argument was supplied
}

View File

@ -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<T: ?Sized, U: ?Sized>(_: impl AsRef<T>, _: impl AsRef<U>) {}
| ^ - -
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`.