File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
26
26
use rustc_span:: source_map:: Span ;
27
27
use rustc_span:: sym;
28
28
use rustc_span:: symbol:: Symbol ;
29
+ use rustc_target:: spec:: abi:: Abi ;
29
30
use rustc_trait_selection:: infer:: InferCtxtExt as _;
30
31
use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt as _;
31
32
use std:: { fmt, iter} ;
@@ -162,6 +163,11 @@ impl<'tcx> LateLintPass<'tcx> for Ptr {
162
163
return ;
163
164
}
164
165
166
+ if !matches ! ( sig. header. abi, Abi :: Rust ) {
167
+ // Ignore `extern` functions with non-Rust calling conventions
168
+ return ;
169
+ }
170
+
165
171
check_mut_from_ref ( cx, sig, None ) ;
166
172
for arg in check_fn_args (
167
173
cx,
@@ -217,6 +223,11 @@ impl<'tcx> LateLintPass<'tcx> for Ptr {
217
223
_ => return ,
218
224
} ;
219
225
226
+ if !matches ! ( sig. header. abi, Abi :: Rust ) {
227
+ // Ignore `extern` functions with non-Rust calling conventions
228
+ return ;
229
+ }
230
+
220
231
check_mut_from_ref ( cx, sig, Some ( body) ) ;
221
232
let decl = sig. decl ;
222
233
let sig = cx. tcx . fn_sig ( item_id) . subst_identity ( ) . skip_binder ( ) ;
Original file line number Diff line number Diff line change @@ -267,3 +267,16 @@ mod issue_9218 {
267
267
todo ! ( )
268
268
}
269
269
}
270
+
271
+ mod issue_11181 {
272
+ extern "C" fn allowed ( _v : & Vec < u32 > ) { }
273
+
274
+ struct S ;
275
+ impl S {
276
+ extern "C" fn allowed ( _v : & Vec < u32 > ) { }
277
+ }
278
+
279
+ trait T {
280
+ extern "C" fn allowed ( _v : & Vec < u32 > ) { }
281
+ }
282
+ }
You can’t perform that action at this time.
0 commit comments