Skip to content

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

Closed
@Luro02

Description

@Luro02
Contributor

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

Activity

added
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.
on Sep 15, 2022
lqd

lqd commented on Sep 15, 2022

@lqd
Member

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

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

self-assigned this
on Sep 15, 2022
lqd

lqd commented on Sep 15, 2022

@lqd
Member

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.

added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Sep 15, 2022
oli-obk

oli-obk commented on Sep 16, 2022

@oli-obk
Contributor

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

moved this to Can do after stabilization in type alias impl trait stabilizationon Sep 16, 2022
added
A-diagnosticsArea: Messages for errors, warnings, and lints
P-lowLow priority
and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Sep 16, 2022
removed their assignment
on Sep 16, 2022

22 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @lqd@oli-obk@inquisitivecrystal@Luro02@JohnTitor

      Issue actions

        internal compiler error: opaque type with non-universal region substs · Issue #101852 · rust-lang/rust