diff options
| author | Oliver Middleton <olliemail27@gmail.com> | 2016-04-22 11:48:46 +0100 |
|---|---|---|
| committer | Oliver Middleton <olliemail27@gmail.com> | 2016-04-22 11:51:25 +0100 |
| commit | 2b1e35ec129b53bc440b59ede8bfaccb88a3cbf4 (patch) | |
| tree | 53affdf3d5596d72cb9a57b4b4b4a591810cbba2 /src/test/rustdoc | |
| parent | 887e9471783ff3f5edc920a85b6110486dc063c0 (diff) | |
| download | rust-2b1e35ec129b53bc440b59ede8bfaccb88a3cbf4.tar.gz rust-2b1e35ec129b53bc440b59ede8bfaccb88a3cbf4.zip | |
rustdoc: Cleanup ABI rendering
Use a common method for rendering `extern "<abi>"`. This now consistently shows `extern "C" fn` rather than just `extern fn`.
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/extern-impl.rs | 37 | ||||
| -rw-r--r-- | src/test/rustdoc/ffi.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-22038.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc/variadic.rs | 2 |
4 files changed, 42 insertions, 5 deletions
diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs new file mode 100644 index 00000000000..5c64b4118c3 --- /dev/null +++ b/src/test/rustdoc/extern-impl.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +// @has foo/struct.Foo.html +pub struct Foo; + +impl Foo { + // @has - '//code' 'fn rust0()' + pub fn rust0() {} + // @has - '//code' 'fn rust1()' + pub extern "Rust" fn rust1() {} + // @has - '//code' 'extern "C" fn c0()' + pub extern fn c0() {} + // @has - '//code' 'extern "C" fn c1()' + pub extern "C" fn c1() {} + // @has - '//code' 'extern "system" fn system0()' + pub extern "system" fn system0() {} +} + +// @has foo/trait.Bar.html +pub trait Bar {} + +// @has - '//code' 'impl Bar for fn()' +impl Bar for fn() {} +// @has - '//code' 'impl Bar for extern "C" 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 3997dcd81e1..8511d461703 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 fn foreigner(cold_as_ice: u32)' +// @has ffi/fn.foreigner.html //pre 'pub unsafe extern "C" fn foreigner(cold_as_ice: u32)' pub use lib::foreigner; extern "C" { - // @has ffi/fn.another.html //pre 'pub unsafe extern fn another(cold_as_ice: u32)' + // @has ffi/fn.another.html //pre 'pub unsafe extern "C" 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 6f84428b079..75df5358945 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 fn foo1()' + // '//*[@class="rust fn"]' 'pub unsafe extern "C" fn foo1()' pub fn foo1(); } @@ -21,7 +21,7 @@ extern "system" { } // @has issue_22038/fn.bar.html \ -// '//*[@class="rust fn"]' 'pub extern fn bar()' +// '//*[@class="rust fn"]' 'pub extern "C" 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 1b60c2a334f..6ba776ba467 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 fn foo(x: i32, ...)' + // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, ...)' pub fn foo(x: i32, ...); } |
