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

internal compiler error: opaque type with non-universal region substs #101852

Closed
Luro02 opened this issue Sep 15, 2022 · 4 comments · Fixed by #122943
Closed

internal compiler error: opaque type with non-universal region substs #101852

Luro02 opened this issue Sep 15, 2022 · 4 comments · Fixed by #122943
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Luro02
Copy link
Contributor

Luro02 commented Sep 15, 2022

Code

pub fn ice(
    x: impl AsRef<str>,
) -> impl IntoIterator<Item = ()> {
    vec![].append(&mut ice(x.as_ref()));

    Vec::new()
}

fn main() {
}

playground

Meta

rustc --version --verbose:

rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: x86_64-pc-windows-msvc
release: 1.63.0
LLVM version: 14.0.5

This happens on latest nightly and stable.

Error output

   Compiling playground v0.0.1 (/playground)
warning: function cannot return without recursing
 --> src/main.rs:1:1
  |
1 | / pub fn ice(
2 | |     x: impl AsRef<str>,
3 | | ) -> impl IntoIterator<Item = ()> {
4 | |     vec![].append(&mut ice(x.as_ref()));
  | |                        --------------- recursive call site
5 | |
6 | |     Vec::new()
7 | | }
  | |_^ cannot return without recursing
  |
  = note: `#[warn(unconditional_recursion)]` on by default
  = help: a `loop` may express intention better if this is on purpose

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

error: internal compiler error: opaque type with non-universal region substs
 --> src/main.rs:4:5
  |
