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: rustdoc: assertion failed: (left matches right) with non_lifetime_binders #108158

Closed
matthiaskrgr opened this issue Feb 17, 2023 · 1 comment · Fixed by #108335
Closed

ICE: rustdoc: assertion failed: (left matches right) with non_lifetime_binders #108158

matthiaskrgr opened this issue Feb 17, 2023 · 1 comment · Fixed by #108335
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

I tried this code:

// check-pass
// Basic test that show's we can succesfully typeck a `for<T>` where clause.

#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

trait Trait {}

impl<T: ?Sized> Trait for T {}

fn foo()
where
    for<T> T: Trait,
{
}

fn main() {
    foo();
}

Compiles with rustc but rustdoc crashes.

Meta

rustc --version --verbose:

rustdoc 1.69.0-nightly (9556b56db 2023-02-17)
binary: rustdoc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7
Backtrace

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> ./tests/ui/traits/non_lifetime_binders/basic.rs:4:12
  |
4 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #1 <https://github.com/rust-lang/rust/issues/1> for more information
  = note: `#[warn(incomplete_features)]` on by default

thread 'rustc' panicked at 'assertion failed: `(left matches right)`
  left: `GenericParam { hir_id: HirId(DefId(0:6 ~ basic[416b]::foo).4), def_id: DefId(0:7 ~ basic[416b]::foo::T), name: Plain(T#0), span: ./tests/ui/traits/non_lifetime_binders/basic.rs:13:9: 13:10 (#0), pure_wrt_drop: false, kind: Type { default: None, synthetic: false }, colon_span: None }`,
 right: `hir::GenericParam { kind: hir::GenericParamKind::Lifetime { .. }, .. }`', src/librustdoc/clean/mod.rs:275:21
