rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.77k stars 12.5k forks source link

Rust 1.73.0 fails to build on powerpc-unknown-freebsd (regression from 1.72.0) #116845

Open pkubaj opened 11 months ago

pkubaj commented 11 months ago

This is FreeBSD 14.0-RC1 on powerpc (powerpc64 and powerpc64le build and work fine). 1.72.0 builds fine, but 1.73.0:

    Checking core v0.0.0 (/wrkdirs/usr/ports/lang/rust/work/rustc-1.73.0-src/library/core)
     Running `CARGO=/wrkdirs/usr/ports/lang/rust/work/bootstrap/bin/cargo CARGO_CRATE_NAME=core CARGO_MANIFEST_DIR=/wrkdirs/usr/ports/lang/rust/work/rustc-1.73.0-src/library/core CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='The Rust Core Library' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=core CARGO_PKG_README='' CARGO_PKG_REPOSITORY='https://github.com/rust-lang/rust.git' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.0.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/release/deps:/wrkdirs/usr/ports/lang/rust/work/bootstrap/lib' /wrkdirs/usr/ports/lang/rust/work/_build/bootstrap/debug/rustc
--crate-name core --edition=2021 library/core/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=153 --crate-type lib --emit=dep-info,metadata -C opt-level=3 -C embed-bitcode=no -Zunstable-options --check-cfg 'names()' --check-cfg 'values()' -C metadata=790b88ec91d684ee -C extra-filename=-790b88ec91d684ee --out-dir /wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/powerpc-unknown-freebsd/release/deps --target powerpc-unknown-freebsd -C linker=/wrkdirs/usr/ports/lang/rust/work/ld-wrapper -L dependency=/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/powerpc-unknown-freebsd/release/deps -L dependency=/wrkdirs/usr/ports/lang/rust/work/_build/powerpc-unknown-freebsd/stage2-std/powerpc-unknown-freebsd/doc/release/deps -L/usr/local/lib/gcc12 -Csymbol-mangling-version=legacy -Zunstable-options -Zunstable-options '--check-cfg=values(bootstrap)' '--check-cfg=values(stdarch_intel_sde)' '--check-cfg=values(no_fp_fmt_parse)' '--check-cfg=values(no_global_oom_handling)' '--check-cfg=values(no_rc)' '--check-cfg=values(no_sync)' '--check-cfg=values(freebsd12)' '--check-cfg=values(freebsd13)' '--check-cfg=values(backtrace_in_libstd)' '--check-cfg=values(target_vendor,"unikraft")' '--check-cfg=values(target_env,"libnx")' '--check-cfg=values(target_os,"teeos")' '--check-cfg=values(target_arch,"asmjs","spirv","nvptx","xtensa","mips32r6","mips64r6","csky")' -Zmacro-backtrace -Clink-args=-Wl,-z,origin '-Clink-args=-Wl,-rpath,$ORIGIN/../lib' -Zunstable-options -Csplit-debuginfo=off -Cprefer-dynamic -Zinline-mir -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/1.73.0/")' -Z binary-dep-depinfo`
error[E0004]: non-exhaustive patterns: `ControlFlow::Continue(_)` not covered
    --> library/core/src/iter/traits/iterator.rs:3022:32
     |
3022 |             move |(), x| match f(&x).branch() {
     |                                ^^^^^^^^^^^^^^ pattern `ControlFlow::Continue(_)` not covered
     |
note: `ControlFlow<R, bool>` defined here
    --> library/core/src/ops/control_flow.rs:89:5
     |
85   | pub enum ControlFlow<B, C = ()> {
     |          -----------
...
89   |     Continue(C),
     |     ^^^^^^^^ not covered
     = note: the matched value is of type `ControlFlow<R, bool>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
3025 ~                 ControlFlow::Break(r) => ControlFlow::Break(FromResidual::from_residual(r)),
3026 ~                 ControlFlow::Continue(_) => todo!(),
     |

warning: variable does not need to be mutable
    --> library/core/src/iter/traits/iterator.rs:3016:13
     |
3016 |             mut f: impl FnMut(&I) -> V,
     |             ----^
     |             |
     |             help: remove this `mut`
     |
     = note: `#[warn(unused_mut)]` on by default

For more information about this error, try `rustc --explain E0004`.

Did not run successfully: exit status: 1
apiraino commented 11 months ago

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

he32 commented 10 months ago

I see a similar problem on NetBSD/macppc 10.0_BETA (32-bit powerpc) when rust is built with the embedded LLVM. In my case, the errors emitted are:

   Compiling cc v1.0.79
     Running `/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/bootstrap/debug/rustc --crate-name cc --edition=2018 /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/vendor/cc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="jobserver"' --cfg 'feature="parallel"' -Zunstable-options --check-cfg 'values(feature, "jobserver", "parallel")' --check-cfg 'names()' --check-cfg 'values()' -C metadata=91e1216a03968704 -C extra-filename=-91e1216a03968704 --out-dir /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps -L dependency=/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps --extern jobserver=/usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/build/powerpc-unknown-netbsd/stage2-tools/release/deps/libjobserver-fb2cbaa448fd5a50.rmeta --cap-lints allow -Z binary-dep-depinfo`
error[E0004]: non-exhaustive patterns: `Some(_)` not covered
    --> /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/vendor/cc/src/lib.rs:1585:38
     |
1585 |                 let crt_flag = match self.static_crt {
     |                                      ^^^^^^^^^^^^^^^ pattern `Some(_)` not covered
     |
note: `Option<bool>` defined here
    --> /usr/pkgsrc/wip/rust/work/rustc-1.73.0-src/library/core/src/option.rs:571:5
     |
563  | pub enum Option<T> {
     | ------------------
...
571  |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
     |     ^^^^ not covered
     = note: the matched value is of type `Option<bool>`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
     |
1597 ~                     },
1598 +                     Some(_) => todo!()
     |

For more information about this error, try `rustc --explain E0004`.

Did not run successfully: exit status: 1

However, if, instead, rust is built with an external LLVM, version 15.0.7, the build succeeds(!)

The LLVM embedded in rust version 1.73.0 appears to be version 17.0.2.

nikic commented 10 months ago

Can you please try beta (or alternatively LLVM 17.0.3)? It contains a miscompilation fix for PowerPC targets that may be relevant.

he32 commented 10 months ago

Hmm, I've not done that before. Is there a tar-ball available of beta which includes all the vendored sources (something which my current build setup relies on)? Or... It may be easier to extract the diff between llvm 17.0.2 and 17.0.3 and apply that, as a test.

pkubaj commented 10 months ago

I backported the one-line change from https://github.com/llvm/llvm-project/commit/491a91e8eea27fab4d8123cbfbb01bf1cf251b9c#diff-909a72141a3ecd6bfde54a6344f80d2a194c3eb79622c5845f6c7c119145af6f and it fixes Rust's build. Since it looks like there are more platforms experiencing this issue (not just FreeBSD and the LLVM bug mentions also 64-bit POWER, even though Rust builds fine for me on 64-bits), would it be possible to release 1.73.1 with this patch (or LLVM 17.0.3)?

he32 commented 10 months ago

I wedged in the 17.0.3 changes, and with that my build of 1.73.0 succeeds on NetBSD/macppc 10.0_BETA.