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 using impl ?Sized in return position #97226

Closed
asquared31415 opened this issue May 20, 2022 · 4 comments · Fixed by #97431
Closed

ICE using impl ?Sized in return position #97226

asquared31415 opened this issue May 20, 2022 · 4 comments · Fixed by #97431
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

@asquared31415
Copy link
Contributor

asquared31415 commented May 20, 2022

Code

#[allow(dead_code)]
fn uwu() -> impl ?Sized {}

Playground

Meta

Error occurs on
Stable 1.61.0
Beta 1.62.0-beta.2
Nightly 2022-05-19

Error output

Backtrace

   Compiling playground v0.0.1 (/playground)
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in DefId(0:3 ~ playground[f439]::uwu) (NoSolution): could not prove Binder(TraitPredicate(<impl ?Sized as std::marker::Sized>, polarity:Positive), [])
 --> src/lib.rs:2:25
  |
2 | fn uwu() -> impl ?Sized {}
  |                         ^^
  |
  = note: delayed at compiler/rustc_borrowck/src/type_check/canonical.rs:149:13

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1309:13
stack backtrace:
   0:     0x7fa0b5b141cd - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fa0b5b141cd - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa0b5b141cd - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fa0b5b141cd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fa0b5b6e01c - core::fmt::write::hba4337c43d992f49
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0x7fa0b5b057c1 - std::io::Write::write_fmt::heb73de6e02cfabed
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0x7fa0b5b172b5 - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fa0b5b172b5 - std::sys_common::backtrace::print::h426700d6240cdcc2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fa0b5b172b5 - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0x7fa0b5b16f69 - std::panicking::default_hook::h2e88d02087fae196
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0x7fa0b62941d1 - rustc_driver[413d55b6344850e3]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fa0b5b17a00 - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  12:     0x7fa0b7364141 - std[3b302b3c9093c22]::panicking::begin_panic::<rustc_errors[a7dbbf867eaca825]::ExplicitBug>::{closure#0}
  13:     0x7fa0b7363e96 - std[3b302b3c9093c22]::sys_common::backtrace::__rust_end_short_backtrace::<std[3b302b3c9093c22]::panicking::begin_panic<rustc_errors[a7dbbf867eaca825]::ExplicitBug>::{closure#0}, !>
  14:     0x7fa0b736b406 - std[3b302b3c9093c22]::panicking::begin_panic::<rustc_errors[a7dbbf867eaca825]::ExplicitBug>
  15:     0x7fa0b7377ec6 - std[3b302b3c9093c22]::panic::panic_any::<rustc_errors[a7dbbf867eaca825]::ExplicitBug>
  16:     0x7fa0b8a5613a - <rustc_errors[a7dbbf867eaca825]::HandlerInner as core[a3420257622cd381]::ops::drop::Drop>::drop
  17:     0x7fa0b8172f38 - core[a3420257622cd381]::ptr::drop_in_place::<rustc_session[8df92abe178df33c]::parse::ParseSess>
  18:     0x7fa0b81763f3 - <alloc[59b4cdf2bf51ef42]::rc::Rc<rustc_session[8df92abe178df33c]::session::Session> as core[a3420257622cd381]::ops::drop::Drop>::drop
  19:     0x7fa0b815cb9d - core[a3420257622cd381]::ptr::drop_in_place::<rustc_interface[550884b2b179878f]::interface::Compiler>
  20:     0x7fa0b815c215 - rustc_span[7238ca7210ca999e]::with_source_map::<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_interface[550884b2b179878f]::interface::create_compiler_and_run<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7fa0b81780a4 - rustc_interface[550884b2b179878f]::interface::create_compiler_and_run::<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>
  22:     0x7fa0b815a7c2 - <scoped_tls[7ed3ce20ede545d8]::ScopedKey<rustc_span[7238ca7210ca999e]::SessionGlobals>>::set::<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>
  23:     0x7fa0b817038f - std[3b302b3c9093c22]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[550884b2b179878f]::util::run_in_thread_pool_with_globals<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>
  24:     0x7fa0b815baf9 - <<std[3b302b3c9093c22]::thread::Builder>::spawn_unchecked_<rustc_interface[550884b2b179878f]::util::run_in_thread_pool_with_globals<rustc_interface[550884b2b179878f]::interface::run_compiler<core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>, rustc_driver[413d55b6344850e3]::run_compiler::{closure#1}>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#0}, core[a3420257622cd381]::result::Result<(), rustc_errors[a7dbbf867eaca825]::ErrorGuaranteed>>::{closure#1} as core[a3420257622cd381]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7fa0b5b21bf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha99802c2c52ada61
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861:9
  26:     0x7fa0b5b21bf3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha39aea1c57e28a15
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/boxed.rs:1861:9
  27:     0x7fa0b5b21bf3 - std::sys::unix::thread::Thread::new::thread_start::h9f8e3d72b1f7662f
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7fa0b5a51609 - start_thread
  29:     0x7fa0b596a133 - 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.61.0 (fe5b13d68 2022-05-18) 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
error: could not compile `playground`

@asquared31415 asquared31415 added 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. labels May 20, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue May 21, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label May 22, 2022
@compiler-errors
Copy link
Member

compiler-errors commented May 26, 2022

This regressed between 1.60 -> 1.61 from an error to an ICE.

I will run a bisect in a few hours, but I encourage anyone to do it sooner. Edit: Running bisect now.

@compiler-errors
Copy link
Member

searched nightlies: from nightly-2022-01-15 to nightly-2022-05-22
regressed nightly: nightly-2022-04-30
searched commit range: e85edd9...a707f40
regressed commit: 87937d3

bisected with cargo-bisect-rustc v0.6.2

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2022-01-15 --end=2022-05-22 --regress=ice 

cc @oli-obk, this regressed in #96516.

compiler-errors added a commit to compiler-errors/rust that referenced this issue May 30, 2022
don't do `Sized` and other return type checks on RPIT's real type

Fixes an ICE where we're doing `Sized` check against the RPIT's real type, instead of against the opaque type. This differs from what we're doing in MIR typeck, which causes ICE rust-lang#97226.

This regressed in rust-lang#96516 -- this adjusts that fix to be a bit more conservative. That PR was backported and thus the ICE is also present in stable. Not sure if it's worth to beta and/or stable backport, probably not the latter but I could believe the former.

r? `@oli-obk`

cc: another attempt to fix this ICE rust-lang#97413. I believe this PR addresses the root cause.
@Alexendoo
Copy link
Member

Fixed by #97431

@compiler-errors
Copy link
Member

compiler-errors commented Jun 1, 2022

This is a regression on stable and beta, reopening until backport is settled.

ehuss pushed a commit to ehuss/rust that referenced this issue Jun 24, 2022
don't do `Sized` and other return type checks on RPIT's real type

Fixes an ICE where we're doing `Sized` check against the RPIT's real type, instead of against the opaque type. This differs from what we're doing in MIR typeck, which causes ICE rust-lang#97226.

This regressed in rust-lang#96516 -- this adjusts that fix to be a bit more conservative. That PR was backported and thus the ICE is also present in stable. Not sure if it's worth to beta and/or stable backport, probably not the latter but I could believe the former.

r? `@oli-obk`

cc: another attempt to fix this ICE rust-lang#97413. I believe this PR addresses the root cause.
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
4 participants