Skip to content

Commit 4d2e0fd

Browse files
committed
Auto merge of #92465 - matthiaskrgr:rollup-yuary84, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #90383 (Extend check for UnsafeCell in consts to cover unions) - #91375 (config.rs: Add support for a per-target default_linker option.) - #91480 (rustdoc: use smaller number of colors to distinguish items) - #92338 (Add try_reserve and try_reserve_exact for OsString) - #92405 (Add a couple needs-asm-support headers to tests) - #92435 (Sync rustc_codegen_cranelift) - #92440 (Fix mobile toggles position) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents cfa3fe5 + 2da54c7 commit 4d2e0fd

File tree

45 files changed

+450
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+450
-158
lines changed

compiler/rustc_codegen_cranelift/.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ on:
55
- pull_request
66

77
jobs:
8+
rustfmt:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Install rustfmt
16+
run: |
17+
rustup component add rustfmt
18+
19+
- name: Rustfmt
20+
run: |
21+
cargo fmt --check
22+
823
build:
924
runs-on: ${{ matrix.os }}
1025
timeout-minutes: 60

compiler/rustc_codegen_cranelift/.github/workflows/nightly-cranelift.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test nightly Cranelift
33
on:
44
push:
55
schedule:
6-
- cron: '1 17 * * *' # At 01:17 UTC every day.
6+
- cron: '17 1 * * *' # At 01:17 UTC every day.
77

88
jobs:
99
build:

compiler/rustc_codegen_cranelift/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ perf.data.old
77
*.events
88
*.string*
99
/y.bin
10+
/y.bin.dSYM
1011
/build
1112
/build_sysroot/sysroot_src
1213
/build_sysroot/compiler-builtins

compiler/rustc_codegen_cranelift/Cargo.toml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,12 @@ unstable-features = ["jit", "inline_asm"]
4040
jit = ["cranelift-jit", "libloading"]
4141
inline_asm = []
4242

43-
[profile.dev]
44-
# By compiling dependencies with optimizations, performing tests gets much faster.
45-
opt-level = 3
46-
47-
[profile.dev.package.rustc_codegen_cranelift]
48-
# Disabling optimizations for cg_clif itself makes compilation after a change faster.
49-
opt-level = 0
50-
51-
[profile.release.package.rustc_codegen_cranelift]
52-
incremental = true
53-
5443
# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the
5544
# execution time of build scripts is so fast that optimizing them slows down the total build time.
56-
[profile.dev.build-override]
57-
opt-level = 0
58-
debug = false
59-
6045
[profile.release.build-override]
6146
opt-level = 0
6247
debug = false
6348

64-
[profile.dev.package.cranelift-codegen-meta]
65-
opt-level = 0
66-
debug = false
67-
6849
[profile.release.package.cranelift-codegen-meta]
6950
opt-level = 0
7051
debug = false

compiler/rustc_codegen_cranelift/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
3737
In the directory with your project (where you can do the usual `cargo build`), run:
3838

3939
```bash
40-
$ $cg_clif_dir/build/cargo build
40+
$ $cg_clif_dir/build/cargo-clif build
4141
```
4242

4343
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.

compiler/rustc_codegen_cranelift/build_system/build_backend.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ pub(crate) fn build_backend(
1010
let mut cmd = Command::new("cargo");
1111
cmd.arg("build").arg("--target").arg(host_triple);
1212

13+
cmd.env("CARGO_BUILD_INCREMENTAL", "true"); // Force incr comp even in release mode
14+
15+
let mut rustflags = env::var("RUSTFLAGS").unwrap_or_default();
16+
17+
if env::var("CI").as_ref().map(|val| &**val) == Ok("true") {
18+
// Deny warnings on CI
19+
rustflags += " -Dwarnings";
20+
21+
// Disabling incr comp reduces cache size and incr comp doesn't save as much on CI anyway
22+
cmd.env("CARGO_BUILD_INCREMENTAL", "false");
23+
}
24+
1325
if use_unstable_features {
1426
cmd.arg("--features").arg("unstable-features");
1527
}
@@ -22,25 +34,20 @@ pub(crate) fn build_backend(
2234
_ => unreachable!(),
2335
}
2436

37+
// Set the rpath to make the cg_clif executable find librustc_codegen_cranelift without changing
38+
// LD_LIBRARY_PATH
2539
if cfg!(unix) {
2640
if cfg!(target_os = "macos") {
27-
cmd.env(
28-
"RUSTFLAGS",
29-
"-Csplit-debuginfo=unpacked \
41+
rustflags += " -Csplit-debuginfo=unpacked \
3042
-Clink-arg=-Wl,-rpath,@loader_path/../lib \
31-
-Zosx-rpath-install-name"
32-
.to_string()
33-
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
34-
);
43+
-Zosx-rpath-install-name";
3544
} else {
36-
cmd.env(
37-
"RUSTFLAGS",
38-
"-Clink-arg=-Wl,-rpath=$ORIGIN/../lib ".to_string()
39-
+ env::var("RUSTFLAGS").as_deref().unwrap_or(""),
40-
);
45+
rustflags += " -Clink-arg=-Wl,-rpath=$ORIGIN/../lib ";
4146
}
4247
}
4348

49+
cmd.env("RUSTFLAGS", rustflags);
50+
4451
eprintln!("[BUILD] rustc_codegen_cranelift");
4552
crate::utils::spawn_and_wait(cmd);
4653

compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ pub(crate) fn build_sysroot(
4646
// Build and copy cargo wrapper
4747
let mut build_cargo_wrapper_cmd = Command::new("rustc");
4848
build_cargo_wrapper_cmd
49-
.arg("scripts/cargo.rs")
49+
.arg("scripts/cargo-clif.rs")
5050
.arg("-o")
51-
.arg(target_dir.join("cargo"))
51+
.arg(target_dir.join("cargo-clif"))
5252
.arg("-g");
5353
spawn_and_wait(build_cargo_wrapper_cmd);
5454

compiler/rustc_codegen_cranelift/docs/usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Assuming `$cg_clif_dir` is the directory you cloned this repo into and you follo
99
In the directory with your project (where you can do the usual `cargo build`), run:
1010

1111
```bash
12-
$ $cg_clif_dir/build/cargo build
12+
$ $cg_clif_dir/build/cargo-clif build
1313
```
1414

1515
This will build your project with rustc_codegen_cranelift instead of the usual LLVM backend.
@@ -32,7 +32,7 @@ In jit mode cg_clif will immediately execute your code without creating an execu
3232
> The jit mode will probably need cargo integration to make this possible.
3333
3434
```bash
35-
$ $cg_clif_dir/build/cargo jit
35+
$ $cg_clif_dir/build/cargo-clif jit
3636
```
3737

3838
or
@@ -45,7 +45,7 @@ There is also an experimental lazy jit mode. In this mode functions are only com
4545
first called.
4646

4747
```bash
48-
$ $cg_clif_dir/build/cargo lazy-jit
48+
$ $cg_clif_dir/build/cargo-clif lazy-jit
4949
```
5050

5151
## Shell

compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ fn call_return_u128_pair() {
129129
return_u128_pair();
130130
}
131131

132+
#[allow(unreachable_code)] // FIXME false positive
132133
fn main() {
133134
take_unique(Unique {
134135
pointer: 0 as *const (),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-12-20"
2+
channel = "nightly-2021-12-30"
33
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]

0 commit comments

Comments
 (0)