diff options
| author | Rob Pilling <robpilling@gmail.com> | 2022-01-16 21:47:44 +0000 |
|---|---|---|
| committer | Rob Pilling <robpilling@gmail.com> | 2022-01-25 22:51:19 +0000 |
| commit | a129a85144efb67bfd8f380a758ed6be41d3e29b (patch) | |
| tree | 1ab44d42eb2166fd4adef0aba45cf85b3e6a8eea /src/test | |
| parent | 54d2d30662c2832554bb127f017f7a311bb62b4e (diff) | |
| download | rust-a129a85144efb67bfd8f380a758ed6be41d3e29b.tar.gz rust-a129a85144efb67bfd8f380a758ed6be41d3e29b.zip | |
Handle generics with ParamEnv
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/suggestions/args-instead-of-tuple.fixed | 9 | ||||
| -rw-r--r-- | src/test/ui/suggestions/args-instead-of-tuple.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/suggestions/args-instead-of-tuple.stderr | 36 |
3 files changed, 52 insertions, 2 deletions
diff --git a/src/test/ui/suggestions/args-instead-of-tuple.fixed b/src/test/ui/suggestions/args-instead-of-tuple.fixed index 095be95f185..c9b8a41d469 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.fixed +++ b/src/test/ui/suggestions/args-instead-of-tuple.fixed @@ -12,7 +12,16 @@ fn main() { //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied two_ints((1, 2)); //~ ERROR this function takes 1 argument + + with_generic((3, 4)); //~ ERROR this function takes 1 argument } fn two_ints(_: (i32, i32)) { } + +fn with_generic<T: Copy + Send>((a, b): (i32, T)) { + if false { + // test generics/bound handling + with_generic((a, b)); //~ ERROR this function takes 1 argument + } +} diff --git a/src/test/ui/suggestions/args-instead-of-tuple.rs b/src/test/ui/suggestions/args-instead-of-tuple.rs index 3466a46df84..d4cc3024dd0 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.rs +++ b/src/test/ui/suggestions/args-instead-of-tuple.rs @@ -12,7 +12,16 @@ fn main() { //~^ ERROR this enum variant takes 1 argument but 0 arguments were supplied two_ints(1, 2); //~ ERROR this function takes 1 argument + + with_generic(3, 4); //~ ERROR this function takes 1 argument } fn two_ints(_: (i32, i32)) { } + +fn with_generic<T: Copy + Send>((a, b): (i32, T)) { + if false { + // test generics/bound handling + with_generic(a, b); //~ ERROR this function takes 1 argument + } +} diff --git a/src/test/ui/suggestions/args-instead-of-tuple.stderr b/src/test/ui/suggestions/args-instead-of-tuple.stderr index 1bf7e7a8d17..172db7ee3df 100644 --- a/src/test/ui/suggestions/args-instead-of-tuple.stderr +++ b/src/test/ui/suggestions/args-instead-of-tuple.stderr @@ -38,7 +38,7 @@ LL | two_ints(1, 2); | ^^^^^^^^ - - supplied 2 arguments | note: function defined here - --> $DIR/args-instead-of-tuple.rs:17:4 + --> $DIR/args-instead-of-tuple.rs:19:4 | LL | fn two_ints(_: (i32, i32)) { | ^^^^^^^^ ------------- @@ -47,6 +47,38 @@ help: use parentheses to construct a tuple LL | two_ints((1, 2)); | + + -error: aborting due to 4 previous errors +error[E0061]: this function takes 1 argument but 2 arguments were supplied + --> $DIR/args-instead-of-tuple.rs:16:5 + | +LL | with_generic(3, 4); + | ^^^^^^^^^^^^ - - supplied 2 arguments + | +note: function defined here + --> $DIR/args-instead-of-tuple.rs:22:4 + | +LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { + | ^^^^^^^^^^^^ ---------------- +help: use parentheses to construct a tuple + | +LL | with_generic((3, 4)); + | + + + +error[E0061]: this function takes 1 argument but 2 arguments were supplied + --> $DIR/args-instead-of-tuple.rs:25:9 + | +LL | with_generic(a, b); + | ^^^^^^^^^^^^ - - supplied 2 arguments + | +note: function defined here + --> $DIR/args-instead-of-tuple.rs:22:4 + | +LL | fn with_generic<T: Copy + Send>((a, b): (i32, T)) { + | ^^^^^^^^^^^^ ---------------- +help: use parentheses to construct a tuple + | +LL | with_generic((a, b)); + | + + + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0061`. |
