Skip to content

Commit 30ecde0

Browse files
committed
Add abi field to Method
1 parent 16b8057 commit 30ecde0

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/librustdoc/json/conversions.rs

+2
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,14 @@ impl From<clean::Impl> for Impl {
434434
}
435435
}
436436

437+
<<<<<<< HEAD
437438
crate fn from_function_method(function: clean::Function, has_body: bool) -> Method {
438439
let clean::Function { header, decl, generics, all_types: _, ret_types: _ } = function;
439440
Method {
440441
decl: decl.into(),
441442
generics: generics.into(),
442443
header: stringify_header(&header),
444+
abi: header.abi.to_string(),
443445
has_body,
444446
}
445447
}

src/rustdoc-json-types/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ pub struct Method {
294294
pub decl: FnDecl,
295295
pub generics: Generics,
296296
pub header: String,
297+
pub abi: String,
297298
pub has_body: bool,
298299
}
299300

src/test/rustdoc-json/method_abi.rs

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// @has method_abi.json "$.index[*][?(@.name=='Foo')]"
2+
pub struct Foo;
3+
4+
impl Foo {
5+
// @has - "$.index[*][?(@.name=='abi_rust')].inner.abi" '"\"Rust\""'
6+
pub fn abi_rust() {}
7+
8+
// @has - "$.index[*][?(@.name=='abi_c')].inner.abi" '"\"C\""'
9+
pub extern "C" fn abi_c() {}
10+
11+
// @has - "$.index[*][?(@.name=='abi_system')].inner.abi" '"\"system\""'
12+
pub extern "system" fn abi_system() {}
13+
}
14+
15+
// @has method_abi.json "$.index[*][?(@.name=='Bar')]"
16+
pub trait Bar {
17+
// @has - "$.index[*][?(@.name=='trait_abi_rust')].inner.abi" '"\"Rust\""'
18+
fn trait_abi_rust();
19+
20+
// @has - "$.index[*][?(@.name=='trait_abi_c')].inner.abi" '"\"C\""'
21+
extern "C" fn trait_abi_c();
22+
23+
// @has - "$.index[*][?(@.name=='trait_abi_system')].inner.abi" '"\"system\""'
24+
extern "system" fn trait_abi_system();
25+
}

0 commit comments

Comments
 (0)