Add associated functions that have custom linkage to reachable_set
This commit is contained in:
parent
eb2226b1f1
commit
c84beefd83
3 changed files with 53 additions and 13 deletions
10
src/test/ui/auxiliary/no-mangle-associated-fn.rs
Normal file
10
src/test/ui/auxiliary/no-mangle-associated-fn.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#![crate_type = "lib"]
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl Bar {
|
||||
#[no_mangle]
|
||||
fn bar() -> u8 {
|
||||
2
|
||||
}
|
||||
}
|
||||
22
src/test/ui/no-mangle-associated-fn.rs
Normal file
22
src/test/ui/no-mangle-associated-fn.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// aux-build: no-mangle-associated-fn.rs
|
||||
// run-pass
|
||||
|
||||
extern crate no_mangle_associated_fn;
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
#[no_mangle]
|
||||
fn foo() -> u8 {
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
extern "Rust" {
|
||||
fn foo() -> u8;
|
||||
fn bar() -> u8;
|
||||
}
|
||||
assert_eq!(unsafe { foo() }, 1);
|
||||
assert_eq!(unsafe { bar() }, 2);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue