diff options
| author | Oneirical <manchot@videotron.ca> | 2024-05-17 14:41:54 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2024-05-17 14:44:21 -0400 |
| commit | e9edced09694cbc27844acb44fa357ba94823fda (patch) | |
| tree | 3ced3e2eb04858c3e7db24106f2dbc1ec867991f /tests/run-make/box-struct-no-segfault | |
| parent | ddba1dc97e83f22165b36dd6158477c49bbbd019 (diff) | |
| download | rust-e9edced09694cbc27844acb44fa357ba94823fda.tar.gz rust-e9edced09694cbc27844acb44fa357ba94823fda.zip | |
rewrite and rename issue-28766
Diffstat (limited to 'tests/run-make/box-struct-no-segfault')
| -rw-r--r-- | tests/run-make/box-struct-no-segfault/foo.rs | 8 | ||||
| -rw-r--r-- | tests/run-make/box-struct-no-segfault/main.rs | 7 | ||||
| -rw-r--r-- | tests/run-make/box-struct-no-segfault/rmake.rs | 13 |
3 files changed, 28 insertions, 0 deletions
diff --git a/tests/run-make/box-struct-no-segfault/foo.rs b/tests/run-make/box-struct-no-segfault/foo.rs new file mode 100644 index 00000000000..1dcabe42dc1 --- /dev/null +++ b/tests/run-make/box-struct-no-segfault/foo.rs @@ -0,0 +1,8 @@ +#![crate_type="lib"] +pub struct Foo(()); + +impl Foo { + pub fn new() -> Foo { + Foo(()) + } +} diff --git a/tests/run-make/box-struct-no-segfault/main.rs b/tests/run-make/box-struct-no-segfault/main.rs new file mode 100644 index 00000000000..de12b1fd9dc --- /dev/null +++ b/tests/run-make/box-struct-no-segfault/main.rs @@ -0,0 +1,7 @@ +#![crate_type="lib"] +extern crate foo; +use foo::Foo; + +pub fn crash() -> Box<Foo> { + Box::new(Foo::new()) +} diff --git a/tests/run-make/box-struct-no-segfault/rmake.rs b/tests/run-make/box-struct-no-segfault/rmake.rs new file mode 100644 index 00000000000..5406f765e6c --- /dev/null +++ b/tests/run-make/box-struct-no-segfault/rmake.rs @@ -0,0 +1,13 @@ +// The crate "foo" tied to this test executes a very specific function, +// which involves boxing an instance of the struct Foo. However, +// this once caused a segmentation fault in cargo release builds due to an LLVM +// incorrect assertion. +// This test checks that this bug does not resurface. +// See https://github.com/rust-lang/rust/issues/28766 + +use run_make_support::{rustc, tmp_dir}; + +fn main() { + rustc().opt().input("foo.rs").run(); + rustc().opt().library_search_path(tmp_dir()).input("main.rs").run(); +} |
