Skip to content

ICE on nested RPIT: cannot prove CoerceUnsized predicate #99642

Closed
@aliemjay

Description

@aliemjay

Code

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=b8de6af93ef2a54292829ffbc9cbea25

fn test() -> impl Iterator<Item = impl Sized> {
    Box::new(0..) as Box<dyn Iterator<Item = _>>
}

Regressed between (263edd4 2022-07-17) .. (62b272d 2022-07-21). Probably #99495. Cc @oli-obk.

Edit: Regressed in #99506

Minimized from HFQR/xitca-web. Cc @fakeshadow.

@rustbot label regression-from-stable-to-nightly A-impl-trait

Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DefId(0:3 ~ playground[5412]::test) (NoSolution): could not prove Binder(TraitPredicate(<std::boxed::Box<std::ops::RangeFrom<i32>> as std::ops::CoerceUnsized<std::boxed::Box<dyn std::iter::Iterator<Item = impl Sized>>>>, polarity:Positive), [])
 --> src/lib.rs:2:5
  |
2 |     Box::new(0..) as Box<dyn Iterator<Item = _>>
  |     ^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/canonical.rs:151:13

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1426:13
stack backtrace:
   0:     0x7f9723d958a0 - std::backtrace_rs::backtrace::libunwind::trace::h9ae2a0a86525a721
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f9723d958a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2db65d70ea604a8b
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9723d958a0 - std::sys_common::backtrace::_print_fmt::ha87108be4ced4d7b
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f9723d958a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8289c789e2444f52
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9723deee7c - core::fmt::write::h4bc61850e148256a
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/core/src/fmt/mod.rs:1198:17
   5:     0x7f9723d86ea5 - std::io::Write::write_fmt::h39fafbe9deae7dce
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/io/mod.rs:1672:15
   6:     0x7f9723d98531 - std::sys_common::backtrace::_print::h48b22fe50876db47
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9723d98531 - std::sys_common::backtrace::print::h4deb0c8c0ba6e812
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9723d98531 - std::panicking::default_hook::{{closure}}::hec18832ee0d2183c
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/panicking.rs:295:22
   9:     0x7f9723d98203 - std::panicking::default_hook::h6fd5dc4e9c4f675e
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/panicking.rs:314:9
  10:     0x7f97245c7af1 - rustc_driver[c212bfd01fb1bd4e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9723d98d06 - std::panicking::rust_panic_with_hook::hb4a45181e5abcce3
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/panicking.rs:702:17
  12:     0x7f972577ec11 - std[c85d7afaac2a6227]::panicking::begin_panic::<rustc_errors[4d7b9c19931775fa]::ExplicitBug>::{closure#0}
  13:     0x7f972577e9a6 - std[c85d7afaac2a6227]::sys_common::backtrace::__rust_end_short_backtrace::<std[c85d7afaac2a6227]::panicking::begin_panic<rustc_errors[4d7b9c19931775fa]::ExplicitBug>::{closure#0}, !>
  14:     0x7f97257788c6 - std[c85d7afaac2a6227]::panicking::begin_panic::<rustc_errors[4d7b9c19931775fa]::ExplicitBug>
  15:     0x7f972577bad6 - std[c85d7afaac2a6227]::panic::panic_any::<rustc_errors[4d7b9c19931775fa]::ExplicitBug>
  16:     0x7f972705c0e3 - <rustc_errors[4d7b9c19931775fa]::HandlerInner as core[c7b8860b6e72b2f6]::ops::drop::Drop>::drop
  17:     0x7f9726788ff8 - core[c7b8860b6e72b2f6]::ptr::drop_in_place::<rustc_session[7be89286315efa93]::parse::ParseSess>
  18:     0x7f972678b523 - <alloc[2307dd647311a06c]::rc::Rc<rustc_session[7be89286315efa93]::session::Session> as core[c7b8860b6e72b2f6]::ops::drop::Drop>::drop
  19:     0x7f972676d7ed - core[c7b8860b6e72b2f6]::ptr::drop_in_place::<rustc_interface[e455626695b2bf4c]::interface::Compiler>
  20:     0x7f972676b974 - rustc_span[bd4aa58f7c6f9add]::with_source_map::<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_interface[e455626695b2bf4c]::interface::create_compiler_and_run<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_driver[c212bfd01fb1bd4e]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f9726787e50 - rustc_interface[e455626695b2bf4c]::interface::create_compiler_and_run::<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_driver[c212bfd01fb1bd4e]::run_compiler::{closure#1}>
  22:     0x7f972679be22 - <scoped_tls[ae38fa8e7a890916]::ScopedKey<rustc_span[bd4aa58f7c6f9add]::SessionGlobals>>::set::<rustc_interface[e455626695b2bf4c]::interface::run_compiler<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_driver[c212bfd01fb1bd4e]::run_compiler::{closure#1}>::{closure#0}, core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>>
  23:     0x7f972676dcef - std[c85d7afaac2a6227]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e455626695b2bf4c]::util::run_in_thread_pool_with_globals<rustc_interface[e455626695b2bf4c]::interface::run_compiler<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_driver[c212bfd01fb1bd4e]::run_compiler::{closure#1}>::{closure#0}, core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>>::{closure#0}, core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>>
  24:     0x7f97267882a9 - <<std[c85d7afaac2a6227]::thread::Builder>::spawn_unchecked_<rustc_interface[e455626695b2bf4c]::util::run_in_thread_pool_with_globals<rustc_interface[e455626695b2bf4c]::interface::run_compiler<core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>, rustc_driver[c212bfd01fb1bd4e]::run_compiler::{closure#1}>::{closure#0}, core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>>::{closure#0}, core[c7b8860b6e72b2f6]::result::Result<(), rustc_errors[4d7b9c19931775fa]::ErrorGuaranteed>>::{closure#1} as core[c7b8860b6e72b2f6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7f9723da2753 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h713f45ba125dd07b
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/alloc/src/boxed.rs:1935:9
  26:     0x7f9723da2753 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5469f4a0b2b35b34
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/alloc/src/boxed.rs:1935:9
  27:     0x7f9723da2753 - std::sys::unix::thread::Thread::new::thread_start::h81d52548323558fa
                               at /rustc/848090dcd18553b790461132ca9d2a020aeea9a2/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7f9723cc4609 - start_thread
  29:     0x7f9723be7133 - clone
  30:                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 (848090dcd 2022-07-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground`; 1 warning emitted

Metadata

Metadata

Assignees

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions