Closed
Description
code from rustc ./src/test/ui/type-alias-impl-trait/issue-72793.rs
// check-pass
// compile-flags: -Zmir-opt-level=3
#![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(|_| ());
}
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri target/miri/x86_64-unknown-linux-gnu/debug/m`
error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:199:90: Failed to normalize <[closure@src/main.rs:24:19: 24:22] as std::ops::FnOnce<(&S,)>>::Output, maybe try to call `try_normalize_erasing_regions` instead
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/compiler/rustc_errors/src/lib.rs:1392:9
stack backtrace:
0: 0x7f7fc64a37a0 - std::backtrace_rs::backtrace::libunwind::trace::h763ecd2b1c94eb47
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f7fc64a37a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h7346e33da5e91dc9
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f7fc64a37a0 - std::sys_common::backtrace::_print_fmt::h8ca9befc16375e7f
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f7fc64a37a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h35a76e8acc949815
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f7fc64fda2c - core::fmt::write::h1966177bbb3b1b76
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/core/src/fmt/mod.rs:1198:17
5: 0x7f7fc6494f85 - std::io::Write::write_fmt::he17142a652adbfaa
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/io/mod.rs:1672:15
6: 0x7f7fc64a6471 - std::sys_common::backtrace::_print::h58fd682547bc6ff7
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f7fc64a6471 - std::sys_common::backtrace::print::hb71ddfedfd79ba3f
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f7fc64a6471 - std::panicking::default_hook::{{closure}}::h866ffdcbb9391663
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/panicking.rs:295:22
9: 0x7f7fc64a6143 - std::panicking::default_hook::hc53d610bee87e7b5
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/panicking.rs:314:9
10: 0x7f7fc6d53731 - rustc_driver[ee492072531d29b9]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f7fc64a6c46 - std::panicking::rust_panic_with_hook::h1f2457f8494b1ce0
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/panicking.rs:702:17
12: 0x7f7fc7dbfb31 - std[af12de6c3337c1b7]::panicking::begin_panic::<rustc_errors[30e8870fe27fb8ba]::ExplicitBug>::{closure#0}
13: 0x7f7fc7dbee66 - std[af12de6c3337c1b7]::sys_common::backtrace::__rust_end_short_backtrace::<std[af12de6c3337c1b7]::panicking::begin_panic<rustc_errors[30e8870fe27fb8ba]::ExplicitBug>::{closure#0}, !>
14: 0x7f7fc7d9cdd6 - std[af12de6c3337c1b7]::panicking::begin_panic::<rustc_errors[30e8870fe27fb8ba]::ExplicitBug>
15: 0x7f7fc7d59ea6 - std[af12de6c3337c1b7]::panic::panic_any::<rustc_errors[30e8870fe27fb8ba]::ExplicitBug>
16: 0x7f7fc7d55755 - <rustc_errors[30e8870fe27fb8ba]::HandlerInner>::bug::<&alloc[327c298d5f7f3986]::string::String>
17: 0x7f7fc7d554b0 - <rustc_errors[30e8870fe27fb8ba]::Handler>::bug::<&alloc[327c298d5f7f3986]::string::String>
18: 0x7f7fc7e142ad - rustc_middle[ba567b0c63397382]::ty::context::tls::with_context_opt::<rustc_middle[ba567b0c63397382]::ty::context::tls::with_opt<rustc_middle[ba567b0c63397382]::util::bug::opt_span_bug_fmt<rustc_span[e8a062c38fd06fcf]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
19: 0x7f7fc7e1a2b6 - rustc_middle[ba567b0c63397382]::util::bug::opt_span_bug_fmt::<rustc_span[e8a062c38fd06fcf]::span_encoding::Span>
20: 0x7f7fc7e1a233 - rustc_middle[ba567b0c63397382]::util::bug::bug_fmt
21: 0x7f7fc8d7daa7 - <rustc_middle[ba567b0c63397382]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder as rustc_middle[ba567b0c63397382]::ty::fold::TypeFolder>::fold_ty
22: 0x5623e49ee3c1 - rustc_middle[ba567b0c63397382]::ty::util::fold_list::<rustc_middle[ba567b0c63397382]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder, rustc_middle[ba567b0c63397382]::ty::Ty, <&rustc_middle[ba567b0c63397382]::ty::list::List<rustc_middle[ba567b0c63397382]::ty::Ty> as rustc_middle[ba567b0c63397382]::ty::fold::TypeFoldable>::try_fold_with<rustc_middle[ba567b0c63397382]::ty::normalize_erasing_regions::NormalizeAfterErasingRegionsFolder>::{closure#0}>
23: 0x5623e48f7af0 - <rustc_middle[ba567b0c63397382]::ty::context::TyCtxt>::normalize_erasing_late_bound_regions::<rustc_middle[ba567b0c63397382]::ty::sty::FnSig>
24: 0x5623e495d99f - <rustc_const_eval[fabfa6a4d198841f]::interpret::eval_context::InterpCx<miri[ab945d3d15ab0ad0]::machine::Evaluator>>::terminator
25: 0x5623e4933c3d - <core[7b47b893e00d8dca]::panic::unwind_safe::AssertUnwindSafe<miri[ab945d3d15ab0ad0]::eval::eval_entry::{closure#0}> as core[7b47b893e00d8dca]::ops::function::FnOnce<()>>::call_once
26: 0x5623e4912e6c - miri[ab945d3d15ab0ad0]::eval::eval_entry
27: 0x5623e4867c89 - <rustc_interface[c2045ebdcb88575c]::passes::QueryContext>::enter::<<miri[a2bdd18a035b3443]::MiriCompilerCalls as rustc_driver[ee492072531d29b9]::Callbacks>::after_analysis::{closure#0}, ()>
28: 0x5623e486c653 - <miri[a2bdd18a035b3443]::MiriCompilerCalls as rustc_driver[ee492072531d29b9]::Callbacks>::after_analysis
29: 0x7f7fc8f06c8b - <rustc_interface[c2045ebdcb88575c]::interface::Compiler>::enter::<rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}::{closure#2}, core[7b47b893e00d8dca]::result::Result<core[7b47b893e00d8dca]::option::Option<rustc_interface[c2045ebdcb88575c]::queries::Linker>, rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>
30: 0x7f7fc8f02f3a - rustc_span[e8a062c38fd06fcf]::with_source_map::<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_interface[c2045ebdcb88575c]::interface::create_compiler_and_run<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}>::{closure#1}>
31: 0x7f7fc8f1f360 - rustc_interface[c2045ebdcb88575c]::interface::create_compiler_and_run::<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}>
32: 0x7f7fc8f33362 - <scoped_tls[7afe57960397b723]::ScopedKey<rustc_span[e8a062c38fd06fcf]::SessionGlobals>>::set::<rustc_interface[c2045ebdcb88575c]::interface::run_compiler<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}>::{closure#0}, core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>
33: 0x7f7fc8f0532f - std[af12de6c3337c1b7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c2045ebdcb88575c]::util::run_in_thread_pool_with_globals<rustc_interface[c2045ebdcb88575c]::interface::run_compiler<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}>::{closure#0}, core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>::{closure#0}, core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>
34: 0x7f7fc8f1f7b9 - <<std[af12de6c3337c1b7]::thread::Builder>::spawn_unchecked_<rustc_interface[c2045ebdcb88575c]::util::run_in_thread_pool_with_globals<rustc_interface[c2045ebdcb88575c]::interface::run_compiler<core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>, rustc_driver[ee492072531d29b9]::run_compiler::{closure#1}>::{closure#0}, core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>::{closure#0}, core[7b47b893e00d8dca]::result::Result<(), rustc_errors[30e8870fe27fb8ba]::ErrorGuaranteed>>::{closure#1} as core[7b47b893e00d8dca]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
35: 0x7f7fc64b0693 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2535c4f17d1ae00a
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/alloc/src/boxed.rs:1935:9
36: 0x7f7fc64b0693 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9555fa64d2fdcc1f
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/alloc/src/boxed.rs:1935:9
37: 0x7f7fc64b0693 - std::sys::unix::thread::Thread::new::thread_start::hcd4b7b87c76163e2
at /rustc/93ffde6f04d3d24327a4e17a2a2bf4f63c246235/library/std/src/sys/unix/thread.rs:108:17
38: 0x7f7fc619954d - <unknown>
39: 0x7f7fc621e874 - clone
40: 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.64.0-nightly (93ffde6f0 2022-07-23) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental -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:20:5
|
20 | fun(filter_positive());
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: inside `with_positive::<[closure@src/main.rs:24:19: 24:22]>` at src/main.rs:20:5
note: inside `main` at src/main.rs:24:5
--> src/main.rs:24:5
|
24 | 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:248:5
= 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:122:18
= note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:145:18
= 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:280:13
= 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:492:40
= 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:456:19
= 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
= note: inside closure at /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:128:48
= 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:492:40
= 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:456:19
= 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
= 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:128:20
= 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:144:17
error: aborting due to previous error
This has been fixed on the rustc side, why does this crash with miri now? 🤔
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment