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 /tests/ui/lto/auxiliary | |
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 'tests/ui/lto/auxiliary')
-rw-r--r-- | tests/ui/lto/auxiliary/debuginfo-lto-aux.rs | 29 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/dylib.rs | 6 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/lto-duplicate-symbols1.rs | 6 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/lto-duplicate-symbols2.rs | 6 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs | 6 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/msvc-imp-present.rs | 11 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/thin-lto-inlines-aux.rs | 7 | ||||
-rw-r--r-- | tests/ui/lto/auxiliary/thinlto-dylib.rs | 23 |
8 files changed, 94 insertions, 0 deletions
diff --git a/tests/ui/lto/auxiliary/debuginfo-lto-aux.rs b/tests/ui/lto/auxiliary/debuginfo-lto-aux.rs new file mode 100644 index 000000000..dd471154b --- /dev/null +++ b/tests/ui/lto/auxiliary/debuginfo-lto-aux.rs @@ -0,0 +1,29 @@ +// compile-flags: -g --crate-type=rlib + +pub struct StructWithLifetime<'a>(&'a i32); +pub fn mk_struct_with_lt<'a>(x: &'a i32) -> StructWithLifetime<'a> { + StructWithLifetime(x) +} + +pub struct RegularStruct(u32); +pub fn mk_regular_struct(x: u32) -> RegularStruct { + RegularStruct(x) +} + +pub fn take_fn(f: fn(i32) -> i32, x: i32) -> i32 { + f(x) +} + +pub fn with_closure(x: i32) -> i32 { + let closure = |i| { x + i }; + + closure(1) + closure(2) +} + +pub fn generic_fn<T>(x: T) -> (T, u32) { + (x, 1) +} + +pub fn user_of_generic_fn(x: f32) -> (f32, u32) { + generic_fn(x) +} diff --git a/tests/ui/lto/auxiliary/dylib.rs b/tests/ui/lto/auxiliary/dylib.rs new file mode 100644 index 000000000..e8b7f8f9f --- /dev/null +++ b/tests/ui/lto/auxiliary/dylib.rs @@ -0,0 +1,6 @@ +// compile-flags: -Z thinlto -C codegen-units=8 + +#[inline] +pub fn foo(b: u8) { + b.to_string(); +} diff --git a/tests/ui/lto/auxiliary/lto-duplicate-symbols1.rs b/tests/ui/lto/auxiliary/lto-duplicate-symbols1.rs new file mode 100644 index 000000000..ec6d05603 --- /dev/null +++ b/tests/ui/lto/auxiliary/lto-duplicate-symbols1.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/ui/lto/auxiliary/lto-duplicate-symbols2.rs b/tests/ui/lto/auxiliary/lto-duplicate-symbols2.rs new file mode 100644 index 000000000..ec6d05603 --- /dev/null +++ b/tests/ui/lto/auxiliary/lto-duplicate-symbols2.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[no_mangle] +pub extern "C" fn foo() {} diff --git a/tests/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs b/tests/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs new file mode 100644 index 000000000..d24375b2d --- /dev/null +++ b/tests/ui/lto/auxiliary/lto-rustc-loads-linker-plugin.rs @@ -0,0 +1,6 @@ +// compile-flags: -Clinker-plugin-lto +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/tests/ui/lto/auxiliary/msvc-imp-present.rs b/tests/ui/lto/auxiliary/msvc-imp-present.rs new file mode 100644 index 000000000..933af050a --- /dev/null +++ b/tests/ui/lto/auxiliary/msvc-imp-present.rs @@ -0,0 +1,11 @@ +// no-prefer-dynamic +// compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic + +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub static A: u32 = 43; + +pub mod a { + pub static A: u32 = 43; +} diff --git a/tests/ui/lto/auxiliary/thin-lto-inlines-aux.rs b/tests/ui/lto/auxiliary/thin-lto-inlines-aux.rs new file mode 100644 index 000000000..5fd3f1996 --- /dev/null +++ b/tests/ui/lto/auxiliary/thin-lto-inlines-aux.rs @@ -0,0 +1,7 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn bar() -> u32 { + 3 +} diff --git a/tests/ui/lto/auxiliary/thinlto-dylib.rs b/tests/ui/lto/auxiliary/thinlto-dylib.rs new file mode 100644 index 000000000..9d17c35da --- /dev/null +++ b/tests/ui/lto/auxiliary/thinlto-dylib.rs @@ -0,0 +1,23 @@ +// Auxiliary crate for test issue-105637: the LTOed dylib which had duplicate symbols from libstd, +// breaking the panic hook feature. +// +// This simulates the `rustc_driver` crate, and the main crate simulates rustc's main binary hooking +// into this driver. + +// compile-flags: -Zdylib-lto -C lto=thin + +use std::panic; + +pub fn main() { + // Install the hook we want to see executed + panic::set_hook(Box::new(|_| { + eprintln!("LTOed auxiliary crate panic hook"); + })); + + // Trigger the panic hook with an ICE + run_compiler(); +} + +fn run_compiler() { + panic!("ICEing"); +} |