Add more complete tests of possible rust-call cases
This commit is contained in:
parent
7cece8eca3
commit
35e86c2ab5
2 changed files with 27 additions and 1 deletions
|
@ -104,7 +104,8 @@ pub(super) fn check_fn<'a, 'tcx>(
|
||||||
kind: hir::ImplItemKind::Fn(header, ..), ..
|
kind: hir::ImplItemKind::Fn(header, ..), ..
|
||||||
}) => Some(header),
|
}) => Some(header),
|
||||||
Node::TraitItem(hir::TraitItem {
|
Node::TraitItem(hir::TraitItem {
|
||||||
kind: hir::TraitItemKind::Fn(header, .. ), ..
|
kind: hir::TraitItemKind::Fn(header, ..),
|
||||||
|
..
|
||||||
}) => Some(header),
|
}) => Some(header),
|
||||||
// Closures are RustCall, but they tuple their arguments, so shouldn't be checked
|
// Closures are RustCall, but they tuple their arguments, so shouldn't be checked
|
||||||
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => None,
|
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(..), .. }) => None,
|
||||||
|
|
|
@ -3,6 +3,31 @@
|
||||||
extern "rust-call" fn b(_i: i32) {}
|
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
|
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument that is a tuple
|
||||||
|
|
||||||
|
trait Tr {
|
||||||
|
extern "rust-call" fn a();
|
||||||
|
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
|
||||||
|
|
||||||
|
extern "rust-call" fn b() {}
|
||||||
|
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo;
|
||||||
|
|
||||||
|
impl Foo {
|
||||||
|
extern "rust-call" fn bar() {}
|
||||||
|
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Tr for Foo {
|
||||||
|
fn a() {}
|
||||||
|
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
|
||||||
|
}
|
||||||
|
|
||||||
fn main () {
|
fn main () {
|
||||||
b(10);
|
b(10);
|
||||||
|
|
||||||
|
Foo::bar();
|
||||||
|
|
||||||
|
<Foo as Tr>::a();
|
||||||
|
<Foo as Tr>::b();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue