diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/generics/generic-no-mangle.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/generics/generic-no-mangle.rs')
-rw-r--r-- | src/test/ui/generics/generic-no-mangle.rs | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/src/test/ui/generics/generic-no-mangle.rs b/src/test/ui/generics/generic-no-mangle.rs deleted file mode 100644 index 74e407078..000000000 --- a/src/test/ui/generics/generic-no-mangle.rs +++ /dev/null @@ -1,159 +0,0 @@ -// run-rustfix - -#![deny(no_mangle_generic_items)] - -#[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 } - -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 -} - -pub struct Bar<T>(#[allow(unused_tuple_struct_fields)] T); - -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 -} - -impl Bar<i32> { - #[no_mangle] - pub fn qux() {} -} - -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 -} - -pub struct Baz<'a>(#[allow(unused_tuple_struct_fields)] &'a i32); - -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; -} - -impl Trait4 for Bar<i32> { - #[no_mangle] - fn foo() {} - - #[no_mangle] - fn bar<'b>(x: &'b i32) -> &i32 { x } -} - -impl<'a> Trait4 for Baz<'a> { - #[no_mangle] - fn foo() {} - - #[no_mangle] - fn bar<'b>(x: &'b i32) -> &i32 { x } -} - -trait Trait5<T> { - fn foo(); -} - -impl Trait5<i32> for Foo { - #[no_mangle] - fn foo() {} -} - -impl Trait5<i32> for Bar<i32> { - #[no_mangle] - fn foo() {} -} - -fn main() {} |