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>(
104
104
kind : hir:: ImplItemKind :: Fn ( header, ..) , ..
105
105
} ) => Some ( header) ,
106
106
Node :: TraitItem ( hir:: TraitItem {
107
- kind : hir:: TraitItemKind :: Fn ( header, .. ) , ..
107
+ kind : hir:: TraitItemKind :: Fn ( header, ..) ,
108
+ ..
108
109
} ) => Some ( header) ,
109
110
// Closures are RustCall, but they tuple their arguments, so shouldn't be checked
110
111
Node :: Expr ( hir:: Expr { kind : hir:: ExprKind :: Closure ( ..) , .. } ) => None ,
Original file line number Diff line number Diff line change 3
3
extern "rust-call" fn b ( _i : i32 ) { }
4
4
//~^ ERROR A function with the "rust-call" ABI must take a single non-self argument that is a tuple
5
5
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
+
6
26
fn main ( ) {
7
27
b ( 10 ) ;
28
+
29
+ Foo :: bar ( ) ;
30
+
31
+ <Foo as Tr >:: a ( ) ;
32
+ <Foo as Tr >:: b ( ) ;
8
33
}
You can’t perform that action at this time.
0 commit comments