Add a sane error for rust-call functions not taking tuples during type checking, and associated UI tests

This commit is contained in:
Rune Tynan 2020-11-11 18:15:39 -05:00
parent 9d78d1d027
commit 91eabf59d5
No known key found for this signature in database
GPG key ID: 7ECC932F8B2C731E
5 changed files with 62 additions and 7 deletions

View file

@ -0,0 +1,8 @@
#![feature(unboxed_closures)]
extern "rust-call" fn b(_i: i32) {}
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument that is a tuple
fn main () {
b(10);
}

View file

@ -0,0 +1,8 @@
error: A function with the "rust-call" ABI must take a single non-self argument that is a tuple
--> $DIR/issue-22565-rust-call.rs:3:1
|
LL | extern "rust-call" fn b(_i: i32) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -0,0 +1,9 @@
// check-pass
#![feature(unboxed_closures)]
extern "rust-call" fn foo<T>(_: T) {}
fn main() {
foo(());
foo((1, 2));
}

View file

@ -26,7 +26,7 @@ LL | extern "vectorcall" fn f3() {}
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:18:8
|
LL | extern "rust-call" fn f4() {}
LL | extern "rust-call" fn f4(_: ()) {}
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
@ -113,7 +113,7 @@ LL | extern "vectorcall" fn m3();
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:33:12
|
LL | extern "rust-call" fn m4();
LL | extern "rust-call" fn m4(_: ());
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
@ -183,7 +183,7 @@ LL | extern "vectorcall" fn dm3() {}
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:42:12
|
LL | extern "rust-call" fn dm4() {}
LL | extern "rust-call" fn dm4(_: ()) {}
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
@ -270,7 +270,7 @@ LL | extern "vectorcall" fn m3() {}
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:60:12
|
LL | extern "rust-call" fn m4() {}
LL | extern "rust-call" fn m4(_: ()) {}
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
@ -357,7 +357,7 @@ LL | extern "vectorcall" fn im3() {}
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:76:12
|
LL | extern "rust-call" fn im4() {}
LL | extern "rust-call" fn im4(_: ()) {}
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
@ -444,7 +444,7 @@ LL | type A3 = extern "vectorcall" fn();
error[E0658]: rust-call ABI is subject to change
--> $DIR/feature-gate-abi.rs:89:18
|
LL | type A4 = extern "rust-call" fn();
LL | type A4 = extern "rust-call" fn(_: ());
| ^^^^^^^^^^^
|
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information