Skip to content

Commit 14a031f

Browse files
committed
rewrite issue64319 and rename
1 parent ddba1dc commit 14a031f

File tree

5 files changed

+51
-40
lines changed

5 files changed

+51
-40
lines changed

src/tools/run-make-support/src/rustc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ impl Rustc {
6464
self
6565
}
6666

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+
6773
/// Specify type(s) of output files to generate.
6874
pub fn emit(&mut self, kinds: &str) -> &mut Self {
6975
self.cmd.arg(format!("--emit={kinds}"));

tests/run-make/issue64319/Makefile

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

0 commit comments

Comments
 (0)