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

ICE: parallel compiler: no ImplicitCtxt stored in tls #111522

Closed
Tracked by #113349
matthiaskrgr opened this issue May 13, 2023 · 2 comments · Fixed by #115220
Closed
Tracked by #113349

ICE: parallel compiler: no ImplicitCtxt stored in tls #111522

matthiaskrgr opened this issue May 13, 2023 · 2 comments · Fixed by #115220
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-parallel Working group: Parallelizing the compiler

Comments

@matthiaskrgr
Copy link
Member

Code

You need parallel compiler config for this!
rustc -Zthreads=300 -Copt-level=3 --crate-type lib need to try a bunch of times

#![feature(generic_const_exprs)]

trait TensorDimension {
    const DIM: usize;
    const ISSCALAR: bool = Self::DIM == 0;
    fn is_scalar(&self) -> bool {
        Self::ISSCALAR
    }
}

trait TensorSize: TensorDimension {
    fn size(&self) -> [usize; Self::DIM];
    fn inbounds(&self, index: [usize; Self::DIM]) -> bool {
        index.iter().zip(self.size().iter()).all(|(i, s)| i < s)
    }
}

trait Broadcastable: TensorSize + Sized {
    type Element;
    fn bget(&self, index: [usize; Self::DIM]) -> Option<Self::Element>;
    fn lazy_updim<const NEWDIM: usize>(
        &self,
        size: [usize; NEWDIM],
    ) -> LazyUpdim<Self, { Self::DIM }, NEWDIM> {
        assert!(
            NEWDIM >= Self::DIM,
            "Updimmed tensor cannot have fewer indices than the initial one."
        ); // const generic bounds on nightly. ( )
        LazyUpdim {
            size,
            reference: &self,
        }
    }
    fn bmap<T, F: Fn(Self::Element) -> T>(&self, foo: F) -> BMap<T, Self, F, { Self::DIM }> {
        BMap {
            reference: self,
            closure: foo,
        }
    }
}

struct LazyUpdim<'a, T: Broadcastable, const OLDDIM: usize, const DIM: usize> {
    size: [usize; DIM],
    reference: &'a T,
}

impl<'a, T: Broadcastable, const DIM: usize> TensorDimension for LazyUpdim<'a, T, { T::DIM }, DIM> {
    const DIM: usize = DIM;
}
impl<'a, T: Broadcastable, const DIM: usize> TensorSize for LazyUpdim<'a, T, { T::DIM }, DIM> {
    fn size(&self) -> [usize; DIM] {
        self.size
    }
}
impl<'a, T: Broadcastable, const DIM: usize> Broadcastable for LazyUpdim<'a, T, { T::DIM }, DIM> {
    type Element = T::Element;
    fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> {
        assert!(DIM >= T::DIM);
        if !self.inbounds(index) {
            return None;
        }
        let size = self.size();
        let newindex: [usize; T::DIM] = Default::default(); //array_init::array_init(|i| if size[i] > 1 {index[i]} else {0});
        self.reference.bget(newindex)
    }
}

struct BMap<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> {
    reference: &'a T,
    closure: F,
}

impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorDimension
    for BMap<'a, R, T, F, DIM>
{
    const DIM: usize = DIM;
}
impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorSize
    for BMap<'a, R, T, F, DIM>
{
    fn size(&self) -> [usize; DIM] {
        self.reference.size()
    }
}
impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> Broadcastable
    for BMap<'a, R, T, F, DIM>
{
    type Element = R;
    fn bget(&self, index: [usize; DIM]) -> Option<Self::Element> {
        self.reference.bget(index).map(&self.closure)
    }
}

impl<T> TensorDimension for Vec<T> {
    const DIM: usize = 1;
}
impl<T> TensorSize for Vec<T> {
    fn size(&self) -> [usize; 1] {
        [self.len()]
    }
}
impl<T: Clone> Broadcastable for Vec<T> {
    type Element = T;
    fn bget(&self, index: [usize; 1]) -> Option<T> {
        self.get(index[0]).cloned()
    }
}

fn main() {
    let v = vec![1, 2, 3];
    let bv = v.lazy_updim([3, 4]);
    let bbv = bv.bmap(|x| x * x);

    println!(
        "The size of v is {:?}",
        bbv.bget([0, 2]).expect("Out of bounds.")
    );
}

