diff options
| author | bors <bors@rust-lang.org> | 2021-02-07 10:59:41 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-02-07 10:59:41 +0000 | 
| commit | ae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5 (patch) | |
| tree | ffbfb1a2f1519c9e1a9eab943889f1fa294f3d0d /src | |
| parent | 43e1ea29c4e92dfa2ba716fc878984605897fb13 (diff) | |
| parent | ac75fafd1c254dd96a22a289fcad18287875f061 (diff) | |
| download | rust-ae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5.tar.gz rust-ae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5.zip  | |
Auto merge of #81502 - CraftSpider:method-abi, r=jyn514
Add abi field to `Method` Also bumps version and adds a test (Will conflict with #81500, whichever is merged first) Rationale: It's possible for methods to have an ABI. This should be exposed in the JSON.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 1 | ||||
| -rw-r--r-- | src/rustdoc-json-types/lib.rs | 1 | ||||
| -rw-r--r-- | src/test/rustdoc-json/method_abi.rs | 25 | 
3 files changed, 27 insertions, 0 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 9107ba59bd0..e021faa5041 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -440,6 +440,7 @@ crate fn from_function_method(function: clean::Function, has_body: bool) -> Meth decl: decl.into(), generics: generics.into(), header: stringify_header(&header), + abi: header.abi.to_string(), has_body, } } diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 083f99e4a68..f4b8dc9a3ad 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -294,6 +294,7 @@ pub struct Method { pub decl: FnDecl, pub generics: Generics, pub header: String, + pub abi: String, pub has_body: bool, } diff --git a/src/test/rustdoc-json/method_abi.rs b/src/test/rustdoc-json/method_abi.rs new file mode 100644 index 00000000000..6fabbc83611 --- /dev/null +++ b/src/test/rustdoc-json/method_abi.rs @@ -0,0 +1,25 @@ +// @has method_abi.json "$.index[*][?(@.name=='Foo')]" +pub struct Foo; + +impl Foo { + // @has - "$.index[*][?(@.name=='abi_rust')].inner.abi" '"\"Rust\""' + pub fn abi_rust() {} + + // @has - "$.index[*][?(@.name=='abi_c')].inner.abi" '"\"C\""' + pub extern "C" fn abi_c() {} + + // @has - "$.index[*][?(@.name=='abi_system')].inner.abi" '"\"system\""' + pub extern "system" fn abi_system() {} +} + +// @has method_abi.json "$.index[*][?(@.name=='Bar')]" +pub trait Bar { + // @has - "$.index[*][?(@.name=='trait_abi_rust')].inner.abi" '"\"Rust\""' + fn trait_abi_rust(); + + // @has - "$.index[*][?(@.name=='trait_abi_c')].inner.abi" '"\"C\""' + extern "C" fn trait_abi_c(); + + // @has - "$.index[*][?(@.name=='trait_abi_system')].inner.abi" '"\"system\""' + extern "system" fn trait_abi_system(); +}  | 
