Skip to content

ICE: broken mir while building rustc #114375

Closed

Description

Code

rustc -Zvalidate-mir file.rs

#![feature(rustc_private)]

extern crate rustc_parse;
extern crate rustc_session;
extern crate rustc_span;

extern crate rustc_driver;

use rustc_session::parse::ParseSess;
use rustc_span::source_map::FilePathMapping;

fn main() {
    rustc_span::create_default_session_globals_then(|| run());
}

fn run() {
    let ps = ParseSess::new(
        vec![rustc_parse::DEFAULT_LOCALE_RESOURCE],
        FilePathMapping::empty(),
    );
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (d12c6e947 2023-08-01)
binary: rustc
commit-hash: d12c6e947ceacf3b22c154caf9532b390d8dc88a
commit-date: 2023-08-01
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

<output>

Not posting the entire 1.7K lines backtrace 🙃

Backtrace

warning: unused variable: `ps`
  --> treereduce.out:19:9
   |
19 |     let ps = ParseSess::new(
   |         ^^ help: if this is intentional, prefix it with an underscore: `_ps`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DropGlue(DefId(2:2152 ~ core[9b2a]::ptr::drop_in_place), Some(std::backtrace::Inner)) (before pass AddMovesFor>
                                Field projection `PlaceRef { local: _1, projection: [Deref, Downcast(Some("Captured"), 2)] }.0` specified type `std::sync::L>
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:497:1
    |
497 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:76:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes
         6: rustc_mir_transform::shim::make_shim
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rus>
         8: <rustc_query_impl::query_impl::mir_shims::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_mi>
         9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_m>
        10: rustc_query_impl::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
        11: <rustc_middle::ty::context::TyCtxt>::instance_mir
        12: rustc_monomorphize::collector::collect_used_items
        13: rustc_monomorphize::collector::collect_items_rec
        14: rustc_monomorphize::collector::collect_items_rec
        15: rustc_monomorphize::collector::collect_items_rec
        16: rustc_monomorphize::collector::collect_items_rec
        17: rustc_monomorphize::collector::collect_items_rec
        18: rustc_monomorphize::collector::collect_items_rec
        19: rustc_monomorphize::collector::collect_items_rec
        20: rustc_monomorphize::collector::collect_items_rec
        21: rustc_monomorphize::collector::collect_items_rec
        22: rustc_monomorphize::collector::collect_items_rec
        23: rustc_monomorphize::collector::collect_items_rec
        24: rustc_monomorphize::collector::collect_items_rec
        25: rustc_monomorphize::collector::collect_items_rec
        26: rustc_monomorphize::collector::collect_items_rec
        27: rustc_monomorphize::collector::collect_items_rec
        28: rustc_monomorphize::collector::collect_items_rec
        29: rustc_monomorphize::collector::collect_items_rec
        30: rustc_monomorphize::collector::collect_items_rec
        31: rustc_data_structures::sync::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_>
        32: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
        33: rustc_monomorphize::collector::collect_crate_mono_items
        34: rustc_monomorphize::partitioning::collect_and_partition_mono_items
        35: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closu>
        36: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::co>
        37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_mi>
        38: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
        39: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
        40: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
        41: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
        42: rustc_interface::passes::start_codegen
        43: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::>
        44: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Op>
        45: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::ru>
        46: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::>
        47: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        49: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/std/src/sys/unix/thread.rs:108:17
        50: <unknown>
        51: <unknown>
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:497:1
    |
497 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DropGlue(DefId(2:2152 ~ core[9b2a]::ptr::drop_in_place), Some(std::backtrace::Inner)) (before pass AddMovesFor>
                                Field projection `PlaceRef { local: _1, projection: [Deref, Downcast(Some("Captured"), 2)] }.0` specified type `std::sync::L>
lines 42-82
        21: rustc_monomorphize::collector::collect_items_rec
        22: rustc_monomorphize::collector::collect_items_rec
        23: rustc_monomorphize::collector::collect_items_rec
        24: rustc_monomorphize::collector::collect_items_rec
        25: rustc_monomorphize::collector::collect_items_rec
        26: rustc_monomorphize::collector::collect_items_rec
        27: rustc_monomorphize::collector::collect_items_rec
        28: rustc_monomorphize::collector::collect_items_rec
        29: rustc_monomorphize::collector::collect_items_rec
        30: rustc_monomorphize::collector::collect_items_rec
        31: rustc_data_structures::sync::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
        32: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
        33: rustc_monomorphize::collector::collect_crate_mono_items
        34: rustc_monomorphize::partitioning::collect_and_partition_mono_items
        35: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
        36: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        38: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
        39: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
        40: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
        41: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
        42: rustc_interface::passes::start_codegen
        43: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
        44: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
        45: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span:>
        46: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        47: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        49: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/std/src/sys/unix/thread.rs:108:17
        50: <unknown>
        51: <unknown>
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:497:1
    |
497 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DropGlue(DefId(2:2152 ~ core[9b2a]::ptr::drop_in_place), Some(std::backtrace::Inner)) (before pass AddMovesForPackedDrops) at bb5[0]:
                                Field projection `PlaceRef { local: _1, projection: [Deref, Downcast(Some("Captured"), 2)] }.0` specified type `std::sync::LazyLock<std::backtrace::Capture, [closure@std::backtrace::lazy_resolve::{closure#0}]>`, but actual type is `std::sync::LazyLock<std::backtrace::Capture, std::back>
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:497:1
    |
497 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:76:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::validate_body
         5: rustc_mir_transform::pass_manager::run_passes
         6: rustc_mir_transform::shim::make_shim
         7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         8: <rustc_query_impl::query_impl::mir_shims::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::instance::InstanceDef)>>::call_once
         9: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_middle::ty::instance::InstanceDef, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        10: rustc_query_impl::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
        11: <rustc_middle::ty::context::TyCtxt>::instance_mir
        12: rustc_monomorphize::collector::collect_used_items
        13: rustc_monomorphize::collector::collect_items_rec
        14: rustc_monomorphize::collector::collect_items_rec
        15: rustc_monomorphize::collector::collect_items_rec
        16: rustc_monomorphize::collector::collect_items_rec
        17: rustc_monomorphize::collector::collect_items_rec
        18: rustc_monomorphize::collector::collect_items_rec
        19: rustc_monomorphize::collector::collect_items_rec
        20: rustc_monomorphize::collector::collect_items_rec
        21: rustc_monomorphize::collector::collect_items_rec
        22: rustc_monomorphize::collector::collect_items_rec
        23: rustc_monomorphize::collector::collect_items_rec
        24: rustc_monomorphize::collector::collect_items_rec
        25: rustc_monomorphize::collector::collect_items_rec
        26: rustc_monomorphize::collector::collect_items_rec
        27: rustc_monomorphize::collector::collect_items_rec
        28: rustc_monomorphize::collector::collect_items_rec
        29: rustc_monomorphize::collector::collect_items_rec
        30: rustc_monomorphize::collector::collect_items_rec
        31: rustc_data_structures::sync::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
        32: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
        33: rustc_monomorphize::collector::collect_crate_mono_items
        34: rustc_monomorphize::partitioning::collect_and_partition_mono_items
        35: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
        36: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        38: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
        39: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
        40: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
        41: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
        42: rustc_interface::passes::start_codegen
        43: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
        44: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
        45: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span:>
        46: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        47: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/alloc/src/boxed.rs:2007:9
        49: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/d12c6e947ceacf3b22c154caf9532b390d8dc88a/library/std/src/sys/unix/thread.rs:108:17
        50: <unknown>
        51: <unknown>
   --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:497:1
    |
497 | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions