Skip to content

ICE: cargo miri run: normalisation failure #105968

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
matthiaskrgr opened this issue Dec 20, 2022 · 1 comment
Closed

ICE: cargo miri run: normalisation failure #105968

matthiaskrgr opened this issue Dec 20, 2022 · 1 comment
Labels
A-miri Area: The miri tool 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

matthiaskrgr commented Dec 20, 2022

Code

code from glacier, 72793.rs

#![feature(type_alias_impl_trait)]

trait T { type Item; }

type Alias<'a> = impl T<Item = &'a ()>;

struct S;
impl<'a> T for &'a S {
    type Item = &'a ();
}

fn filter_positive<'a>() -> Alias<'a> {
    &S
}

fn with_positive(fun: impl Fn(Alias<'_>)) {
    fun(filter_positive());
}

fn main() {
    with_positive(|_| ());
}

Meta

rustc --version --verbose:

rustc 1.68.0-nightly (935dc0721 2022-12-19)
binary: rustc
commit-hash: 935dc07218b4bf6e20231e44eb9263b612fd649b
commit-date: 2022-12-19
host: x86_64-unknown-linux-gnu
release: 1.68.0-nightly
LLVM version: 15.0.6

Error output

cargo miri run

<output>
Backtrace

Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/miri_ice`
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:198:90: Failed to normalize <[closure@src/main.rs:21:19: 21:22] as std::ops::FnOnce<(&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/compiler/rustc_errors/src/lib.rs:1576:9
stack backtrace:
   0:     0x7f1f3ca33a7a - std::backtrace_rs::backtrace::libunwind::trace::h06c3ddb908575635
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1f3ca33a7a - std::backtrace_rs::backtrace::trace_unsynchronized::h8bfc3753e1cc3345
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1f3ca33a7a - std::sys_common::backtrace::_print_fmt::h3c304feda98d6679
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f1f3ca33a7a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h98af9289a7a29dc2
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1f3ca967ae - core::fmt::write::h02538848739b7e2a
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f1f3ca23f45 - std::io::Write::write_fmt::h4aac2f2c3f0128af
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/io/mod.rs:1682:15
   6:     0x7f1f3ca33845 - std::sys_common::backtrace::_print::h2e2acfe71f2fdb67
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f1f3ca33845 - std::sys_common::backtrace::print::h5bf077c253fab052
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f1f3ca3658f - std::panicking::default_hook::{{closure}}::h0ceeeedebdf177d0
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/panicking.rs:267:22
   9:     0x7f1f3ca362cb - std::panicking::default_hook::h7d6f04e84940bd1d
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/panicking.rs:286:9
  10:     0x7f1f3b840511 - rustc_driver[3622bb61b1ebe64a]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f1f3ca36dcd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hc60f5ae29562b326
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/alloc/src/boxed.rs:2032:9
  12:     0x7f1f3ca36dcd - std::panicking::rust_panic_with_hook::hce0f8648dbfb386b
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/panicking.rs:692:13
  13:     0x7f1f3bce62c1 - std[688abfdbcfe52504]::panicking::begin_panic::<rustc_errors[19d12f94925af316]::ExplicitBug>::{closure#0}
  14:     0x7f1f3bce5986 - std[688abfdbcfe52504]::sys_common::backtrace::__rust_end_short_backtrace::<std[688abfdbcfe52504]::panicking::begin_panic<rustc_errors[19d12f94925af316]::ExplicitBug>::{closure#0}, !>
  15:     0x7f1f3bd414b6 - std[688abfdbcfe52504]::panicking::begin_panic::<rustc_errors[19d12f94925af316]::ExplicitBug>
  16:     0x7f1f3bce4186 - std[688abfdbcfe52504]::panic::panic_any::<rustc_errors[19d12f94925af316]::ExplicitBug>
  17:     0x7f1f3bce3006 - <rustc_errors[19d12f94925af316]::HandlerInner>::bug::<&alloc[b02cc7237b8b6455]::string::String>
  18:     0x7f1f3bce2c70 - <rustc_errors[19d12f94925af316]::Handler>::bug::<&alloc[b02cc7237b8b6455]::string::String>
  19:     0x7f1f3bdaa54e - rustc_middle[f828bfe4cd5e1a59]::ty::context::tls::with_context_opt::<rustc_middle[f828bfe4cd5e1a59]::ty::context::tls::with_opt<rustc_middle[f828bfe4cd5e1a59]::util::bug::opt_span_bug_fmt<rustc_span[ea560f4838c45ec0]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f1f3bdaa816 - rustc_middle[f828bfe4cd5e1a59]::util::bug::opt_span_bug_fmt::<rustc_span[ea560f4838c45ec0]::span_encoding::Span>
  21:     0x7f1f39aef3c3 - rustc_middle[f828bfe4cd5e1a59]::util::bug::bug_fmt
  22:     0x7f1f3993f7a4 - <rustc_middle[f828bfe4cd5e1a59]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle[f828bfe4cd5e1a59]::ty::fold::TypeFolder>::fold_ty
  23:     0x56540840eb0c - <&rustc_middle[f828bfe4cd5e1a59]::ty::list::List<rustc_middle[f828bfe4cd5e1a59]::ty::Ty> as rustc_middle[f828bfe4cd5e1a59]::ty::fold::TypeFoldable>::try_fold_with::<rustc_middle[f828bfe4cd5e1a59]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>
  24:     0x5654084d5890 - <rustc_middle[f828bfe4cd5e1a59]::ty::context::TyCtxt>::normalize_erasing_late_bound_regions::<rustc_middle[f828bfe4cd5e1a59]::ty::sty::FnSig>
  25:     0x5654084621e1 - <rustc_const_eval[60209f501fc07249]::interpret::eval_context::InterpCx<miri[df45d2962384a2a4]::machine::MiriMachine> as miri[df45d2962384a2a4]::concurrency::thread::EvalContextExt>::run_threads
  26:     0x56540850ee1d - miri[df45d2962384a2a4]::eval::eval_entry
  27:     0x56540836a0e4 - <rustc_interface[299971c75fff0058]::passes::QueryContext>::enter::<<miri[2cc0a1151e659598]::MiriCompilerCalls as rustc_driver[3622bb61b1ebe64a]::Callbacks>::after_analysis::{closure#0}, ()>
  28:     0x56540836f263 - <miri[2cc0a1151e659598]::MiriCompilerCalls as rustc_driver[3622bb61b1ebe64a]::Callbacks>::after_analysis
  29:     0x7f1f3aad1661 - <rustc_interface[299971c75fff0058]::interface::Compiler>::enter::<rustc_driver[3622bb61b1ebe64a]::run_compiler::{closure#1}::{closure#2}, core[62c015fcd585be4a]::result::Result<core[62c015fcd585be4a]::option::Option<rustc_interface[299971c75fff0058]::queries::Linker>, rustc_errors[19d12f94925af316]::ErrorGuaranteed>>
  30:     0x7f1f3aacc658 - rustc_span[ea560f4838c45ec0]::with_source_map::<core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>, rustc_interface[299971c75fff0058]::interface::run_compiler<core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>, rustc_driver[3622bb61b1ebe64a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  31:     0x7f1f3aacc145 - <scoped_tls[6f6de2f0677d8068]::ScopedKey<rustc_span[ea560f4838c45ec0]::SessionGlobals>>::set::<rustc_interface[299971c75fff0058]::interface::run_compiler<core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>, rustc_driver[3622bb61b1ebe64a]::run_compiler::{closure#1}>::{closure#0}, core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>>
  32:     0x7f1f3aacb732 - std[688abfdbcfe52504]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[299971c75fff0058]::util::run_in_thread_pool_with_globals<rustc_interface[299971c75fff0058]::interface::run_compiler<core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>, rustc_driver[3622bb61b1ebe64a]::run_compiler::{closure#1}>::{closure#0}, core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>>
  33:     0x7f1f3b103aba - <<std[688abfdbcfe52504]::thread::Builder>::spawn_unchecked_<rustc_interface[299971c75fff0058]::util::run_in_thread_pool_with_globals<rustc_interface[299971c75fff0058]::interface::run_compiler<core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>, rustc_driver[3622bb61b1ebe64a]::run_compiler::{closure#1}>::{closure#0}, core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[62c015fcd585be4a]::result::Result<(), rustc_errors[19d12f94925af316]::ErrorGuaranteed>>::{closure#1} as core[62c015fcd585be4a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f1f3ca40dc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h16c8b1a5112fc07f
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/alloc/src/boxed.rs:2000:9
  35:     0x7f1f3ca40dc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0cc5ff4fc4b4dcff
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/alloc/src/boxed.rs:2000:9
  36:     0x7f1f3ca40dc3 - std::sys::unix::thread::Thread::new::thread_start::ha7c6dff74603472f
                               at /rustc/935dc07218b4bf6e20231e44eb9263b612fd649b/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f1f383958fd - <unknown>
  38:     0x7f1f38417a60 - <unknown>
  39:                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.68.0-nightly (935dc0721 2022-12-19) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -C target-cpu=native

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
note: the place in the program where the ICE was triggered
  --> src/main.rs:17:5
   |
17 |     fun(filter_positive());
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: inside `with_positive::<[closure@src/main.rs:21:19: 21:22]>` at src/main.rs:17:5: 17:27
note: inside `main`
  --> src/main.rs:21:5
   |
21 |     with_positive(|_| ());
   |     ^^^^^^^^^^^^^^^^^^^^^
   = note: inside `<fn() as std::ops::FnOnce<()>>::call_once - shim(fn())` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:507:5: 507:71
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys_common/backtrace.rs:121:18: 121:21
   = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:166:18: 166:82
   = note: inside `std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:606:13: 606:31
   = note: inside `std::panicking::r#try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:483:40: 483:43
   = note: inside `std::panicking::r#try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:447:19: 447:81
   = note: inside `std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:137:14: 137:33
   = note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:148:48: 148:73
   = note: inside `std::panicking::r#try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:483:40: 483:43
   = note: inside `std::panicking::r#try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:447:19: 447:81
   = note: inside `std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:137:14: 137:33
   = note: inside `std::rt::lang_start_internal` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:148:20: 148:98
   = note: inside `std::rt::lang_start::<()>` at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:165:17: 170:6

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. A-miri Area: The miri tool labels Dec 20, 2022
@compiler-errors
Copy link
Member

This is just rust-lang/miri#2433, which is tracked via #104601. I'm gonna close this as a dupe.

@compiler-errors compiler-errors closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-miri Area: The miri tool 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

No branches or pull requests

2 participants