Add abi field to `Method`

This commit is contained in:
Rune Tynan 2021-01-29 01:07:50 -05:00
parent 16b805713c
commit 30ecde0beb
No known key found for this signature in database
GPG Key ID: 7ECC932F8B2C731E
3 changed files with 28 additions and 0 deletions

View File

@ -434,12 +434,14 @@ impl From<clean::Impl> for Impl {
}
}
<<<<<<< HEAD
crate fn from_function_method(function: clean::Function, has_body: bool) -> Method {
let clean::Function { header, decl, generics, all_types: _, ret_types: _ } = function;
Method {
decl: decl.into(),
generics: generics.into(),
header: stringify_header(&header),
abi: header.abi.to_string(),
has_body,
}
}

View File

@ -294,6 +294,7 @@ pub struct Method {
pub decl: FnDecl,
pub generics: Generics,
pub header: String,
pub abi: String,
pub has_body: bool,
}

View File

@ -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();
}