Skip to content

Commit 5629309

Browse files
committed
Auto merge of rust-lang#78711 - m-ou-se:rollup-pxqnny7, r=m-ou-se
Rollup of 7 pull requests Successful merges: - rust-lang#77950 (Add support for SHA256 source file hashing) - rust-lang#78624 (Sync rustc_codegen_cranelift) - rust-lang#78626 (Improve errors about #[deprecated] attribute) - rust-lang#78659 (Corrected suggestion for generic parameters in `function_item_references` lint) - rust-lang#78687 (Suggest library/std when running all stage 0 tests) - rust-lang#78699 (Show more error information in lldb_batchmode) - rust-lang#78709 (Fix panic in bootstrap for non-workspace path dependencies.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5cdf5b8 + a65507b commit 5629309

Some content is hidden

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

77 files changed

+886
-488
lines changed

Cargo.lock

+30-5
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,17 @@ dependencies = [
19281928
"opaque-debug 0.2.3",
19291929
]
19301930

1931+
[[package]]
1932+
name = "md-5"
1933+
version = "0.9.1"
1934+
source = "registry+https://github.com/rust-lang/crates.io-index"
1935+
checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15"
1936+
dependencies = [
1937+
"block-buffer 0.9.0",
1938+
"digest 0.9.0",
1939+
"opaque-debug 0.3.0",
1940+
]
1941+
19311942
[[package]]
19321943
name = "mdbook"
19331944
version = "0.4.3"
@@ -2467,7 +2478,7 @@ checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
24672478
dependencies = [
24682479
"maplit",
24692480
"pest",
2470-
"sha-1",
2481+
"sha-1 0.8.2",
24712482
]
24722483

24732484
[[package]]
@@ -3281,14 +3292,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
32813292
checksum = "1c267f15c3cfc82a8a441d2bf86bcccf299d1eb625822468e3d8ee6f7c5a1c89"
32823293
dependencies = [
32833294
"cfg-if 0.1.10",
3284-
"md-5",
3295+
"md-5 0.8.0",
32853296
"rustc-ap-rustc_arena",
32863297
"rustc-ap-rustc_data_structures",
32873298
"rustc-ap-rustc_index",
32883299
"rustc-ap-rustc_macros",
32893300
"rustc-ap-rustc_serialize",
32903301
"scoped-tls",
3291-
"sha-1",
3302+
"sha-1 0.8.2",
32923303
"tracing",
32933304
"unicode-width",
32943305
]
@@ -4138,14 +4149,15 @@ name = "rustc_span"
41384149
version = "0.0.0"
41394150
dependencies = [
41404151
"cfg-if 0.1.10",
4141-
"md-5",
4152+
"md-5 0.9.1",
41424153
"rustc_arena",
41434154
"rustc_data_structures",
41444155
"rustc_index",
41454156
"rustc_macros",
41464157
"rustc_serialize",
41474158
"scoped-tls",
4148-
"sha-1",
4159+
"sha-1 0.9.1",
4160+
"sha2",
41494161
"tracing",
41504162
"unicode-width",
41514163
]
@@ -4510,6 +4522,19 @@ dependencies = [
45104522
"opaque-debug 0.2.3",
45114523
]
45124524

4525+
[[package]]
4526+
name = "sha-1"
4527+
version = "0.9.1"
4528+
source = "registry+https://github.com/rust-lang/crates.io-index"
4529+
checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770"
4530+
dependencies = [
4531+
"block-buffer 0.9.0",
4532+
"cfg-if 0.1.10",
4533+
"cpuid-bool",
4534+
"digest 0.9.0",
4535+
"opaque-debug 0.3.0",
4536+
]
4537+
45134538
[[package]]
45144539
name = "sha2"
45154540
version = "0.9.1"

compiler/rustc_attr/src/builtin.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -637,19 +637,15 @@ pub struct Deprecation {
637637
}
638638

639639
/// Finds the deprecation attribute. `None` if none exists.
640-
pub fn find_deprecation(sess: &Session, attrs: &[Attribute], item_sp: Span) -> Option<Deprecation> {
641-
find_deprecation_generic(sess, attrs.iter(), item_sp)
640+
pub fn find_deprecation(sess: &Session, attrs: &[Attribute]) -> Option<(Deprecation, Span)> {
641+
find_deprecation_generic(sess, attrs.iter())
642642
}
643643

644-
fn find_deprecation_generic<'a, I>(
645-
sess: &Session,
646-
attrs_iter: I,
647-
item_sp: Span,
648-
) -> Option<Deprecation>
644+
fn find_deprecation_generic<'a, I>(sess: &Session, attrs_iter: I) -> Option<(Deprecation, Span)>
649645
where
650646
I: Iterator<Item = &'a Attribute>,
651647
{
652-
let mut depr: Option<Deprecation> = None;
648+
let mut depr: Option<(Deprecation, Span)> = None;
653649
let diagnostic = &sess.parse_sess.span_diagnostic;
654650

655651
'outer: for attr in attrs_iter {
@@ -658,8 +654,11 @@ where
658654
continue;
659655
}
660656

661-
if depr.is_some() {
662-
struct_span_err!(diagnostic, item_sp, E0550, "multiple deprecated attributes").emit();
657+
if let Some((_, span)) = &depr {
658+
struct_span_err!(diagnostic, attr.span, E0550, "multiple deprecated attributes")
659+
.span_label(attr.span, "repeated deprecation attribute")
660+
.span_label(*span, "first deprecation attribute")
661+
.emit();
663662
break;
664663
}
665664

@@ -780,7 +779,7 @@ where
780779
sess.mark_attr_used(&attr);
781780

782781
let is_since_rustc_version = sess.check_name(attr, sym::rustc_deprecated);
783-
depr = Some(Deprecation { since, note, suggestion, is_since_rustc_version });
782+
depr = Some((Deprecation { since, note, suggestion, is_since_rustc_version }, attr.span));
784783
}
785784

786785
depr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Bootstrap rustc using cg_clif
2+
3+
on:
4+
- push
5+
6+
jobs:
7+
bootstrap_rustc:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Cache cargo installed crates
14+
uses: actions/cache@v2
15+
with:
16+
path: ~/.cargo/bin
17+
key: ${{ runner.os }}-cargo-installed-crates
18+
19+
- name: Cache cargo registry and index
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/.cargo/registry
24+
~/.cargo/git
25+
key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
26+
27+
- name: Cache cargo target dir
28+
uses: actions/cache@v2
29+
with:
30+
path: target
31+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
32+
33+
- name: Prepare dependencies
34+
run: |
35+
git config --global user.email "user@example.com"
36+
git config --global user.name "User"
37+
./prepare.sh
38+
39+
- name: Test
40+
run: |
41+
# Enable backtraces for easier debugging
42+
export RUST_BACKTRACE=1
43+
44+
./scripts/test_bootstrap.sh

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ jobs:
5151
export COMPILE_RUNS=2
5252
export RUN_RUNS=2
5353
54-
./test.sh --release
54+
./test.sh
55+
56+
- name: Package prebuilt cg_clif
57+
run: tar cvfJ cg_clif.tar.xz build
58+
59+
- name: Upload prebuilt cg_clif
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: cg_clif-${{ runner.os }}
63+
path: cg_clif.tar.xz

compiler/rustc_codegen_cranelift/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ perf.data
66
perf.data.old
77
*.events
88
*.string*
9-
/build_sysroot/sysroot
9+
/build
1010
/build_sysroot/sysroot_src
1111
/rust
1212
/rand

compiler/rustc_codegen_cranelift/Cargo.lock

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
4444
[[package]]
4545
name = "cranelift-bforest"
4646
version = "0.67.0"
47-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
47+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
4848
dependencies = [
4949
"cranelift-entity",
5050
]
5151

5252
[[package]]
5353
name = "cranelift-codegen"
5454
version = "0.67.0"
55-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
55+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
5656
dependencies = [
5757
"byteorder",
5858
"cranelift-bforest",
@@ -70,7 +70,7 @@ dependencies = [
7070
[[package]]
7171
name = "cranelift-codegen-meta"
7272
version = "0.67.0"
73-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
73+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
7474
dependencies = [
7575
"cranelift-codegen-shared",
7676
"cranelift-entity",
@@ -79,17 +79,17 @@ dependencies = [
7979
[[package]]
8080
name = "cranelift-codegen-shared"
8181
version = "0.67.0"
82-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
82+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
8383

8484
[[package]]
8585
name = "cranelift-entity"
8686
version = "0.67.0"
87-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
87+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
8888

8989
[[package]]
9090
name = "cranelift-frontend"
9191
version = "0.67.0"
92-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
92+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
9393
dependencies = [
9494
"cranelift-codegen",
9595
"log",
@@ -100,7 +100,7 @@ dependencies = [
100100
[[package]]
101101
name = "cranelift-module"
102102
version = "0.67.0"
103-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
103+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
104104
dependencies = [
105105
"anyhow",
106106
"cranelift-codegen",
@@ -112,7 +112,7 @@ dependencies = [
112112
[[package]]
113113
name = "cranelift-native"
114114
version = "0.67.0"
115-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
115+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
116116
dependencies = [
117117
"cranelift-codegen",
118118
"raw-cpuid",
@@ -122,7 +122,7 @@ dependencies = [
122122
[[package]]
123123
name = "cranelift-object"
124124
version = "0.67.0"
125-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
125+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
126126
dependencies = [
127127
"anyhow",
128128
"cranelift-codegen",
@@ -135,7 +135,7 @@ dependencies = [
135135
[[package]]
136136
name = "cranelift-simplejit"
137137
version = "0.67.0"
138-
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#4fd90dccabb266e983740e1f5daf8bde9266b286"
138+
source = "git+https://github.com/bytecodealliance/wasmtime/?branch=main#44cbdecea03c360ea82e6482f0cf6c614effef21"
139139
dependencies = [
140140
"cranelift-codegen",
141141
"cranelift-entity",

compiler/rustc_codegen_cranelift/Readme.md

+26-11
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,56 @@
22

33
> ⚠⚠⚠ Certain kinds of FFI don't work yet. ⚠⚠⚠
44
5-
The goal of this project is to create an alternative codegen backend for the rust compiler based on [Cranelift](https://github.com/bytecodealliance/wasmtime/blob/master/cranelift). This has the potential to improve compilation times in debug mode. If your project doesn't use any of the things listed under "Not yet supported", it should work fine. If not please open an issue.
5+
The goal of this project is to create an alternative codegen backend for the rust compiler based on [Cranelift](https://github.com/bytecodealliance/wasmtime/blob/master/cranelift).
6+
This has the potential to improve compilation times in debug mode.
7+
If your project doesn't use any of the things listed under "Not yet supported", it should work fine.
8+
If not please open an issue.
69

7-
## Building
10+
## Building and testing
811

912
```bash
1013
$ git clone https://github.com/bjorn3/rustc_codegen_cranelift.git
1114
$ cd rustc_codegen_cranelift
1215
$ ./prepare.sh # download and patch sysroot src and install hyperfine for benchmarking
13-
$ ./test.sh --release
16+
$ ./build.sh
1417
```
1518

19+
To run the test suite replace the last command with:
20+
21+
```bash
22+
$ ./test.sh
23+
```
24+
25+
This will implicitly build cg_clif too. Both `build.sh` and `test.sh` accept a `--debug` argument to
26+
build in debug mode.
27+
28+
Alternatively you can download a pre built version from [GHA]. It is listed in the artifacts section
29+
of workflow runs. Unfortunately due to GHA restrictions you need to be logged in to access it.
30+
31+
[GHA]: https://github.com/bjorn3/rustc_codegen_cranelift/actions?query=branch%3Amaster+event%3Apush+is%3Asuccess
32+
1633
## Usage
1734

1835
rustc_codegen_cranelift can be used as a near-drop-in replacement for `cargo build` or `cargo run` for existing projects.
1936

20-
Assuming `$cg_clif_dir` is the directory you cloned this repo into and you followed the instructions (`prepare.sh` and `test.sh`).
37+
Assuming `$cg_clif_dir` is the directory you cloned this repo into and you followed the instructions (`prepare.sh` and `build.sh` or `test.sh`).
2138

2239
### Cargo
2340

2441
In the directory with your project (where you can do the usual `cargo build`), run:
2542

2643
```bash
27-
$ $cg_clif_dir/cargo.sh run
44+
$ $cg_clif_dir/build/cargo.sh run
2845
```
2946

3047
This should build and run your project with rustc_codegen_cranelift instead of the usual LLVM backend.
3148

32-
If you compiled cg_clif in debug mode (aka you didn't pass `--release` to `./test.sh`) you should set `CHANNEL="debug"`.
33-
3449
### Rustc
3550

3651
> You should prefer using the Cargo method.
3752
3853
```bash
39-
$ $cg_clif_dir/target/release/cg_clif my_crate.rs
54+
$ $cg_clif_dir/build/cg_clif my_crate.rs
4055
```
4156

4257
### Jit mode
@@ -47,13 +62,13 @@ In jit mode cg_clif will immediately execute your code without creating an execu
4762
> The jit mode will probably need cargo integration to make this possible.
4863
4964
```bash
50-
$ $cg_clif_dir/cargo.sh jit
65+
$ $cg_clif_dir/build/cargo.sh jit
5166
```
5267

5368
or
5469

5570
```bash
56-
$ $cg_clif_dir/target/release/cg_clif --jit my_crate.rs
71+
$ $cg_clif_dir/build/cg_clif --jit my_crate.rs
5772
```
5873

5974
### Shell
@@ -62,7 +77,7 @@ These are a few functions that allow you to easily run rust code from the shell
6277

6378
```bash
6479
function jit_naked() {
65-
echo "$@" | $cg_clif_dir/target/release/cg_clif - --jit
80+
echo "$@" | $cg_clif_dir/build/cg_clif - --jit
6681
}
6782

6883
function jit() {

0 commit comments

Comments
 (0)