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: "failed to normalize" with -Zmir-opt-level=3 --emit=mir #97695

Closed
matthiaskrgr opened this issue Jun 3, 2022 · 0 comments · Fixed by #97696
Closed

ICE: "failed to normalize" with -Zmir-opt-level=3 --emit=mir #97695

matthiaskrgr opened this issue Jun 3, 2022 · 0 comments · Fixed by #97696
Assignees
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.

Comments

@matthiaskrgr
Copy link
Member

Code

pub trait Associate {
    type Associated;
}

pub struct Wrap<'a> {
    pub field: &'a i32,
}

pub trait Create<T> {
    fn create() -> Self;
}

pub fn oh_no<'a, T>()
where
    Wrap<'a>: Associate,
    <Wrap<'a> as Associate>::Associated: Create<T>,
{
    <Wrap<'a> as Associate>::Associated::create();
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.63.0-nightly (e71440575 2022-06-02)
binary: rustc
commit-hash: e71440575c930dcecac288b7c3536410d688b351
commit-date: 2022-06-02
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.4

Error output

rustc crash.rs -Zmir-opt-level=3 --emit=mir

<output>
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:179:90: Failed to normalize <Wrap as Associate>::Associated, maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e71440575c930dcecac288b7c3536410d688b351/compiler/rustc_errors/src/lib.rs:1335:9
stack backtrace:
   0:     0x7fd6a0c9df1d - std::backtrace_rs::backtrace::libunwind::trace::h327a731c868216d5
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd6a0c9df1d - std::backtrace_rs::backtrace::trace_unsynchronized::heaaf896b92db91c6
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd6a0c9df1d - std::sys_common::backtrace::_print_fmt::h633ffd029934626e
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fd6a0c9df1d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7ef8e7d367aa18c8
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fd6a0cf9bfc - core::fmt::write::h3271b30cdab07152
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/core/src/fmt/mod.rs:1196:17
   5:     0x7fd6a0c8f6b1 - std::io::Write::write_fmt::h7ecbce96a7b72ba9
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/io/mod.rs:1654:15
   6:     0x7fd6a0ca0c05 - std::sys_common::backtrace::_print::hddfa9a0a2b4a15e9
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fd6a0ca0c05 - std::sys_common::backtrace::print::h2601f513b7e7fdd6
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fd6a0ca0c05 - std::panicking::default_hook::{{closure}}::h65cd78d378ef7cc4
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/panicking.rs:295:22
   9:     0x7fd6a0ca0926 - std::panicking::default_hook::h7d0d896df43ad640
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/panicking.rs:314:9
  10:     0x7fd6a14f9991 - rustc_driver[f3a1b7bdd5b0cce4]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fd6a0ca12da - std::panicking::rust_panic_with_hook::h95bf9c9282d315b1
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/panicking.rs:702:17
  12:     0x7fd6a25e2651 - std[4d9942a2ca97a94f]::panicking::begin_panic::<rustc_errors[cd24e25f3e8b264c]::ExplicitBug>::{closure#0}
  13:     0x7fd6a25e20c6 - std[4d9942a2ca97a94f]::sys_common::backtrace::__rust_end_short_backtrace::<std[4d9942a2ca97a94f]::panicking::begin_panic<rustc_errors[cd24e25f3e8b264c]::ExplicitBug>::{closure#0}, !>
  14:     0x7fd6a253b2c6 - std[4d9942a2ca97a94f]::panicking::begin_panic::<rustc_errors[cd24e25f3e8b264c]::ExplicitBug>
  15:     0x7fd6a2572dc6 - std[4d9942a2ca97a94f]::panic::panic_any::<rustc_errors[cd24e25f3e8b264c]::ExplicitBug>
  16:     0x7fd6a256f365 - <rustc_errors[cd24e25f3e8b264c]::HandlerInner>::bug::<&alloc[e4e4c5ef8a7ed511]::string::String>
  17:     0x7fd6a256ee40 - <rustc_errors[cd24e25f3e8b264c]::Handler>::bug::<&alloc[e4e4c5ef8a7ed511]::string::String>
  18:     0x7fd6a25bc0bd - rustc_middle[647e80b7dabd2c1a]::ty::context::tls::with_opt::<rustc_middle[647e80b7dabd2c1a]::util::bug::opt_span_bug_fmt<rustc_span[dc47ef931624f33a]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7fd6a25bc216 - rustc_middle[647e80b7dabd2c1a]::util::bug::opt_span_bug_fmt::<rustc_span[dc47ef931624f33a]::span_encoding::Span>
  20:     0x7fd6a25bc193 - rustc_middle[647e80b7dabd2c1a]::util::bug::bug_fmt
  21:     0x7fd6a362ec51 - <rustc_middle[647e80b7dabd2c1a]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle[647e80b7dabd2c1a]::ty::fold::TypeFolder>::fold_ty
  22:     0x7fd6a16a1589 - <rustc_middle[647e80b7dabd2c1a]::ty::subst::GenericArg as rustc_middle[647e80b7dabd2c1a]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[647e80b7dabd2c1a]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  23:     0x7fd6a16fe51d - <&rustc_middle[647e80b7dabd2c1a]::ty::list::List<rustc_middle[647e80b7dabd2c1a]::ty::subst::GenericArg> as rustc_middle[647e80b7dabd2c1a]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[647e80b7dabd2c1a]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  24:     0x7fd6a17457d1 - <rustc_middle[647e80b7dabd2c1a]::ty::context::TyCtxt>::normalize_erasing_regions::<&rustc_middle[647e80b7dabd2c1a]::ty::list::List<rustc_middle[647e80b7dabd2c1a]::ty::subst::GenericArg>>
  25:     0x7fd6a16a781c - <rustc_mir_transform[65cc503a25df7ca9]::inline::Inliner>::process_blocks
  26:     0x7fd6a16a745f - <rustc_mir_transform[65cc503a25df7ca9]::inline::Inline as rustc_middle[647e80b7dabd2c1a]::mir::MirPass>::run_pass
  27:     0x7fd6a291caf0 - rustc_mir_transform[65cc503a25df7ca9]::pass_manager::run_passes
  28:     0x7fd6a297eccd - rustc_mir_transform[65cc503a25df7ca9]::optimized_mir
  29:     0x7fd6a30aebe7 - rustc_query_system[24753986935b348b]::query::plumbing::try_execute_query::<rustc_query_impl[9820119e81209a0f]::plumbing::QueryCtxt, rustc_query_system[24753986935b348b]::query::caches::DefaultCache<rustc_span[dc47ef931624f33a]::def_id::DefId, &rustc_middle[647e80b7dabd2c1a]::mir::Body>>
  30:     0x7fd6a30753be - <rustc_query_impl[9820119e81209a0f]::Queries as rustc_middle[647e80b7dabd2c1a]::ty::query::QueryEngine>::optimized_mir
  31:     0x7fd6a3589426 - <rustc_middle[647e80b7dabd2c1a]::ty::context::TyCtxt>::instance_mir
  32:     0x7fd6a2549855 - rustc_middle[647e80b7dabd2c1a]::mir::pretty::write_mir_pretty
  33:     0x7fd6a171bf90 - rustc_mir_transform[65cc503a25df7ca9]::dump_mir::emit_mir
  34:     0x7fd6a36eadae - <rustc_interface[78799bf1035473cf]::passes::QueryContext>::enter::<<rustc_interface[78799bf1035473cf]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[4ccf542b86124621]::result::Result<alloc[e4e4c5ef8a7ed511]::boxed::Box<dyn core[4ccf542b86124621]::any::Any>, rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>
  35:     0x7fd6a37108ef - <rustc_interface[78799bf1035473cf]::queries::Queries>::ongoing_codegen
  36:     0x7fd6a36b913b - <rustc_interface[78799bf1035473cf]::interface::Compiler>::enter::<rustc_driver[f3a1b7bdd5b0cce4]::run_compiler::{closure#1}::{closure#2}, core[4ccf542b86124621]::result::Result<core[4ccf542b86124621]::option::Option<rustc_interface[78799bf1035473cf]::queries::Linker>, rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>
  37:     0x7fd6a36dc92f - rustc_span[dc47ef931624f33a]::with_source_map::<core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>, rustc_interface[78799bf1035473cf]::interface::create_compiler_and_run<core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>, rustc_driver[f3a1b7bdd5b0cce4]::run_compiler::{closure#1}>::{closure#1}>
  38:     0x7fd6a36b9d32 - <scoped_tls[dcacf9d4db118214]::ScopedKey<rustc_span[dc47ef931624f33a]::SessionGlobals>>::set::<rustc_interface[78799bf1035473cf]::interface::run_compiler<core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>, rustc_driver[f3a1b7bdd5b0cce4]::run_compiler::{closure#1}>::{closure#0}, core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>
  39:     0x7fd6a36cf51f - std[4d9942a2ca97a94f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[78799bf1035473cf]::util::run_in_thread_pool_with_globals<rustc_interface[78799bf1035473cf]::interface::run_compiler<core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>, rustc_driver[f3a1b7bdd5b0cce4]::run_compiler::{closure#1}>::{closure#0}, core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>::{closure#0}, core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>
  40:     0x7fd6a36cf669 - <<std[4d9942a2ca97a94f]::thread::Builder>::spawn_unchecked_<rustc_interface[78799bf1035473cf]::util::run_in_thread_pool_with_globals<rustc_interface[78799bf1035473cf]::interface::run_compiler<core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>, rustc_driver[f3a1b7bdd5b0cce4]::run_compiler::{closure#1}>::{closure#0}, core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>::{closure#0}, core[4ccf542b86124621]::result::Result<(), rustc_errors[cd24e25f3e8b264c]::ErrorGuaranteed>>::{closure#1} as core[4ccf542b86124621]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7fd6a0cab203 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hadf0c51f0daff86d
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/alloc/src/boxed.rs:1927:9
  42:     0x7fd6a0cab203 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7b0c3bd4aa754c93
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/alloc/src/boxed.rs:1927:9
  43:     0x7fd6a0cab203 - std::sys::unix::thread::Thread::new::thread_start::h03d160ee3ff57306
                               at /rustc/e71440575c930dcecac288b7c3536410d688b351/library/std/src/sys/unix/thread.rs:108:17
  44:     0x7fd6a0a835c2 - start_thread
  45:     0x7fd6a0b08584 - __clone
  46:                0x0 - <unknown>

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.63.0-nightly (e71440575 2022-06-02) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z mir-opt-level=3

query stack during panic:
#0 [optimized_mir] optimizing MIR for `oh_no`
end of query stack
error: aborting due to previous error

@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. labels Jun 3, 2022
@cjgillot cjgillot self-assigned this Jun 3, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jun 3, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jun 3, 2022
@bors bors closed this as completed in 74f0bcc Jun 4, 2022
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants