Skip to content

Commit

Permalink
rustdoc: Render extern fn instead of extern "C" fn
Browse files Browse the repository at this point in the history
  • Loading branch information
ollie27 committed Apr 27, 2016
1 parent 2b1e35e commit 48aabbd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/rustdoc/extern-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand All @@ -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() {}
4 changes: 2 additions & 2 deletions src/test/rustdoc/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions src/test/rustdoc/issue-22038.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -21,7 +21,7 @@ extern "system" {
}

// @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 \
Expand Down
2 changes: 1 addition & 1 deletion src/test/rustdoc/variadic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...);
}

0 comments on commit 48aabbd

Please sign in to comment.