diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5caebcee6da..04da8bd1688 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -161,6 +161,7 @@ jobs: - run: rustup update --no-self-update stable - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} - run: rustup target add ${{ matrix.other }} + - run: rustup target add wasm32-unknown-unknown - run: rustup target add aarch64-unknown-none # need this for build-std mock tests if: startsWith(matrix.rust, 'nightly') - run: rustup component add rustc-dev llvm-tools-preview rust-docs @@ -225,6 +226,7 @@ jobs: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable - run: rustup target add i686-unknown-linux-gnu + - run: rustup target add wasm32-unknown-unknown - run: sudo apt update -y && sudo apt install gcc-multilib libsecret-1-0 libsecret-1-dev -y - run: rustup component add rustfmt || echo "rustfmt not available" - run: cargo test -p cargo diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 185c480abb5..92a79bab897 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -1260,3 +1260,38 @@ fn doctest_xcompile_linker() { "#]]) .run(); } + +#[cargo_test] +fn always_emit_warnings_as_warnings_when_learning_target_info() { + if cross_compile::disabled() { + return; + } + + let target = "wasm32-unknown-unknown"; + if !cross_compile::requires_target_installed(target) { + return; + } + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + edition = "2015" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build -v --target") + .env("RUSTFLAGS", "-Awarnings") + .arg(target) + .with_status(101) + .with_stderr_data(str![[r#" +[ERROR] output of --print=file-names missing when learning about target-specific information from rustc +command was: `rustc - --crate-name ___ --print=file-names -Awarnings --target wasm32-unknown-unknown --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` +... +"#]]) + .run(); +}