4 |     vec![].append(&mut ice(x.as_ref()));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_borrowck/src/region_infer/opaque_types.rs:81:40

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
   0:     0x7f9e5d24e18d - std::backtrace_rs::backtrace::libunwind::trace::h8217d0a8f3fd2f41
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9e5d24e18d - std::backtrace_rs::backtrace::trace_unsynchronized::h308103876b3af410
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9e5d24e18d - std::sys_common::backtrace::_print_fmt::hc208018c6153605e
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f9e5d24e18d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf89a7ed694dfb585
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f9e5d2a9f7c - core::fmt::write::h21038c1382fe4264
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/fmt/mod.rs:1197:17
   5:     0x7f9e5d23f8a1 - std::io::Write::write_fmt::h7dbb1c9a3c254aef
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/io/mod.rs:1672:15
   6:     0x7f9e5d250e55 - std::sys_common::backtrace::_print::h4e8889719c9ddeb8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f9e5d250e55 - std::sys_common::backtrace::print::h1506fe2cb3022667
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f9e5d250e55 - std::panicking::default_hook::{{closure}}::hd9d7ce2a8a782440
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:295:22
   9:     0x7f9e5d250b76 - std::panicking::default_hook::h5b16ec25444b1b5d
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:314:9
  10:     0x7f9e5da2bb54 - rustc_driver[e01eec72899701d3]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f9e5d25152a - std::panicking::rust_panic_with_hook::hb0138cb6e6fea3e4
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:702:17
  12:     0x7f9e5ebe7a91 - std[f9ee9c7d4fd68eda]::panicking::begin_panic::<rustc_errors[b2e8492a1747ee42]::ExplicitBug>::{closure#0}
  13:     0x7f9e5ebe5036 - std[f9ee9c7d4fd68eda]::sys_common::backtrace::__rust_end_short_backtrace::<std[f9ee9c7d4fd68eda]::panicking::begin_panic<rustc_errors[b2e8492a1747ee42]::ExplicitBug>::{closure#0}, !>
  14:     0x7f9e5ebf4806 - std[f9ee9c7d4fd68eda]::panicking::begin_panic::<rustc_errors[b2e8492a1747ee42]::ExplicitBug>
  15:     0x7f9e5ebf1ad6 - std[f9ee9c7d4fd68eda]::panic::panic_any::<rustc_errors[b2e8492a1747ee42]::ExplicitBug>
  16:     0x7f9e604abcec - <rustc_errors[b2e8492a1747ee42]::HandlerInner as core[3edb0f9afb6adb32]::ops::drop::Drop>::drop
  17:     0x7f9e5fbd6348 - core[3edb0f9afb6adb32]::ptr::drop_in_place::<rustc_session[72c90254a58d88d1]::parse::ParseSess>
  18:     0x7f9e5fbd92e3 - <alloc[59e4fb8ddcfb913c]::rc::Rc<rustc_session[72c90254a58d88d1]::session::Session> as core[3edb0f9afb6adb32]::ops::drop::Drop>::drop
  19:     0x7f9e5fbd86bd - core[3edb0f9afb6adb32]::ptr::drop_in_place::<rustc_interface[be6c6c80f2cd8cf2]::interface::Compiler>
  20:     0x7f9e5fbd5c54 - rustc_span[fb9cf5df1e5e5539]::with_source_map::<core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>, rustc_interface[be6c6c80f2cd8cf2]::interface::create_compiler_and_run<core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>, rustc_driver[e01eec72899701d3]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7f9e5fbdd302 - <scoped_tls[134a193f706323ee]::ScopedKey<rustc_span[fb9cf5df1e5e5539]::SessionGlobals>>::set::<rustc_interface[be6c6c80f2cd8cf2]::interface::run_compiler<core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>, rustc_driver[e01eec72899701d3]::run_compiler::{closure#1}>::{closure#0}, core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>>
  22:     0x7f9e5fc0099f - std[f9ee9c7d4fd68eda]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[be6c6c80f2cd8cf2]::util::run_in_thread_pool_with_globals<rustc_interface[be6c6c80f2cd8cf2]::interface::run_compiler<core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>, rustc_driver[e01eec72899701d3]::run_compiler::{closure#1}>::{closure#0}, core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>>::{closure#0}, core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>>
  23:     0x7f9e5fbf2529 - <<std[f9ee9c7d4fd68eda]::thread::Builder>::spawn_unchecked_<rustc_interface[be6c6c80f2cd8cf2]::util::run_in_thread_pool_with_globals<rustc_interface[be6c6c80f2cd8cf2]::interface::run_compiler<core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>, rustc_driver[e01eec72899701d3]::run_compiler::{closure#1}>::{closure#0}, core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>>::{closure#0}, core[3edb0f9afb6adb32]::result::Result<(), rustc_errors[b2e8492a1747ee42]::ErrorGuaranteed>>::{closure#1} as core[3edb0f9afb6adb32]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  24:     0x7f9e5d25b463 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1680342795a2dc08
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/alloc/src/boxed.rs:1951:9
  25:     0x7f9e5d25b463 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h45204a69827b0e83
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/alloc/src/boxed.rs:1951:9
  26:     0x7f9e5d25b463 - std::sys::unix::thread::Thread::new::thread_start::h5d4e11bbda4161c8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys/unix/thread.rs:108:17
  27:     0x7f9e5d181609 - start_thread
  28:     0x7f9e5d0a4133 - clone
  29:                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.63.0 (4b91a6ea7 2022-08-08) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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` (bin "playground") generated 1 warning
error: could not compile `playground`; 1 warning emitted
Backtrace

   Compiling playground v0.0.1 (/playground)
warning: function cannot return without recursing
 --> src/main.rs:1:1
  |
1 | / pub fn ice(
2 | |     x: impl AsRef<str>,
3 | | ) -> impl IntoIterator<Item = ()> {
4 | |     vec![].append(&mut ice(x.as_ref()));
  | |                        --------------- recursive call site
5 | |
6 | |     Vec::new()
7 | | }
  | |_^ cannot return without recursing
  |
  = note: `#[warn(unconditional_recursion)]` on by default
  = help: a `loop` may express intention better if this is on purpose

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

error: internal compiler error: opaque type with non-universal region substs
 --> src/main.rs:4:5
  |
4 |     vec![].append(&mut ice(x.as_ref()));
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_borrowck/src/region_infer/opaque_types.rs:81:40

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: std::panic::panic_any::<rustc_errors::ExplicitBug>
   2: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
   3: core::ptr::drop_in_place::<rustc_session::parse::ParseSess>
   4: <alloc::rc::Rc<rustc_session::session::Session> as core::ops::drop::Drop>::drop
   5: core::ptr::drop_in_place::<rustc_interface::interface::Compiler>
   6: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
   7: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.63.0 (4b91a6ea7 2022-08-08) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -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` (bin "playground") generated 1 warning
error: could not compile `playground`; 1 warning emitted

@Luro02 Luro02 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 Sep 15, 2022
@lqd
Copy link
Member

lqd commented Sep 15, 2022

This regressed in nightly-2022-03-31, and out of these:

@oli-obk's #94081 lazy taits looks a likely cause for the ICE ?

@oli-obk oli-obk self-assigned this Sep 15, 2022
@lqd
Copy link
Member

lqd commented Sep 15, 2022

This ICEs on stable since 1.61 so the correct label is regression-from-stable-to-stable, right ?

I'll mark it untriaged, so people can correct me.

@lqd lqd added the regression-untriaged Untriaged performance or correctness regression. label Sep 15, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 15, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Sep 16, 2022

This went from an error

error[E0308]: mismatched types
 --> <source>:4:19
  |
3 | ) -> impl IntoIterator<Item = ()> {
  |      ---------------------------- the found opaque type
4 |     vec![].append(&mut ice(x.as_ref()));
  |                   ^^^^^^^^^^^^^^^^^^^^ expected struct `Vec`, found opaque type
  |
  = note: expected mutable reference `&mut Vec<_>`
             found mutable reference `&mut impl IntoIterator<Item = ()>`

to an ICE in 1.61 yes

@oli-obk oli-obk added A-diagnostics Area: Messages for errors, warnings, and lints P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 16, 2022
@oli-obk oli-obk removed their assignment Sep 16, 2022
@inquisitivecrystal inquisitivecrystal added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. and removed regression-untriaged Untriaged performance or correctness regression. labels Sep 23, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Sep 23, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 1, 2022
@JohnTitor
Copy link
Member

Fixed on the latest nightly, marking as E-needs-test (or, feel free to close if we have a sufficient regression test)
@rustbot labels: +E-needs-test

@rustbot rustbot added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 15, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 23, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 23, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 24, 2024
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Mar 24, 2024
@bors bors closed this as completed in 2f9a240 Mar 24, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 24, 2024
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease

add a couple more ice tests

Fixes rust-lang#104779
Fixes rust-lang#106423
Fixes rust-lang#106444
Fixes rust-lang#101852
Fixes rust-lang#106874
Fixes rust-lang#105047
Fixes rust-lang#107228
Fixes rust-lang#99945
RenjiSann pushed a commit to RenjiSann/rust that referenced this issue Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
7 participants