File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
compiler/rustc_typeck/src/check Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ pub(super) fn check_fn<'a, 'tcx>(
104104 kind : hir:: ImplItemKind :: Fn ( header, ..) , ..
105105 } ) => Some ( header) ,
106106 Node :: TraitItem ( hir:: TraitItem {
107- kind : hir:: TraitItemKind :: Fn ( header, .. ) , ..
107+ kind : hir:: TraitItemKind :: Fn ( header, ..) ,
108+ ..
108109 } ) => Some ( header) ,
109110 // Closures are RustCall, but they tuple their arguments, so shouldn't be checked
110111 Node :: Expr ( hir:: Expr { kind : hir:: ExprKind :: Closure ( ..) , .. } ) => None ,
Original file line number Diff line number Diff line change 33extern "rust-call" fn b ( _i : i32 ) { }
44//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument that is a tuple
55
6+ trait Tr {
7+ extern "rust-call" fn a ( ) ;
8+ //~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
9+
10+ extern "rust-call" fn b ( ) { }
11+ //~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
12+ }
13+
14+ struct Foo ;
15+
16+ impl Foo {
17+ extern "rust-call" fn bar ( ) { }
18+ //~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
19+ }
20+
21+ impl Tr for Foo {
22+ fn a ( ) { }
23+ //~^ ERROR A function with the "rust-call" ABI must take a single non-self argument
24+ }
25+
626fn main ( ) {
727 b ( 10 ) ;
28+
29+ Foo :: bar ( ) ;
30+
31+ <Foo as Tr >:: a ( ) ;
32+ <Foo as Tr >:: b ( ) ;
833}
You can’t perform that action at this time.
0 commit comments