Meta

rustc --version --verbose:

4a59ba4d54a3ec0d8ea1e82b7eeb5c8b0162de04

Error output

<output>
Backtrace

thread 'rustc' panicked at 'no ImplicitCtxt stored in tls', /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_middle/src/ty/context/tls.rs:111:50
stack backtrace:
   0:     0x7f884470abf6 - std::backtrace_rs::backtrace::libunwind::trace::h74804ffdd8fa53e7
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f884470abf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h7428ab2b67b36e0c
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f884470abf6 - std::sys_common::backtrace::_print_fmt::h8de225fa5d864a16
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f884470abf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf186862c319ab6b0
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f88447af698 - core::fmt::rt::Argument::fmt::h6eb98e918eb80ebd
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/fmt/rt.rs:138:9
   5:     0x7f88447af698 - core::fmt::write::hfa7c5695b2a1784c
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f88447151bf - std::io::Write::write_fmt::h8780fc8b700f7b89
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/io/mod.rs:1712:15
   7:     0x7f884470a9f5 - std::sys_common::backtrace::_print::h4ce540e460b36e22
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f884470a9f5 - std::sys_common::backtrace::print::h6954c2242c47d1db
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f884472bebc - std::panicking::default_hook::{{closure}}::h7efa3c73d7318a2f
  10:     0x7f884472bb92 - std::panicking::default_hook::h478ef42d51f84426
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:288:9
  11:     0x7f88470fe63b - <alloc[32b43e9536c01a3]::boxed::Box<dyn for<'a, 'b> core[c5d5d662f7508502]::ops::function::Fn<(&'a core[c5d5d662f7508502]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[c5d5d662f7508502]::marker::Send + core[c5d5d662f7508502]::marker::Sync> as core[c5d5d662f7508502]::ops::function::Fn<(&core[c5d5d662f7508502]::panic::panic_info::PanicInfo,)>>::call
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1999:9
  12:     0x7f88470fe63b - rustc_driver_impl[fa47bdc6a12b5fac]::install_ice_hook::{closure#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_driver_impl/src/lib.rs:1258:13
  13:     0x7f884472c75a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfea6944ca11513b1
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1999:9
  14:     0x7f884472c75a - std::panicking::rust_panic_with_hook::h3d7c73761f67633f
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:695:13
  15:     0x7f884470bae7 - std::panicking::begin_panic_handler::{{closure}}::h0004dd01860b01c3
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:582:13
  16:     0x7f884470acd6 - std::sys_common::backtrace::__rust_end_short_backtrace::hccbfe31830e0f553
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:150:18
  17:     0x7f884472c2c2 - rust_begin_unwind
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:578:5
  18:     0x7f88447cb363 - core::panicking::panic_fmt::h98b1dd38c1edb68b
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/panicking.rs:67:14
  19:     0x7f88447bd073 - core::panicking::panic_display::hed6a1164bcb513aa
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/panicking.rs:150:5
  20:     0x7f88447bd073 - core::panicking::panic_str::h54a430d11762606f
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/panicking.rs:134:5
  21:     0x7f88447bd073 - core::option::expect_failed::hb55c9d6138654180
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/option.rs:1932:5
  22:     0x7f8847152ab7 - <core[c5d5d662f7508502]::option::Option<&rustc_middle[d62e0ab363fca640]::ty::context::tls::ImplicitCtxt>>::expect
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/option.rs:898:21
  23:     0x7f8847152ab7 - rustc_middle[d62e0ab363fca640]::ty::context::tls::with_context::<rustc_middle[d62e0ab363fca640]::ty::context::tls::with<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#1}::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>::{closure#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_middle/src/ty/context/tls.rs:111:50
  24:     0x7f8847152ab7 - rustc_middle[d62e0ab363fca640]::ty::context::tls::with_context_opt::<rustc_middle[d62e0ab363fca640]::ty::context::tls::with_context<rustc_middle[d62e0ab363fca640]::ty::context::tls::with<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#1}::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_middle/src/ty/context/tls.rs:94:9
  25:     0x7f8847152ab7 - rustc_middle[d62e0ab363fca640]::ty::context::tls::with_context::<rustc_middle[d62e0ab363fca640]::ty::context::tls::with<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#1}::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_middle/src/ty/context/tls.rs:111:5
  26:     0x7f8847152ab7 - rustc_middle[d62e0ab363fca640]::ty::context::tls::with::<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#1}::{closure#0}, std[68c29493de10bea]::collections::hash::map::HashMap<rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobId, rustc_query_system[8ee2d68ce6f1a061]::query::job::QueryJobInfo<rustc_middle[d62e0ab363fca640]::dep_graph::dep_node::DepKind>, core[c5d5d662f7508502]::hash::BuildHasherDefault<rustc_hash[28a8ba682f75ebb]::FxHasher>>>
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_middle/src/ty/context/tls.rs:144:5
  27:     0x7f8847152ab7 - rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals::<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#1}
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_interface/src/util.rs:185:29
  28:     0x7f884636f0e3 - <alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::Fn<(), Output = ()> + core[c5d5d662f7508502]::marker::Send + core[c5d5d662f7508502]::marker::Sync> as core[c5d5d662f7508502]::ops::function::Fn<()>>::call
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1999:9
  29:     0x7f884636f0e3 - <rayon_core[f08dc397f011bb28]::sleep::SleepData>::deadlock_check
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/sleep/mod.rs:37:13
  30:     0x7f884636f0e3 - <rayon_core[f08dc397f011bb28]::sleep::Sleep>::sleep
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/sleep/mod.rs:273:17
  31:     0x7f88463677b1 - <rayon_core[f08dc397f011bb28]::sleep::Sleep>::no_work_found
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/sleep/mod.rs:178:13
  32:     0x7f88463677b1 - <rayon_core[f08dc397f011bb28]::registry::WorkerThread>::wait_until_cold
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/registry.rs:865:17
  33:     0x7f8846364afd - <rayon_core[f08dc397f011bb28]::registry::WorkerThread>::wait_until::<rayon_core[f08dc397f011bb28]::latch::CountLatch>
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/registry.rs:845:13
  34:     0x7f8846364afd - rayon_core[f08dc397f011bb28]::registry::main_loop
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/registry.rs:991:5
  35:     0x7f8846364afd - <rayon_core[f08dc397f011bb28]::registry::ThreadBuilder>::run
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/registry.rs:55:18
  36:     0x7f88470932e4 - rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals::<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}::{closure#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_interface/src/util.rs:210:82
  37:     0x7f88470932e4 - <scoped_tls[c6512a5451dfceef]::ScopedKey<rustc_span[9849ed9ca8d6c267]::SessionGlobals>>::set::<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}::{closure#0}, ()>
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scoped-tls-1.0.0/src/lib.rs:137:9
  38:     0x7f884708e628 - rustc_span[9849ed9ca8d6c267]::set_session_globals_then::<(), rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}::{closure#0}>
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_span/src/lib.rs:129:5
  39:     0x7f884708e628 - rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals::<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/compiler/rustc_interface/src/util.rs:210:25
  40:     0x7f884708e628 - <rayon_core[f08dc397f011bb28]::ThreadPoolBuilder>::build_scoped::<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}, rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#1}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustc-rayon-core-0.5.0/src/lib.rs:363:44
  41:     0x7f884708e628 - <crossbeam_utils[2907d21727e848bc]::thread::ScopedThreadBuilder>::spawn::<<rayon_core[f08dc397f011bb28]::ThreadPoolBuilder>::build_scoped<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}, rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#1}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0}
                               at /home/matthias/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crossbeam-utils-0.8.14/src/thread.rs:438:31
  42:     0x7f884708e628 - <<crossbeam_utils[2907d21727e848bc]::thread::ScopedThreadBuilder>::spawn<<rayon_core[f08dc397f011bb28]::ThreadPoolBuilder>::build_scoped<rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#0}, rustc_interface[f00717bbd5e2d5b3]::util::run_in_thread_pool_with_globals<rustc_interface[f00717bbd5e2d5b3]::interface::run_compiler<core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>, rustc_driver_impl[fa47bdc6a12b5fac]::run_compiler::{closure#1}>::{closure#0}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#2}::{closure#0}::{closure#1}, core[c5d5d662f7508502]::result::Result<(), rustc_span[9849ed9ca8d6c267]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, ()>::{closure#0} as core[c5d5d662f7508502]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/ops/function.rs:250:5
  43:     0x7f8847144f1e - <alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send> as core[c5d5d662f7508502]::ops::function::FnOnce<()>>::call_once
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1985:9
  44:     0x7f8847144f1e - std[68c29493de10bea]::sys_common::backtrace::__rust_begin_short_backtrace::<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys_common/backtrace.rs:134:18
  45:     0x7f88470ee37f - <std[68c29493de10bea]::thread::Builder>::spawn_unchecked_::<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}::{closure#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/thread/mod.rs:529:17
  46:     0x7f88470ee37f - <core[c5d5d662f7508502]::panic::unwind_safe::AssertUnwindSafe<<std[68c29493de10bea]::thread::Builder>::spawn_unchecked_<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}::{closure#0}> as core[c5d5d662f7508502]::ops::function::FnOnce<()>>::call_once
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/panic/unwind_safe.rs:271:9
  47:     0x7f88470ee37f - std[68c29493de10bea]::panicking::try::do_call::<core[c5d5d662f7508502]::panic::unwind_safe::AssertUnwindSafe<<std[68c29493de10bea]::thread::Builder>::spawn_unchecked_<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}::{closure#0}>, ()>
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:485:40
  48:     0x7f88470ee37f - std[68c29493de10bea]::panicking::try::<(), core[c5d5d662f7508502]::panic::unwind_safe::AssertUnwindSafe<<std[68c29493de10bea]::thread::Builder>::spawn_unchecked_<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}::{closure#0}>>
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panicking.rs:449:19
  49:     0x7f88470ee37f - std[68c29493de10bea]::panic::catch_unwind::<core[c5d5d662f7508502]::panic::unwind_safe::AssertUnwindSafe<<std[68c29493de10bea]::thread::Builder>::spawn_unchecked_<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}::{closure#0}>, ()>
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/panic.rs:140:14
  50:     0x7f88470ee37f - <std[68c29493de10bea]::thread::Builder>::spawn_unchecked_::<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1}
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/thread/mod.rs:528:30
  51:     0x7f88470ee37f - <<std[68c29493de10bea]::thread::Builder>::spawn_unchecked_<alloc[32b43e9536c01a3]::boxed::Box<dyn core[c5d5d662f7508502]::ops::function::FnOnce<(), Output = ()> + core[c5d5d662f7508502]::marker::Send>, ()>::{closure#1} as core[c5d5d662f7508502]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
                               at /home/matthias/vcs/github/rust_debug_assertions/library/core/src/ops/function.rs:250:5
  52:     0x7f884471d69a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h59b61553bfddebc8
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1985:9
  53:     0x7f884471d69a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0ce3d7a7bade6491
                               at /home/matthias/vcs/github/rust_debug_assertions/library/alloc/src/boxed.rs:1985:9
  54:     0x7f8844703b15 - std::sys::unix::thread::Thread::new::thread_start::h6e446945f062d041
                               at /home/matthias/vcs/github/rust_debug_assertions/library/std/src/sys/unix/thread.rs:108:17
  55:     0x7f88444a6bb5 - <unknown>
  56:     0x7f8844528d90 - <unknown>
  57:                0x0 - <unknown>

error: 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.71.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=300 -C opt-level=3 --crate-type lib

query stack during panic:
end of query stack
Rayon: detected unexpected panic; aborting
[1]    1645655 IOT instruction  ~/.rustup/toolchains/local-debug-assertions/bin/rustc -Zthreads=300    lib

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. WG-compiler-parallel Working group: Parallelizing the compiler labels May 13, 2023
@matthiaskrgr
Copy link
Member Author

use std::collections::BTreeSet;

#[derive(Hash)]
pub enum ElemDerived {
    A(ElemDerived)
}

pub enum Elem {
    Derived(ElemDerived)
}

pub struct Set(BTreeSet<Elem>);

impl Set {
    pub fn into_iter(self) -> impl Iterator<Item = Elem> {
        self.0.into_iter()
    }
}

fn main() {}

@petrochenkov
Copy link
Contributor

This issue usually prevents running the standard library test suite with -Zthreads=8.
One test fails in particular - library\alloc\src\boxed.rs - boxed (line 43).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-compiler-parallel Working group: Parallelizing the compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants