diff options
| author | bors <bors@rust-lang.org> | 2021-01-13 13:56:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-13 13:56:15 +0000 |
| commit | fd2df74902fa98bcb71f85fd548c3eb399e6a96a (patch) | |
| tree | d88a7bde6091f82bd2ae5d492c66088ef705600d /src/test/incremental | |
| parent | 116d1a7056830ccf649f74f823de4333ed329392 (diff) | |
| parent | 4614671cae99ff35e61708ab64e9ba7850711750 (diff) | |
| download | rust-fd2df74902fa98bcb71f85fd548c3eb399e6a96a.tar.gz rust-fd2df74902fa98bcb71f85fd548c3eb399e6a96a.zip | |
Auto merge of #76219 - Mark-Simulacrum:extern-require-abi, r=estebank
Add allow-by-default lint on implicit ABI in extern function pointers and items This adds a new lint, missing_abi, which lints on omitted ABIs on extern blocks, function declarations, and function pointers. It is currently not emitting the best possible diagnostics -- we need to track the span of "extern" at least or do some heuristic searching based on the available spans -- but seems good enough for an initial pass than can be expanded in future PRs. This is a pretty large PR, but mostly due to updating a large number of tests to include ABIs; I can split that into a separate PR if it would be helpful, but test updates are already in dedicated commits.
Diffstat (limited to 'src/test/incremental')
| -rw-r--r-- | src/test/incremental/foreign.rs | 8 | ||||
| -rw-r--r-- | src/test/incremental/hashes/inherent_impls.rs | 2 | ||||
| -rw-r--r-- | src/test/incremental/hashes/trait_defs.rs | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/test/incremental/foreign.rs b/src/test/incremental/foreign.rs index 498bf892250..f46f92eb500 100644 --- a/src/test/incremental/foreign.rs +++ b/src/test/incremental/foreign.rs @@ -13,7 +13,7 @@ use std::ffi::CString; mod mlibc { use libc::{c_char, c_long, c_longlong}; - extern { + extern "C" { pub fn atol(x: *const c_char) -> c_long; pub fn atoll(x: *const c_char) -> c_longlong; } @@ -31,6 +31,8 @@ fn atoll(s: String) -> i64 { pub fn main() { assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string())); - assert_eq!((atoll("11111111111111111".to_string()) * 10), - atoll("111111111111111110".to_string())); + assert_eq!( + (atoll("11111111111111111".to_string()) * 10), + atoll("111111111111111110".to_string()) + ); } diff --git a/src/test/incremental/hashes/inherent_impls.rs b/src/test/incremental/hashes/inherent_impls.rs index fcd12ad30eb..2e98abae58b 100644 --- a/src/test/incremental/hashes/inherent_impls.rs +++ b/src/test/incremental/hashes/inherent_impls.rs @@ -271,7 +271,7 @@ impl Foo { impl Foo { #[rustc_clean(cfg="cfail2", except="hir_owner,hir_owner_nodes,fn_sig,typeck")] #[rustc_clean(cfg="cfail3")] - pub extern fn make_method_extern(&self) { } + pub extern "C" fn make_method_extern(&self) { } } diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index aa39ea88e0e..4dab032e47f 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -312,7 +312,7 @@ trait TraitAddExternModifier { trait TraitAddExternModifier { #[rustc_dirty(label="hir_owner", cfg="cfail2")] #[rustc_clean(label="hir_owner", cfg="cfail3")] - extern fn method(); + extern "C" fn method(); } |
