Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abi field to Method #81502

Merged
merged 2 commits into from
Feb 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
1 change: 1 addition & 0 deletions src/rustdoc-json-types/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ pub struct Method {
pub decl: FnDecl,
pub generics: Generics,
pub header: String,
pub abi: String,
pub has_body: bool,
}

Expand Down
25 changes: 25 additions & 0 deletions src/test/rustdoc-json/method_abi.rs
Original file line number Diff line number Diff line change
@@ -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();
}