Skip to content

Commit 16fc6a6

Browse files
committed
Remove unused abi attributes.
They've been replaced by putting the name on the extern block. #[abi = "foo"] goes to extern "foo" { } Closes #9483.
1 parent 5b10781 commit 16fc6a6

34 files changed

+56
-129
lines changed

doc/tutorial-ffi.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,21 +415,18 @@ fn main() {
415415

416416
Most foreign code exposes a C ABI, and Rust uses the platform's C calling convention by default when
417417
calling foreign functions. Some foreign functions, most notably the Windows API, use other calling
418-
conventions. Rust provides the `abi` attribute as a way to hint to the compiler which calling
419-
convention to use:
418+
conventions. Rust provides a way to tell the compiler which convention to use:
420419

421420
~~~~
422421
#[cfg(target_os = "win32")]
423-
#[abi = "stdcall"]
424422
#[link_name = "kernel32"]
425-
extern {
423+
extern "stdcall" {
426424
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> int;
427425
}
428426
~~~~
429427

430-
The `abi` attribute applies to a foreign module (it cannot be applied to a single function within a
431-
module), and must be either `"cdecl"` or `"stdcall"`. The compiler may eventually support other
432-
calling conventions.
428+
This applies to the entire `extern` block, and must be either `"cdecl"` or
429+
`"stdcall"`. The compiler may eventually support other calling conventions.
433430

434431
# Interoperability with foreign code
435432

src/libextra/time.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ static NSEC_PER_SEC: i32 = 1_000_000_000_i32;
1919
pub mod rustrt {
2020
use super::Tm;
2121

22-
#[abi = "cdecl"]
23-
extern {
22+
extern "cdecl" {
2423
pub fn get_time(sec: &mut i64, nsec: &mut i32);
2524
pub fn precise_time_ns(ns: &mut u64);
2625
pub fn rust_tzset();

src/libextra/unicode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ pub mod icu {
162162

163163
// #[link_name = "icuuc"]
164164
#[link_args = "-licuuc"]
165-
#[abi = "cdecl"]
166-
extern {
165+
extern "cdecl" {
167166
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
168167
pub fn u_isdigit(c: UChar32) -> UBool;
169168
pub fn u_islower(c: UChar32) -> UBool;

src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ pub mod llvm {
300300

301301
#[link_args = "-Lrustllvm -lrustllvm"]
302302
#[link_name = "rustllvm"]
303-
#[abi = "cdecl"]
304-
extern {
303+
extern "cdecl" {
305304
/* Create and destroy contexts. */
306305
pub fn LLVMContextCreate() -> ContextRef;
307306
pub fn LLVMContextDispose(C: ContextRef);

src/libstd/io.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ pub type fd_t = c_int;
7676
pub mod rustrt {
7777
use libc;
7878

79-
#[abi = "cdecl"]
8079
#[link_name = "rustrt"]
81-
extern {
80+
extern "cdecl" {
8281
pub fn rust_get_stdin() -> *libc::FILE;
8382
pub fn rust_get_stdout() -> *libc::FILE;
8483
pub fn rust_get_stderr() -> *libc::FILE;

0 commit comments

Comments
 (0)