From 48aabbd9e3a451439070325c56fd84def324bdbd Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Wed, 27 Apr 2016 18:43:51 +0100 Subject: [PATCH] rustdoc: Render `extern fn` instead of `extern "C" fn` --- src/librustdoc/html/format.rs | 1 + src/test/rustdoc/extern-impl.rs | 6 +++--- src/test/rustdoc/ffi.rs | 4 ++-- src/test/rustdoc/issue-22038.rs | 4 ++-- src/test/rustdoc/variadic.rs | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 72414ad4c5e..a64df41f286 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -766,6 +766,7 @@ impl fmt::Display for AbiSpace { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.0 { Abi::Rust => Ok(()), + Abi::C => write!(f, "extern "), abi => write!(f, "extern "{}" ", abi.name()), } } diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs index 5c64b4118c3..0e78746704f 100644 --- a/src/test/rustdoc/extern-impl.rs +++ b/src/test/rustdoc/extern-impl.rs @@ -18,9 +18,9 @@ impl Foo { pub fn rust0() {} // @has - '//code' 'fn rust1()' pub extern "Rust" fn rust1() {} - // @has - '//code' 'extern "C" fn c0()' + // @has - '//code' 'extern fn c0()' pub extern fn c0() {} - // @has - '//code' 'extern "C" fn c1()' + // @has - '//code' 'extern fn c1()' pub extern "C" fn c1() {} // @has - '//code' 'extern "system" fn system0()' pub extern "system" fn system0() {} @@ -31,7 +31,7 @@ pub trait Bar {} // @has - '//code' 'impl Bar for fn()' impl Bar for fn() {} -// @has - '//code' 'impl Bar for extern "C" fn()' +// @has - '//code' 'impl Bar for extern fn()' impl Bar for extern fn() {} // @has - '//code' 'impl Bar for extern "system" fn()' impl Bar for extern "system" fn() {} diff --git a/src/test/rustdoc/ffi.rs b/src/test/rustdoc/ffi.rs index 8511d461703..3997dcd81e1 100644 --- a/src/test/rustdoc/ffi.rs +++ b/src/test/rustdoc/ffi.rs @@ -13,10 +13,10 @@ extern crate rustdoc_ffi as lib; -// @has ffi/fn.foreigner.html //pre 'pub unsafe extern "C" fn foreigner(cold_as_ice: u32)' +// @has ffi/fn.foreigner.html //pre 'pub unsafe extern fn foreigner(cold_as_ice: u32)' pub use lib::foreigner; extern "C" { - // @has ffi/fn.another.html //pre 'pub unsafe extern "C" fn another(cold_as_ice: u32)' + // @has ffi/fn.another.html //pre 'pub unsafe extern fn another(cold_as_ice: u32)' pub fn another(cold_as_ice: u32); } diff --git a/src/test/rustdoc/issue-22038.rs b/src/test/rustdoc/issue-22038.rs index 75df5358945..6f84428b079 100644 --- a/src/test/rustdoc/issue-22038.rs +++ b/src/test/rustdoc/issue-22038.rs @@ -10,7 +10,7 @@ extern { // @has issue_22038/fn.foo1.html \ - // '//*[@class="rust fn"]' 'pub unsafe extern "C" fn foo1()' + // '//*[@class="rust fn"]' 'pub unsafe extern fn foo1()' pub fn foo1(); } @@ -21,7 +21,7 @@ } // @has issue_22038/fn.bar.html \ -// '//*[@class="rust fn"]' 'pub extern "C" fn bar()' +// '//*[@class="rust fn"]' 'pub extern fn bar()' pub extern fn bar() {} // @has issue_22038/fn.baz.html \ diff --git a/src/test/rustdoc/variadic.rs b/src/test/rustdoc/variadic.rs index 6ba776ba467..1b60c2a334f 100644 --- a/src/test/rustdoc/variadic.rs +++ b/src/test/rustdoc/variadic.rs @@ -9,6 +9,6 @@ // except according to those terms. extern "C" { - // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, ...)' + // @has variadic/fn.foo.html //pre 'pub unsafe extern fn foo(x: i32, ...)' pub fn foo(x: i32, ...); } -- 2.44.0