2020-07-02 05:32:12 +00:00
|
|
|
// run-rustfix
|
|
|
|
|
2015-12-08 16:48:40 +00:00
|
|
|
#![deny(no_mangle_generic_items)]
|
2014-08-02 04:22:02 +00:00
|
|
|
|
|
|
|
#[no_mangle]
|
2019-02-15 22:26:36 +00:00
|
|
|
pub fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
2014-08-02 04:22:02 +00:00
|
|
|
|
|
|
|
#[no_mangle]
|
2020-09-01 21:28:11 +00:00
|
|
|
pub extern "C" fn bar<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
2017-05-28 14:12:19 +00:00
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn baz(x: &i32) -> &i32 { x }
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn qux<'a>(x: &'a i32) -> &i32 { x }
|
2015-12-08 16:48:40 +00:00
|
|
|
|
2021-08-07 18:10:57 +00:00
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub extern "C" fn bar<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn baz(x: &i32) -> &i32 { x }
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn qux<'a>(x: &'a i32) -> &i32 { x }
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait1 {
|
|
|
|
fn foo<T>();
|
|
|
|
extern "C" fn bar<T>();
|
|
|
|
fn baz(x: &i32) -> &i32;
|
|
|
|
fn qux<'a>(x: &'a i32) -> &i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait1 for Foo {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
extern "C" fn bar<T>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn baz(x: &i32) -> &i32 { x }
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn qux<'a>(x: &'a i32) -> &i32 { x }
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait2<T> {
|
|
|
|
fn foo();
|
|
|
|
fn foo2<U>();
|
|
|
|
extern "C" fn bar();
|
|
|
|
fn baz(x: &i32) -> &i32;
|
|
|
|
fn qux<'a>(x: &'a i32) -> &i32;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> Trait2<T> for Foo {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo2<U>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
extern "C" fn bar() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn baz(x: &i32) -> &i32 { x } //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn qux<'a>(x: &'a i32) -> &i32 { x } //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
}
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
pub struct Bar<T>(#[allow(dead_code)] T);
|
2021-08-07 18:10:57 +00:00
|
|
|
|
|
|
|
impl<T> Bar<T> {
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn foo() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub extern "C" fn bar() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn baz<U>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
}
|
|
|
|
|
2021-08-12 16:11:44 +00:00
|
|
|
impl Bar<i32> {
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn qux() {}
|
|
|
|
}
|
|
|
|
|
2021-08-07 18:10:57 +00:00
|
|
|
trait Trait3 {
|
|
|
|
fn foo();
|
|
|
|
extern "C" fn bar();
|
|
|
|
fn baz<U>();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T> Trait3 for Bar<T> {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
extern "C" fn bar() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn baz<U>() {} //~ ERROR functions generic over types or consts must be mangled
|
|
|
|
}
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
pub struct Baz<'a>(#[allow(dead_code)] &'a i32);
|
2021-08-07 18:10:57 +00:00
|
|
|
|
|
|
|
impl<'a> Baz<'a> {
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn foo() {}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn bar<'b>(x: &'b i32) -> &i32 { x }
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Trait4 {
|
|
|
|
fn foo();
|
|
|
|
fn bar<'a>(x: &'a i32) -> &i32;
|
|
|
|
}
|
|
|
|
|
2021-08-12 16:11:44 +00:00
|
|
|
impl Trait4 for Bar<i32> {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn bar<'b>(x: &'b i32) -> &i32 { x }
|
|
|
|
}
|
|
|
|
|
2021-08-07 18:10:57 +00:00
|
|
|
impl<'a> Trait4 for Baz<'a> {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {}
|
|
|
|
|
|
|
|
#[no_mangle]
|
|
|
|
fn bar<'b>(x: &'b i32) -> &i32 { x }
|
|
|
|
}
|
|
|
|
|
2021-08-12 16:11:44 +00:00
|
|
|
trait Trait5<T> {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait5<i32> for Foo {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Trait5<i32> for Bar<i32> {
|
|
|
|
#[no_mangle]
|
|
|
|
fn foo() {}
|
|
|
|
}
|
|
|
|
|
2015-12-08 16:48:40 +00:00
|
|
|
fn main() {}
|