Skip to content

Internal compiler error while running llvm-tools-preview #83792

Closed
@epompeii

Description

@epompeii

Hey All,
I was trying to follow the instructions to run grcov, and things bottomed out on me.
The compiler suggested I open this issue so here I am!

It may be worth mentioning that I am in a Cargo Workspace, and I'm not using a Cargo.lock file.
The compiler error appears to go away when I remove cargo-edit as a dev dependency. Without it though, things seem to work just fine.

Going back to my larger project and removing cargo-edit also fixed things there.

Code

Cargo.toml

[package]
name = "mvp"
version = "0.1.0"
authors = ["epompeii"]
edition = "2018"

[dev-dependencies]
cargo-edit = "0.7"

lib.rs

pub fn hello() -> &'static str {
    "hello"
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    pub fn test_hello() {
        assert_eq!(hello(), "hello");
    }
}

I ran the following:

  • rustup override set nightly
  • rustup component add llvm-tools-preview
  • export RUSTFLAGS="-Zinstrument-coverage"
  • cargo clean
  • cargo build
  • cargo test

Meta

Output of rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-apple-darwin
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

The failure message:

thread 'rustc' panicked at 'assertion failed: self.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32()', compiler/rustc_span/src/lib.rs:1518:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (07e0e2ec2 2021-03-24) running on x86_64-apple-darwin

note: compiler flags: -Z instrument-coverage -C embed-bitcode=no -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_promoted] processing `parser::array::array`
#1 [mir_borrowck] borrow-checking `parser::array::array`
end of query stack
error: could not compile `toml_edit`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-code-coverageArea: Source-based code coverage (-Cinstrument-coverage)C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions