Add associated functions that have custom linkage to reachable_set

This commit is contained in:
hyd-dev 2021-06-20 21:49:08 +08:00
parent eb2226b1f1
commit c84beefd83
No known key found for this signature in database
GPG key ID: 74FA7FD5B8DA14B8
3 changed files with 53 additions and 13 deletions

View file

@ -0,0 +1,10 @@
#![crate_type = "lib"]
struct Bar;
impl Bar {
#[no_mangle]
fn bar() -> u8 {
2
}
}

View 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);
}