| author | bors <bors@rust-lang.org> 2024-05-18 00:04:01 UTC |
| committer | bors <bors@rust-lang.org> 2024-05-18 00:04:01 UTC |
| log | 8e78d168040b2d7106a28712c39106602c7a1d61 |
| tree | 8a56a0c45a66c31147dae36eb3647eb40b940981 |
| parent | 9b75a4388143a163b77fa7d458e4aa4dd34ac1bd |
| parent | 650bbb5a776a48344c1fb894420dc5494ea603c6 |
Rollup of 3 pull requests
Successful merges:
- #125213 (Migrate `run-make/static-unwinding` to `rmake`)
- #125215 (Migrate `run-make/issue64319` to `rmake` and rename)
- #125221 (Migrate `run-make/issue-28766` to `rmake`)
r? `@ghost`
`@rustbot` modify labels: rollup16 files changed, 108 insertions(+), 85 deletions(-)
src/tools/run-make-support/src/rustc.rs+6| ... | ... | @@ -64,6 +64,12 @@ impl Rustc { |
| 64 | 64 | self |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | /// Specify a specific optimization level. | |
| 68 | pub fn opt_level(&mut self, option: &str) -> &mut Self { | |
| 69 | self.cmd.arg(format!("-Copt-level={option}")); | |
| 70 | self | |
| 71 | } | |
| 72 | ||
| 67 | 73 | /// Specify type(s) of output files to generate. |
| 68 | 74 | pub fn emit(&mut self, kinds: &str) -> &mut Self { |
| 69 | 75 | self.cmd.arg(format!("--emit={kinds}")); |
src/tools/tidy/src/allowed_run_make_makefiles.txt-3| ... | ... | @@ -103,7 +103,6 @@ run-make/issue-25581/Makefile |
| 103 | 103 | run-make/issue-26006/Makefile |
| 104 | 104 | run-make/issue-26092/Makefile |
| 105 | 105 | run-make/issue-28595/Makefile |
| 106 | run-make/issue-28766/Makefile | |
| 107 | 106 | run-make/issue-30063/Makefile |
| 108 | 107 | run-make/issue-33329/Makefile |
| 109 | 108 | run-make/issue-35164/Makefile |
| ... | ... | @@ -128,7 +127,6 @@ run-make/issue-85401-static-mir/Makefile |
| 128 | 127 | run-make/issue-85441/Makefile |
| 129 | 128 | run-make/issue-88756-default-output/Makefile |
| 130 | 129 | run-make/issue-97463-abi-param-passing/Makefile |
| 131 | run-make/issue64319/Makefile | |
| 132 | 130 | run-make/jobserver-error/Makefile |
| 133 | 131 | run-make/libs-through-symlinks/Makefile |
| 134 | 132 | run-make/libtest-json/Makefile |
| ... | ... | @@ -263,7 +261,6 @@ run-make/stable-symbol-names/Makefile |
| 263 | 261 | run-make/static-dylib-by-default/Makefile |
| 264 | 262 | run-make/static-extern-type/Makefile |
| 265 | 263 | run-make/static-pie/Makefile |
| 266 | run-make/static-unwinding/Makefile | |
| 267 | 264 | run-make/staticlib-blank-lib/Makefile |
| 268 | 265 | run-make/staticlib-dylib-linkage/Makefile |
| 269 | 266 | run-make/std-core-cycle/Makefile |
tests/run-make/box-struct-no-segfault/foo.rs created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | #![crate_type="lib"] | |
| 2 | pub struct Foo(()); | |
| 3 | ||
| 4 | impl Foo { | |
| 5 | pub fn new() -> Foo { | |
| 6 | Foo(()) | |
| 7 | } | |
| 8 | } |
tests/run-make/box-struct-no-segfault/main.rs created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | #![crate_type="lib"] | |
| 2 | extern crate foo; | |
| 3 | use foo::Foo; | |
| 4 | ||
| 5 | pub fn crash() -> Box<Foo> { | |
| 6 | Box::new(Foo::new()) | |
| 7 | } |
tests/run-make/box-struct-no-segfault/rmake.rs created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | // The crate "foo" tied to this test executes a very specific function, | |
| 2 | // which involves boxing an instance of the struct Foo. However, | |
| 3 | // this once caused a segmentation fault in cargo release builds due to an LLVM | |
| 4 | // incorrect assertion. | |
| 5 | // This test checks that this bug does not resurface. | |
| 6 | // See https://github.com/rust-lang/rust/issues/28766 | |
| 7 | ||
| 8 | use run_make_support::{rustc, tmp_dir}; | |
| 9 | ||
| 10 | fn main() { | |
| 11 | rustc().opt().input("foo.rs").run(); | |
| 12 | rustc().opt().library_search_path(tmp_dir()).input("main.rs").run(); | |
| 13 | } |
tests/run-make/issue-28766/Makefile deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | include ../tools.mk | |
| 2 | ||
| 3 | all: | |
| 4 | 	$(RUSTC) -O foo.rs | |
| 5 | 	$(RUSTC) -O -L $(TMPDIR) main.rs |
tests/run-make/issue-28766/foo.rs deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | #![crate_type="lib"] | |
| 2 | pub struct Foo(()); | |
| 3 | ||
| 4 | impl Foo { | |
| 5 | pub fn new() -> Foo { | |
| 6 | Foo(()) | |
| 7 | } | |
| 8 | } |
tests/run-make/issue-28766/main.rs deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | #![crate_type="lib"] | |
| 2 | extern crate foo; | |
| 3 | use foo::Foo; | |
| 4 | ||
| 5 | pub fn crash() -> Box<Foo> { | |
| 6 | Box::new(Foo::new()) | |
| 7 | } |
tests/run-make/issue64319/Makefile deleted-40| ... | ... | @@ -1,40 +0,0 @@ |
| 1 | # ignore-cross-compile | |
| 2 | include ../tools.mk | |
| 3 | ||
| 4 | # Different optimization levels imply different values for `-Zshare-generics`, | |
| 5 | # so try out a whole bunch of combinations to make sure everything is compatible | |
| 6 | all: | |
| 7 | 	# First up, try some defaults | |
| 8 | 	$(RUSTC) --crate-type rlib foo.rs | |
| 9 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 | |
| 10 | ||
| 11 | 	# Next try mixing up some things explicitly | |
| 12 | 	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no | |
| 13 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | |
| 14 | 	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=no | |
| 15 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | |
| 16 | 	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes | |
| 17 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | |
| 18 | 	$(RUSTC) --crate-type rlib foo.rs -Z share-generics=yes | |
| 19 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | |
| 20 | ||
| 21 | 	# Now combine a whole bunch of options together | |
| 22 | 	$(RUSTC) --crate-type rlib foo.rs | |
| 23 | 	$(RUSTC) --crate-type dylib bar.rs | |
| 24 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=no | |
| 25 | 	$(RUSTC) --crate-type dylib bar.rs -Z share-generics=yes | |
| 26 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 | |
| 27 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=no | |
| 28 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=1 -Z share-generics=yes | |
| 29 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 | |
| 30 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=no | |
| 31 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=2 -Z share-generics=yes | |
| 32 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 | |
| 33 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=no | |
| 34 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=3 -Z share-generics=yes | |
| 35 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s | |
| 36 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=no | |
| 37 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=s -Z share-generics=yes | |
| 38 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z | |
| 39 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=no | |
| 40 | 	$(RUSTC) --crate-type dylib bar.rs -C opt-level=z -Z share-generics=yes |
tests/run-make/issue64319/bar.rs deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | extern crate foo; | |
| 2 | ||
| 3 | pub fn bar() { | |
| 4 | foo::foo(); | |
| 5 | } |
tests/run-make/issue64319/foo.rs deleted-9| ... | ... | @@ -1,9 +0,0 @@ |
| 1 | pub fn foo() { | |
| 2 | bar::<usize>(); | |
| 3 | } | |
| 4 | ||
| 5 | pub fn bar<T>() { | |
| 6 | baz(); | |
| 7 | } | |
| 8 | ||
| 9 | fn baz() {} |
tests/run-make/share-generics-export-again/bar.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | extern crate foo; | |
| 2 | ||
| 3 | pub fn bar() { | |
| 4 | foo::foo(); | |
| 5 | } |
tests/run-make/share-generics-export-again/foo.rs created+9| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | pub fn foo() { | |
| 2 | bar::<usize>(); | |
| 3 | } | |
| 4 | ||
| 5 | pub fn bar<T>() { | |
| 6 | baz(); | |
| 7 | } | |
| 8 | ||
| 9 | fn baz() {} |
tests/run-make/share-generics-export-again/rmake.rs created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | // When crates had different optimization levels, a bug caused | |
| 2 | // incorrect symbol name generations. -Z share-generics could | |
| 3 | // also fail to re-export upstream generics on multiple compile | |
| 4 | // runs of the same dynamic library. | |
| 5 | ||
| 6 | // This test repeatedly compiles an rlib and a dylib with these flags | |
| 7 | // to check if this bug ever returns. | |
| 8 | ||
| 9 | // See https://github.com/rust-lang/rust/pull/68277 | |
| 10 | // See https://github.com/rust-lang/rust/issues/64319 | |
| 11 | //@ ignore-cross-compile | |
| 12 | ||
| 13 | use run_make_support::rustc; | |
| 14 | ||
| 15 | fn main() { | |
| 16 | rustc().crate_type("rlib").input("foo.rs").run(); | |
| 17 | rustc().crate_type("dylib").input("bar.rs").opt_level("3").run(); | |
| 18 | rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run(); | |
| 19 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run(); | |
| 20 | rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=no").run(); | |
| 21 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run(); | |
| 22 | rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run(); | |
| 23 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run(); | |
| 24 | rustc().crate_type("rlib").input("foo.rs").arg("-Zshare-generics=yes").run(); | |
| 25 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run(); | |
| 26 | rustc().crate_type("rlib").input("foo.rs").run(); | |
| 27 | rustc().crate_type("dylib").input("bar.rs").run(); | |
| 28 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=no").run(); | |
| 29 | rustc().crate_type("dylib").input("bar.rs").arg("-Zshare-generics=yes").run(); | |
| 30 | rustc().crate_type("dylib").input("bar.rs").opt_level("1").run(); | |
| 31 | rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=no").run(); | |
| 32 | rustc().crate_type("dylib").input("bar.rs").opt_level("1").arg("-Zshare-generics=yes").run(); | |
| 33 | rustc().crate_type("dylib").input("bar.rs").opt_level("2").run(); | |
| 34 | rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=no").run(); | |
| 35 | rustc().crate_type("dylib").input("bar.rs").opt_level("2").arg("-Zshare-generics=yes").run(); | |
| 36 | rustc().crate_type("dylib").input("bar.rs").opt_level("3").run(); | |
| 37 | rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=no").run(); | |
| 38 | rustc().crate_type("dylib").input("bar.rs").opt_level("3").arg("-Zshare-generics=yes").run(); | |
| 39 | rustc().crate_type("dylib").input("bar.rs").opt_level("s").run(); | |
| 40 | rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=no").run(); | |
| 41 | rustc().crate_type("dylib").input("bar.rs").opt_level("s").arg("-Zshare-generics=yes").run(); | |
| 42 | rustc().crate_type("dylib").input("bar.rs").opt_level("z").run(); | |
| 43 | rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=no").run(); | |
| 44 | rustc().crate_type("dylib").input("bar.rs").opt_level("z").arg("-Zshare-generics=yes").run(); | |
| 45 | } |
tests/run-make/static-unwinding/Makefile deleted-8| ... | ... | @@ -1,8 +0,0 @@ |
| 1 | # ignore-cross-compile | |
| 2 | # needs-unwind | |
| 3 | include ../tools.mk | |
| 4 | ||
| 5 | all: | |
| 6 | 	$(RUSTC) lib.rs | |
| 7 | 	$(RUSTC) main.rs | |
| 8 | 	$(call RUN,main) |
tests/run-make/static-unwinding/rmake.rs created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | // During unwinding, an implementation of Drop is possible to clean up resources. | |
| 2 | // This test implements drop in both a main function and its static library. | |
| 3 | // If the test succeeds, a Rust program being a static library does not affect Drop implementations. | |
| 4 | // See https://github.com/rust-lang/rust/issues/10434 | |
| 5 | ||
| 6 | //@ ignore-cross-compile | |
| 7 | //@ needs-unwind | |
| 8 | ||
| 9 | use run_make_support::{run, rustc}; | |
| 10 | ||
| 11 | fn main() { | |
| 12 | rustc().input("lib.rs").run(); | |
| 13 | rustc().input("main.rs").run(); | |
| 14 | run("main"); | |
| 15 | } |