stack backtrace:
   0:     0x7f703356aa5a - std::backtrace_rs::backtrace::libunwind::trace::h4f2ddf6c88dbaad9
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f703356aa5a - std::backtrace_rs::backtrace::trace_unsynchronized::h8bc6bf97c95b59de
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f703356aa5a - std::sys_common::backtrace::_print_fmt::h7219a53d43a6b866
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f703356aa5a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5010216fe7dfec74
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f70335ca9ae - core::fmt::write::h94365b6ce74f4b38
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f703355af05 - std::io::Write::write_fmt::hed6d0d7d7e9fc148
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/io/mod.rs:1684:15
   6:     0x7f703356a825 - std::sys_common::backtrace::_print::h49801225f55874b0
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f703356a825 - std::sys_common::backtrace::print::h83efbf586cd87643
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f703356d59f - std::panicking::default_hook::{{closure}}::hb2c05bd9017b98d1
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/panicking.rs:267:22
   9:     0x7f703356d2db - std::panicking::default_hook::hae948cf98c9c5f1a
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/panicking.rs:286:9
  10:     0x7f703686aa14 - rustc_driver_impl[6c2af96379bf1b3f]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f703356dddd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::he8407b3fffcc824a
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/alloc/src/boxed.rs:2002:9
  12:     0x7f703356dddd - std::panicking::rust_panic_with_hook::h447e2750afeca884
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/panicking.rs:692:13
  13:     0x7f703356db59 - std::panicking::begin_panic_handler::{{closure}}::h61457317657e95be
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/panicking.rs:579:13
  14:     0x7f703356aec6 - std::sys_common::backtrace::__rust_end_short_backtrace::ha398e4defa16c9c2
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys_common/backtrace.rs:137:18
  15:     0x7f703356d862 - rust_begin_unwind
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/panicking.rs:575:5
  16:     0x7f70335c7353 - core::panicking::panic_fmt::h907e7c558a510d58
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/core/src/panicking.rs:64:14
  17:     0x7f70335c776f - core::panicking::assert_failed_inner::h68feff5fb580fb34
  18:     0x55854c8a45f9 - core[dbff95f671937227]::panicking::assert_matches_failed::<&rustc_hir[20d2f58fe67618f5]::hir::GenericParam>
  19:     0x55854c9481c1 - <alloc[d2b9f3df75116eb6]::vec::Vec<rustdoc[d536150884bc5371]::clean::types::Lifetime> as alloc[d2b9f3df75116eb6]::vec::spec_from_iter::SpecFromIter<rustdoc[d536150884bc5371]::clean::types::Lifetime, core[dbff95f671937227]::iter::adapters::map::Map<core[dbff95f671937227]::slice::iter::Iter<rustc_hir[20d2f58fe67618f5]::hir::GenericParam>, rustdoc[d536150884bc5371]::clean::clean_where_predicate::{closure#0}>>>::from_iter
  20:     0x55854cbbd410 - rustdoc[d536150884bc5371]::clean::clean_generics
  21:     0x55854c8cab71 - rustdoc[d536150884bc5371]::clean::utils::enter_impl_trait::<rustdoc[d536150884bc5371]::clean::clean_function::{closure#0}, (rustdoc[d536150884bc5371]::clean::types::Generics, rustdoc[d536150884bc5371]::clean::types::FnDecl)>
  22:     0x55854cbc0994 - rustdoc[d536150884bc5371]::clean::clean_fn_or_proc_macro
  23:     0x55854cb38f78 - <rustdoc[d536150884bc5371]::core::DocContext>::with_param_env::<alloc[d2b9f3df75116eb6]::vec::Vec<rustdoc[d536150884bc5371]::clean::types::Item>, rustdoc[d536150884bc5371]::clean::clean_maybe_renamed_item::{closure#1}>
  24:     0x55854cbad423 - <&mut rustdoc[d536150884bc5371]::clean::clean_doc_module::{closure#2} as core[dbff95f671937227]::ops::function::FnOnce<(&(&rustc_hir[20d2f58fe67618f5]::hir::Item, core[dbff95f671937227]::option::Option<rustc_span[f167ea544e4ee22c]::symbol::Symbol>, core[dbff95f671937227]::option::Option<rustc_span[f167ea544e4ee22c]::def_id::LocalDefId>),)>>::call_once
  25:     0x55854c9393bb - <alloc[d2b9f3df75116eb6]::vec::Vec<rustdoc[d536150884bc5371]::clean::types::Item> as alloc[d2b9f3df75116eb6]::vec::spec_extend::SpecExtend<rustdoc[d536150884bc5371]::clean::types::Item, core[dbff95f671937227]::iter::adapters::flatten::FlatMap<core[dbff95f671937227]::slice::iter::Iter<(&rustc_hir[20d2f58fe67618f5]::hir::Item, core[dbff95f671937227]::option::Option<rustc_span[f167ea544e4ee22c]::symbol::Symbol>, core[dbff95f671937227]::option::Option<rustc_span[f167ea544e4ee22c]::def_id::LocalDefId>)>, alloc[d2b9f3df75116eb6]::vec::Vec<rustdoc[d536150884bc5371]::clean::types::Item>, rustdoc[d536150884bc5371]::clean::clean_doc_module::{closure#2}>>>::spec_extend
  26:     0x55854cbba96d - rustdoc[d536150884bc5371]::clean::clean_doc_module
  27:     0x55854c8c449c - rustdoc[d536150884bc5371]::clean::utils::krate
  28:     0x55854caad374 - <rustc_session[c15eaeef136f5e4a]::session::Session>::time::<rustdoc[d536150884bc5371]::clean::types::Crate, rustdoc[d536150884bc5371]::core::run_global_ctxt::{closure#4}>
  29:     0x55854cb3d3ba - rustdoc[d536150884bc5371]::core::run_global_ctxt
  30:     0x55854caad729 - <rustc_session[c15eaeef136f5e4a]::session::Session>::time::<(rustdoc[d536150884bc5371]::clean::types::Crate, rustdoc[d536150884bc5371]::config::RenderOptions, rustdoc[d536150884bc5371]::formats::cache::Cache), rustdoc[d536150884bc5371]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
  31:     0x55854c88ab87 - <rustc_middle[9f8d2e014f13ace2]::ty::context::GlobalCtxt>::enter::<rustdoc[d536150884bc5371]::main_args::{closure#1}::{closure#0}::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>
  32:     0x55854c997d20 - <rustc_interface[3f0b305400f2a575]::interface::Compiler>::enter::<rustdoc[d536150884bc5371]::main_args::{closure#1}::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>
  33:     0x55854caabf6b - rustc_span[f167ea544e4ee22c]::with_source_map::<core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>, rustc_interface[3f0b305400f2a575]::interface::run_compiler<core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>, rustdoc[d536150884bc5371]::main_args::{closure#1}>::{closure#0}::{closure#0}>
  34:     0x55854c99b9e2 - <scoped_tls[b36333e7b7cf83b9]::ScopedKey<rustc_span[f167ea544e4ee22c]::SessionGlobals>>::set::<rustc_interface[3f0b305400f2a575]::interface::run_compiler<core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>, rustdoc[d536150884bc5371]::main_args::{closure#1}>::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>
  35:     0x55854cabb810 - std[37372fc96080da93]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3f0b305400f2a575]::util::run_in_thread_pool_with_globals<rustc_interface[3f0b305400f2a575]::interface::run_compiler<core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>, rustdoc[d536150884bc5371]::main_args::{closure#1}>::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>
  36:     0x55854cb2f847 - <<std[37372fc96080da93]::thread::Builder>::spawn_unchecked_<rustc_interface[3f0b305400f2a575]::util::run_in_thread_pool_with_globals<rustc_interface[3f0b305400f2a575]::interface::run_compiler<core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>, rustdoc[d536150884bc5371]::main_args::{closure#1}>::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[dbff95f671937227]::result::Result<(), rustc_errors[26f6982c64bee1b3]::ErrorGuaranteed>>::{closure#1} as core[dbff95f671937227]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f7033577c63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6cb6b9d9103f983c
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/alloc/src/boxed.rs:1988:9
  38:     0x7f7033577c63 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h11325854ceea5259
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/alloc/src/boxed.rs:1988:9
  39:     0x7f7033577c63 - std::sys::unix::thread::Thread::new::thread_start::h5bdb2262729f1e24
                               at /rustc/9556b56dbdbd4238f0051e7230004b0aa488fa14/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7f70332b0bb5 - <unknown>
  41:     0x7f7033332d90 - <unknown>
  42:                0x0 - <unknown>

error: 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.69.0-nightly (9556b56db 2023-02-17) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
warning: 1 warning emitted

@matthiaskrgr matthiaskrgr added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. labels Feb 17, 2023
@compiler-errors compiler-errors self-assigned this Feb 17, 2023
@langston-barrett
Copy link

langston-barrett commented Mar 18, 2023

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 18, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 26, 2023
…rs-rustdoc, r=GuillaumeGomez

rustdoc + rustdoc-json support for `feature(non_lifetime_binders)`

Makes `for<T> T: Trait` and `for<const N: usize> ..` in where clause operate correctly.

Fixes rust-lang#108158
@bors bors closed this as completed in 777df02 Mar 29, 2023
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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants