Closed
Description
rustc-ap-rustc_span fails as part of the rustfmt build when extended = true
in config.toml. It looks like rustc-ap-rustc_span version 705.0.0 uses the unstable Option::expect_none method, but it gets compiled with the stage0 compiler that doesn't support it.
Seen with today's rust master branch (rev a836d9b), which includes rustfmt rev 7de6968 via git submodule. Reproduced on both Arch Linux (where I have rustup installed for my user), and in a clean debian:buster Docker container that has no existing Rust installation.
diff -u config.toml.example config.toml
--- config.toml.example
+++ config.toml
@@ -262,13 +262,14 @@
# which are used to install Rust and Cargo together. This is disabled by
# default. The `tools` option (immediately below) specifies which tools should
# be built if `extended = true`.
-#extended = false
+extended = true
# Installs chosen set of extended tools if `extended = true`. By default builds
# all extended tools except `rust-demangler`, unless the target is also being
# built with `profiler = true`. If chosen tool failed to build the installation
# fails. If `extended = false`, this option is ignored.
#tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"] # + "rust-demangler" if `profiler`
+tools = ["cargo", "clippy", "rustfmt"]
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
#verbose = 0
$ python3 x.py build --stage 2
--snip--
Building stage2 tool rustfmt (x86_64-unknown-linux-gnu)
Compiling rustc-ap-rustc_span v705.0.0
error[E0599]: no method named `expect_none` found for enum `Option<Fingerprint>` in the current scope
--> /root/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/lib.rs:2003:48
|
2003 | cache[index].replace(sub_hash).expect_none("Cache slot was filled");
| ^^^^^^^^^^^ method not found in `Option<Fingerprint>`
error[E0599]: no method named `expect_none` found for enum `Option<u32>` in the current scope
--> /root/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:121:54
|
121 | expn_data.orig_id.replace(self.as_u32()).expect_none("orig_id should be None");
| ^^^^^^^^^^^ method not found in `Option<u32>`
error[E0599]: no method named `expect_none` found for enum `Option<u32>` in the current scope
--> /root/.cargo/registry/src/github.tiyicn.workers.dev-1ecc6299db9ec823/rustc-ap-rustc_span-705.0.0/src/hygiene.rs:205:42
|
205 | data.orig_id.replace(raw_id).expect_none("orig_id should be None");
| ^^^^^^^^^^^ method not found in `Option<u32>`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0599`.
error: could not compile `rustc-ap-rustc_span`
To learn more, run the command again with --verbose.
command did not execute successfully: "/root/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "12" "--release" "--manifest-path" "/root/rust/src/tools/rustfmt/Cargo.toml" "--message-format" "json-render-diagnostics"
It looks like rustfmt
is being compiled using the stage0 compiler, instead of stage1 or stage2 that have already been built.
Is this expected? Is bootstrap using the wrong toolchain for this part of the build?
Metadata
Metadata
Assignees
Labels
No labels