Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core fails to build with E0493 when coverage instrumentation is enabled #93848

Closed
kawadakk opened this issue Feb 10, 2022 · 0 comments · Fixed by #93870
Closed

core fails to build with E0493 when coverage instrumentation is enabled #93848

kawadakk opened this issue Feb 10, 2022 · 0 comments · Fixed by #93870
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-destructors Area: Destructors (`Drop`, …) C-bug Category: This is a bug.

Comments

@kawadakk
Copy link
Contributor

I tried this code:

// src/lib.rs is empty
env RUSTFLAGS='-C instrument-coverage -Z no-profiler-runtime' cargo build --target x86_64-unknown-linux
-gnu -Z build-std

I expected to see this happen: A successful build

Instead, this happened: error[E0493]: destructors cannot be evaluated at compile-time while building core

$ env RUSTFLAGS='-C instrument-coverage -Z no-profiler-runtime' cargo build --target x86_64-unknown-linux-gnu -Z build-std
   Compiling core v0.0.0 (/home/$USER/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
error[E0493]: destructors cannot be evaluated at compile-time
    --> /home/$USER/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1824:28
     |
1824 |     pub const fn transpose(self) -> Result<Option<T>, E> {
     |                            ^^^^ constant functions cannot evaluate destructors

error[E0493]: destructors cannot be evaluated at compile-time
    --> /home/$USER/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:1654:28
     |
1654 |     pub const fn transpose(self) -> Option<Result<T, E>> {
     |                            ^^^^ constant functions cannot evaluate destructors

For more information about this error, try `rustc --explain E0493`.
error: could not compile `core` due to 2 previous errors

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (e7aca8959 2022-02-09)
binary: rustc
commit-hash: e7aca895980f25f6d2d3c48e10fd04656764d1e4
commit-date: 2022-02-09
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
@kawadakk kawadakk added the C-bug Category: This is a bug. label Feb 10, 2022
@tmiasko tmiasko added A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-destructors Area: Destructors (`Drop`, …) labels Feb 10, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 25, 2022
…th-coverage, r=ecstatic-morse

Fix switch on discriminant detection in a presence of coverage counters

Fixes rust-lang#93848.

r? `@ecstatic-morse`
@bors bors closed this as completed in 0da6dd3 Feb 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-destructors Area: Destructors (`Drop`, …) C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants