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: glacier fixed/82079.rs with -Zmir-opt-level=3: failed to normalize [closure@./82079.rs:13:25: 13:46] #96395

Closed
matthiaskrgr opened this issue Apr 25, 2022 · 1 comment · Fixed by #96950
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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

This ice'd previously in #82079 and was fixed by #91255 but now it ICEs again with -Zmir-opt-level=3

#![crate_type = "lib"]

mod convenience_operators {
    use crate::{Op, Relation};
    use std::ops::AddAssign;
    use std::ops::Mul;

    impl<C: Op> Relation<C> {
        pub fn map<F: Fn(C::D) -> D2 + 'static, D2: 'static>(
            self,
            f: F,
        ) -> Relation<impl Op<D = D2, R = C::R>> {
            self.map_dr(move |x, r| (f(x), r))
        }
    }

    impl<K: 'static, V: 'static, C: Op<D = (K, V)>> Relation<C> {
        pub fn semijoin<C2: Op<D = K, R = R2>, R2, R3: AddAssign<R3>>(
            self,
            other: Relation<C2>,
        ) -> Relation<impl Op<D = C::D, R = R3>>
        where
            C::R: Mul<R2, Output = R3>,
        {
            self.join(other.map(|x| (x, ()))).map(|(k, x, ())| (k, x))
        }
    }
}

mod core {
    mod operator {
        mod join {
            use super::Op;
            use crate::core::Relation;
            use std::ops::{AddAssign, Mul};
            struct Join<LC, RC> {
                _left: LC,
                _right: RC,
            }
            impl<
                    LC: Op<D = (K, LD), R = LR>,
                    RC: Op<D = (K, RD), R = RR>,
                    K: 'static,
                    LD: 'static,
                    LR: AddAssign<LR> + Mul<RR, Output = OR>,
                    RD: 'static,
                    RR: AddAssign<RR>,
                    OR: AddAssign<OR>,
                > Op for Join<LC, RC>
            {
                type D = (K, LD, RD);
                type R = OR;
            }
            impl<K: 'static, D: 'static, C: Op<D = (K, D)>> Relation<C> {
                pub fn join<C2: Op<D = (K, D2)>, D2: 'static, OR: AddAssign<OR>>(
                    self,
                    other: Relation<C2>,
                ) -> Relation<impl Op<D = (K, D, D2), R = OR>>
                where
                    C::R: Mul<C2::R, Output = OR>,
                {
                    Relation {
                        inner: Join {
                            _left: self.inner,
                            _right: other.inner,
                        },
                    }
                }
            }
        }
        mod map {
            use super::Op;
            use crate::core::Relation;
            use std::ops::AddAssign;
            struct Map<C, MF> {
                _inner: C,
                _op: MF,
            }
            impl<
                    D1,
                    R1,
                    D2: 'static,
                    R2: AddAssign<R2>,
                    C: Op<D = D1, R = R1>,
                    MF: Fn(D1, R1) -> (D2, R2),
                > Op for Map<C, MF>
            {
                type D = D2;
                type R = R2;
            }
            impl<C: Op> Relation<C> {
                pub fn map_dr<F: Fn(C::D, C::R) -> (D2, R2), D2: 'static, R2: AddAssign<R2>>(
                    self,
                    f: F,
                ) -> Relation<impl Op<D = D2, R = R2>> {
                    Relation {
                        inner: Map {
                            _inner: self.inner,
                            _op: f,
                        },
                    }
                }
            }
        }
        use std::ops::AddAssign;
        pub trait Op {
            type D: 'static;
            type R: AddAssign<Self::R>;
        }
    }
    pub use self::operator::Op;
    #[derive(Clone)]
    pub struct Relation<C> {
        inner: C,
    }
}

use self::core::Op;
pub use self::core::Relation;

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (18f314e70 2022-04-24)
binary: rustc
commit-hash: 18f314e7027fe7084aaab8620c624a0d7bd29e70
commit-date: 2022-04-24
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.1

Error output


Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:179:90: Failed to normalize [closure@./82079.rs:13:25: 13:46], maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/compiler/rustc_errors/src/lib.rs:1313:9
stack backtrace:
   0:     0x7fe53ca9defd - std::backtrace_rs::backtrace::libunwind::trace::h939d3743a8b21a10
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fe53ca9defd - std::backtrace_rs::backtrace::trace_unsynchronized::ha4a90ff774c16a42
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe53ca9defd - std::sys_common::backtrace::_print_fmt::h91737d9294627e79
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fe53ca9defd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h10fe8bd9ff48e1b2
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fe53caf9c7c - core::fmt::write::h2f1ffef1b8b3ecdb
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fe53ca8f5f1 - std::io::Write::write_fmt::ha677b091a1b8cd93
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/io/mod.rs:1655:15
   6:     0x7fe53caa0c15 - std::sys_common::backtrace::_print::h5ea24d25e5051738
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fe53caa0c15 - std::sys_common::backtrace::print::h5321ac51bc2d07aa
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fe53caa0c15 - std::panicking::default_hook::{{closure}}::h227bbb1b5187ba3a
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/panicking.rs:295:22
   9:     0x7fe53caa0889 - std::panicking::default_hook::he030e42f064b493d
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/panicking.rs:314:9
  10:     0x7fe53d2cb911 - rustc_driver[53a0486c6d04b84b]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fe53caa13e6 - std::panicking::rust_panic_with_hook::h3cf1e389ae2148cd
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/panicking.rs:702:17
  12:     0x7fe53e32dcb1 - std[3626c7d336dcad5f]::panicking::begin_panic::<rustc_errors[cc710da0c834f823]::ExplicitBug>::{closure#0}
  13:     0x7fe53e32c556 - std[3626c7d336dcad5f]::sys_common::backtrace::__rust_end_short_backtrace::<std[3626c7d336dcad5f]::panicking::begin_panic<rustc_errors[cc710da0c834f823]::ExplicitBug>::{closure#0}, !>
  14:     0x7fe53e2be8df - std[3626c7d336dcad5f]::panicking::begin_panic::<rustc_errors[cc710da0c834f823]::ExplicitBug>
  15:     0x7fe53e2746a6 - std[3626c7d336dcad5f]::panic::panic_any::<rustc_errors[cc710da0c834f823]::ExplicitBug>
  16:     0x7fe53e270955 - <rustc_errors[cc710da0c834f823]::HandlerInner>::bug::<&alloc[26ca849f96b55acd]::string::String>
  17:     0x7fe53e270360 - <rustc_errors[cc710da0c834f823]::Handler>::bug::<&alloc[26ca849f96b55acd]::string::String>
  18:     0x7fe53e337a7d - rustc_middle[a1045d2d4d351d10]::ty::context::tls::with_opt::<rustc_middle[a1045d2d4d351d10]::util::bug::opt_span_bug_fmt<rustc_span[40d501108594b357]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7fe53e33a176 - rustc_middle[a1045d2d4d351d10]::util::bug::opt_span_bug_fmt::<rustc_span[40d501108594b357]::span_encoding::Span>
  20:     0x7fe53e33a0e3 - rustc_middle[a1045d2d4d351d10]::util::bug::bug_fmt
  21:     0x7fe53f2605f1 - <rustc_middle[a1045d2d4d351d10]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle[a1045d2d4d351d10]::ty::fold::TypeFolder>::fold_ty
  22:     0x7fe53d49e089 - <rustc_middle[a1045d2d4d351d10]::ty::subst::GenericArg as rustc_middle[a1045d2d4d351d10]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[a1045d2d4d351d10]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  23:     0x7fe53d51fde8 - rustc_middle[a1045d2d4d351d10]::ty::util::fold_list::<rustc_middle[a1045d2d4d351d10]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder, rustc_middle[a1045d2d4d351d10]::ty::subst::GenericArg, <&rustc_middle[a1045d2d4d351d10]::ty::list::List<rustc_middle[a1045d2d4d351d10]::ty::subst::GenericArg> as rustc_middle[a1045d2d4d351d10]::ty::fold::TypeFoldable>::try_super_fold_with<rustc_middle[a1045d2d4d351d10]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>::{closure#0}>
  24:     0x7fe53d52c1ee - <rustc_middle[a1045d2d4d351d10]::ty::context::TyCtxt>::normalize_erasing_regions::<&rustc_middle[a1045d2d4d351d10]::ty::list::List<rustc_middle[a1045d2d4d351d10]::ty::subst::GenericArg>>
  25:     0x7fe53d4a7f5f - rustc_mir_transform[8a4a87677af23582]::inline::cycle::mir_callgraph_reachable::process
  26:     0x7fe53d4a79dc - rustc_mir_transform[8a4a87677af23582]::inline::cycle::mir_callgraph_reachable
  27:     0x7fe53db72387 - rustc_query_system[e57d0b2d85dc560a]::query::plumbing::try_execute_query::<rustc_query_impl[1512d41c813fb0ae]::plumbing::QueryCtxt, rustc_query_system[e57d0b2d85dc560a]::query::caches::DefaultCache<(rustc_middle[a1045d2d4d351d10]::ty::instance::Instance, rustc_span[40d501108594b357]::def_id::LocalDefId), bool>>
  28:     0x7fe53db95eed - rustc_query_system[e57d0b2d85dc560a]::query::plumbing::get_query::<rustc_query_impl[1512d41c813fb0ae]::queries::mir_callgraph_reachable, rustc_query_impl[1512d41c813fb0ae]::plumbing::QueryCtxt>
  29:     0x7fe53dd660de - <rustc_query_impl[1512d41c813fb0ae]::Queries as rustc_middle[a1045d2d4d351d10]::ty::query::QueryEngine>::mir_callgraph_reachable
  30:     0x7fe53d55279f - <rustc_mir_transform[8a4a87677af23582]::inline::Inliner>::try_inlining
  31:     0x7fe53d54fdfc - <rustc_mir_transform[8a4a87677af23582]::inline::Inliner>::process_blocks
  32:     0x7fe53d54f66f - <rustc_mir_transform[8a4a87677af23582]::inline::Inline as rustc_middle[a1045d2d4d351d10]::mir::MirPass>::run_pass
  33:     0x7fe53e70a85e - rustc_mir_transform[8a4a87677af23582]::pass_manager::run_passes
  34:     0x7fe53e6f68bd - rustc_mir_transform[8a4a87677af23582]::optimized_mir
  35:     0x7fe53ece976b - rustc_query_system[e57d0b2d85dc560a]::query::plumbing::try_execute_query::<rustc_query_impl[1512d41c813fb0ae]::plumbing::QueryCtxt, rustc_query_system[e57d0b2d85dc560a]::query::caches::DefaultCache<rustc_span[40d501108594b357]::def_id::DefId, &rustc_middle[a1045d2d4d351d10]::mir::Body>>
  36:     0x7fe53ede02ee - <rustc_query_impl[1512d41c813fb0ae]::Queries as rustc_middle[a1045d2d4d351d10]::ty::query::QueryEngine>::optimized_mir
  37:     0x7fe53ee0efef - <rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::EncodeContext>::encode_crate_root
  38:     0x7fe53f9587ba - rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::encode_metadata_impl
  39:     0x7fe53f972d01 - rustc_data_structures[aac45c5228699a3f]::sync::join::<rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::encode_metadata::{closure#1}, rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::EncodedMetadata, ()>
  40:     0x7fe53f957f56 - rustc_metadata[c9f0dc93c058a53b]::rmeta::encoder::encode_metadata
  41:     0x7fe53f31b9c3 - <rustc_interface[2bcbc0074c3d12f8]::passes::QueryContext>::enter::<<rustc_interface[2bcbc0074c3d12f8]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[2e8b3e7717192d8]::result::Result<alloc[26ca849f96b55acd]::boxed::Box<dyn core[2e8b3e7717192d8]::any::Any>, rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>
  42:     0x7fe53f341e2f - <rustc_interface[2bcbc0074c3d12f8]::queries::Queries>::ongoing_codegen
  43:     0x7fe53f2e353b - <rustc_interface[2bcbc0074c3d12f8]::interface::Compiler>::enter::<rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}::{closure#2}, core[2e8b3e7717192d8]::result::Result<core[2e8b3e7717192d8]::option::Option<rustc_interface[2bcbc0074c3d12f8]::queries::Linker>, rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>
  44:     0x7fe53f30ce4f - rustc_span[40d501108594b357]::with_source_map::<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_interface[2bcbc0074c3d12f8]::interface::create_compiler_and_run<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}>::{closure#1}>
  45:     0x7fe53f2e4174 - rustc_interface[2bcbc0074c3d12f8]::interface::create_compiler_and_run::<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}>
  46:     0x7fe53f2e0a11 - <scoped_tls[3e1d08058305613c]::ScopedKey<rustc_span[40d501108594b357]::SessionGlobals>>::set::<rustc_interface[2bcbc0074c3d12f8]::interface::run_compiler<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}>::{closure#0}, core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>
  47:     0x7fe53f2f9fbf - std[3626c7d336dcad5f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2bcbc0074c3d12f8]::util::run_in_thread_pool_with_globals<rustc_interface[2bcbc0074c3d12f8]::interface::run_compiler<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}>::{closure#0}, core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>::{closure#0}, core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>
  48:     0x7fe53f2fa0f9 - <<std[3626c7d336dcad5f]::thread::Builder>::spawn_unchecked_<rustc_interface[2bcbc0074c3d12f8]::util::run_in_thread_pool_with_globals<rustc_interface[2bcbc0074c3d12f8]::interface::run_compiler<core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>, rustc_driver[53a0486c6d04b84b]::run_compiler::{closure#1}>::{closure#0}, core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>::{closure#0}, core[2e8b3e7717192d8]::result::Result<(), rustc_errors[cc710da0c834f823]::ErrorGuaranteed>>::{closure#1} as core[2e8b3e7717192d8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7fe53caab333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5f4d59ae47de3c76
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/alloc/src/boxed.rs:1866:9
  50:     0x7fe53caab333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc3d73b574ff0f9d5
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/alloc/src/boxed.rs:1866:9
  51:     0x7fe53caab333 - std::sys::unix::thread::Thread::new::thread_start::h7164ed46a21eef8d
                               at /rustc/18f314e7027fe7084aaab8620c624a0d7bd29e70/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7fe53c8835c2 - start_thread
  53:     0x7fe53c908584 - __clone
  54:                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.62.0-nightly (18f314e70 2022-04-24) running on x86_64-unknown-linux-gnu

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

query stack during panic:
#0 [mir_callgraph_reachable] computing if `convenience_operators::<impl at ./82079.rs:8:5: 15:6>::map::<[closure@./82079.rs:25:51: 25:70], (K, V)>` (transitively) calls `convenience_operators::<impl at ./82079.rs:17:5: 27:6>::semijoin`
#1 [optimized_mir] optimizing MIR for `convenience_operators::<impl at ./82079.rs:17:5: 27:6>::semijoin`
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 Apr 25, 2022
@matthiaskrgr
Copy link
Member Author

searched toolchains f4ec0e7 through de1026a


Regression in 6b4563b

🤔

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label May 3, 2022
JohnTitor added a commit to JohnTitor/rust that referenced this issue May 11, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 28, 2022
…rrors,oli-obk

Add regression test for rust-lang#96395

Closes rust-lang#96395
This repeats "fixed" and "ICE", see rust-lang/glacier#1243 (comment)
I think it's good to add a test before regressing again.
r? `@compiler-errors` for quick reviiew

cc `@oli-obk` you might want to check as you're familiar with MIR
bors added a commit to rust-lang-ci/rust that referenced this issue May 29, 2022
…laumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#96950 (Add regression test for rust-lang#96395)
 - rust-lang#97028 (Add support for embedding pretty printers via `#[debugger_visualizer]` attribute)
 - rust-lang#97478 (Remove FIXME on `ExtCtxt::fn_decl()`)
 - rust-lang#97479 (Make some tests check-pass)
 - rust-lang#97482 (ptr::invalid is not equivalent to a int2ptr cast)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in 376163a May 29, 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. glacier ICE tracked in rust-lang/glacier. 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