Skip to content

compiletest shows very confusing error when a "build-fail" test fails the check part #130894

Closed

Description

@RalfJung

I'm working in a test with //@ build-fail, and I am getting the following error from compiletest:

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/r/src/rust/rustc.2/tests/ui/asm/x86_64/type-check-4.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/r/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/r/src/rust/rustc.2/vendor" "--sysroot" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/test/ui/asm/x86_64/type-check-4" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/r/src/rust/rustc.2/build/x86_64-unknown-linux-gnu/test/ui/asm/x86_64/type-check-4/auxiliary"
stdout: none
--- stderr -------------------------------
error[E0015]: cannot call non-const fn `non_const_fn` in constants
  --> /home/r/src/rust/rustc.2/tests/ui/asm/x86_64/type-check-4.rs:12:25
   |
LL | global_asm!("{}", const non_const_fn(0));
   |                         ^^^^^^^^^^^^^^^
   |
   = note: calls in constants are limited to constant functions, tuple structs and tuple variants

error: aborting due to 1 previous error

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

This error clearly makes no sense -- test compilation should indeed fail, it's a build-fail test after all!

But I assume what happens is what because it says "build-fail", it expects that a "check" build (--emit=metadata) should succeed, and that's the cause of the error. But then it should say so very clearly.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 26, 2024
  2. added
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 27, 2024
  3. added
    C-bugCategory: This is a bug.
    D-confusingDiagnostics: Confusing error or lint that should be reworked.
    on Oct 11, 2024
  4. added a commit that references this issue on Oct 13, 2024
    0fa7101
  5. added a commit that references this issue on Oct 13, 2024
    d939b32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compiletestArea: The compiletest test runnerC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions