Skip to content

ICE: no MIR available for DefId #96857

@matthiaskrgr

Description

@matthiaskrgr
Member

Code

When running x,py clippy clippy calls rustc on rustc_tools_util while checking its own code, and rustc chokes somehow.
I have been able to reproduce this with standalone rustc_tools_util for some reason.

src/tools/clippy/rustc_tools_util

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (cb1219871 2022-05-08)
binary: rustc
commit-hash: cb121987158d69bb894ba1bcc21dc45d1e0a488f
commit-date: 2022-05-08
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output

<output>
Backtrace

    Finished release [optimized] target(s) in 0.02s
< CodegenBackend { target: x86_64-unknown-linux-gnu, backend: "gcc" }
> Clippy { target: x86_64-unknown-linux-gnu }
  c Assemble { target_compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu } }
  c Rustc { target: x86_64-unknown-linux-gnu }
  c Libdir { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu }, target: x86_64-unknown-linux-gnu }
  c Sysroot { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu } }
  c Sysroot { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu } }
  c Llvm { target: x86_64-unknown-linux-gnu }
  c Sysroot { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu } }
Checking stage0 clippy artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
running: "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "clippy" "--target" "x86_64-unknown-linux-gnu" "-Zunstable-options" "-Zbinary-dep-depinfo" "-j" "1" "-v" "-v" "-v" "-v" "-v" "--release" "--manifest-path" "/home/matthias/vcs/github/rust/src/tools/clippy/Cargo.toml" "--message-format" "json-render-diagnostics" "--" "--cap-lints" "warn" "-Aclippy::many_single_char_names" "-Aclippy::collapsible_if" "-Aclippy::type_complexity" "-Aclippy::missing_safety_doc" "-Aclippy::too_many_arguments" "-Aclippy::needless_lifetimes" "-Aclippy::wrong_self_convention"
       Fresh unicode-xid v0.2.2
       Fresh version_check v0.9.3
       Fresh matches v0.1.8
       Fresh tinyvec v0.3.4
       Fresh percent-encoding v2.1.0
       Fresh itoa v0.4.6
       Fresh arrayvec v0.7.0
       Fresh if_chain v1.0.0
       Fresh rustc-semver v1.1.0
   Compiling rustc_tools_util v0.2.0 (/home/matthias/vcs/github/rust/src/tools/clippy/rustc_tools_util)
     Running `CARGO=/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=rustc_tools_util CARGO_MANIFEST_DIR=/home/matthias/vcs/github/rust/src/tools/clippy/rustc_tools_util CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='small helper to generate version information for git packages' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=rustc_tools_util CARGO_PKG_REPOSITORY='https://github.com/rust-lang/rust-clippy' CARGO_PKG_VERSION=0.2.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps:/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib::/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/master/lib/' /home/matthias/.cargo/bin/sccache /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/clippy-driver rustc --crate-name rustc_tools_util --edition=2018 src/tools/clippy/rustc_tools_util/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 debuginfo=0 -C debug-assertions=off -C metadata=78a028e3a6e8b88a -C extra-filename=-78a028e3a6e8b88a --out-dir /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps -L dependency=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps -Z binary-dep-depinfo`
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:993:9: no MIR available for DefId(1:7577 ~ std[b00f]::process::{impl#22}::new)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/cb121987158d69bb894ba1bcc21dc45d1e0a488f/compiler/rustc_errors/src/lib.rs:1324:9
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner>::bug::<&alloc::string::String>
   3: <rustc_errors::Handler>::bug::<&alloc::string::String>
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, ()>
   5: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_monomorphize::collector::collect_neighbours
   8: rustc_monomorphize::collector::collect_items_rec
   9: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
  10: rustc_monomorphize::collector::collect_crate_mono_items
  11: rustc_monomorphize::partitioning::collect_and_partition_mono_items
  12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), (&std::collections::hash::set::HashSet<rustc_span::def_id::DefId, core::hash::BuildHasherDefault<rustc_hash::FxHasher>>, &[rustc_middle::mir::mono::CodegenUnit])>>
  13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::collect_and_partition_mono_items, rustc_query_impl::plumbing::QueryCtxt>
  14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  15: rustc_codegen_ssa::back::symbol_export::exported_symbols_provider_local
  16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::CrateNum, &[(rustc_middle::middle::exported_symbols::ExportedSymbol, rustc_middle::middle::exported_symbols::SymbolExportInfo)]>>
  17: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::exported_symbols, rustc_query_impl::plumbing::QueryCtxt>
  18: <rustc_metadata::rmeta::encoder::EncodeContext>::encode_crate_root
  19: rustc_metadata::rmeta::encoder::encode_metadata_impl
  20: rustc_data_structures::sync::join::<rustc_metadata::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata::rmeta::encoder::encode_metadata::{closure#1}, rustc_metadata::rmeta::encoder::EncodedMetadata, ()>
  21: rustc_metadata::rmeta::encoder::encode_metadata
  22: <rustc_interface::passes::QueryContext>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_errors::ErrorGuaranteed>>
  23: <rustc_interface::queries::Queries>::ongoing_codegen
  24: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  25: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  26: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>
  27: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.62 (cb12198 2022-05-08)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: could not compile `rustc_tools_util`

Caused by:
  process didn't exit successfully: `CARGO=/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_CRATE_NAME=rustc_tools_util CARGO_MANIFEST_DIR=/home/matthias/vcs/github/rust/src/tools/clippy/rustc_tools_util CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='small helper to generate version information for git packages' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='MIT OR Apache-2.0' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=rustc_tools_util CARGO_PKG_REPOSITORY='https://github.com/rust-lang/rust-clippy' CARGO_PKG_VERSION=0.2.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=2 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps:/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib::/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib:/home/matthias/.rustup/toolchains/master/lib/' /home/matthias/.cargo/bin/sccache /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/clippy-driver rustc --crate-name rustc_tools_util --edition=2018 src/tools/clippy/rustc_tools_util/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 debuginfo=0 -C debug-assertions=off -C metadata=78a028e3a6e8b88a -C extra-filename=-78a028e3a6e8b88a --out-dir /home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps -L dependency=/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0-tools/release/deps -Z binary-dep-depinfo` (exit status: 101)
command did not execute successfully: "/home/matthias/vcs/github/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "clippy" "--target" "x86_64-unknown-linux-gnu" "-Zunstable-options" "-Zbinary-dep-depinfo" "-j" "1" "-v" "-v" "-v" "-v" "-v" "--release" "--manifest-path" "/home/matthias/vcs/github/rust/src/tools/clippy/Cargo.toml" "--message-format" "json-render-diagnostics" "--" "--cap-lints" "warn" "-Aclippy::many_single_char_names" "-Aclippy::collapsible_if" "-Aclippy::type_complexity" "-Aclippy::missing_safety_doc" "-Aclippy::too_many_arguments" "-Aclippy::needless_lifetimes" "-Aclippy::wrong_self_convention"
expected success, got: exit status: 101
Traceback (most recent call last):
  File "/home/matthias/vcs/github/rust/./x.py", line 27, in <module>
    bootstrap.main()
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 1195, in main
    bootstrap(help_triggered)
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 1181, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/home/matthias/vcs/github/rust/src/bootstrap/bootstrap.py", line 190, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/matthias/vcs/github/rust/build/bootstrap/debug/bootstrap clippy -j 1 -vvvvv

Activity

added
I-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.
C-bugCategory: This is a bug.
on May 9, 2022
matthiaskrgr

matthiaskrgr commented on May 9, 2022

@matthiaskrgr
MemberAuthor

wondering if this is related to #85401 ,hm

matthiaskrgr

matthiaskrgr commented on Jul 31, 2022

@matthiaskrgr
MemberAuthor

This now looks like this

warning: `clippy_lints` (lib) generated 3 warnings
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1031:9: no MIR available for DefId(1:7715 ~ std[2afd]::process::{impl#22}::new)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0f4bcadb46006bc484dad85616b484f93879ca4e/compiler/rustc_errors/src/lib.rs:1392:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.64 (0f4bcad 2022-07-30)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0f4bcadb46006bc484dad85616b484f93879ca4e/compiler/rustc_errors/src/lib.rs:1392:9

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.64 (0f4bcad 2022-07-30)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1031:9: no MIR available for DefId(1:2418 ~ std[2afd]::env::var)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0f4bcadb46006bc484dad85616b484f93879ca4e/compiler/rustc_errors/src/lib.rs:1392:9

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.64 (0f4bcad 2022-07-30)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1031:9: no MIR available for DefId(2:9044 ~ core[3fba]::option::{impl#5}::clone)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0f4bcadb46006bc484dad85616b484f93879ca4e/compiler/rustc_errors/src/lib.rs:1392:9

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.64 (0f4bcad 2022-07-30)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:1031:9: no MIR available for DefId(2:48537 ~ core[3fba]::fmt::{impl#3}::new_display)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0f4bcadb46006bc484dad85616b484f93879ca4e/compiler/rustc_errors/src/lib.rs:1392:9

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.64 (0f4bcad 2022-07-30)

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [exported_symbols] exported_symbols
end of query stack
error: could not compile `rustc_tools_util`
Build completed unsuccessfully in 0:00:04
added
E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
requires-custom-configThis issue requires custom config/build for rustc in some way
on Mar 3, 2023
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

    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.requires-custom-configThis issue requires custom config/build for rustc in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matthiaskrgr@JohnTitor

        Issue actions

          ICE: no MIR available for DefId · Issue #96857 · rust-lang/rust