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

rustdoc: ice: unable to fulfill trait #105404

Closed
matthiaskrgr opened this issue Dec 7, 2022 · 1 comment · Fixed by #105457
Closed

rustdoc: ice: unable to fulfill trait #105404

matthiaskrgr opened this issue Dec 7, 2022 · 1 comment · Fixed by #105457
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

struct Foo<'a, 'b, T> {
    field1: dyn Bar<'a, 'b, >
}

trait Bar<'x, 's, U>
    where U: 'x,
    Self:'x,
    Self:'s
{}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.67.0-nightly (e1d819583 2022-12-05)
binary: rustc
commit-hash: e1d819583f0bf13b016b119c1c2c43e6d3979450
commit-date: 2022-12-05
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
LLVM version: 15.0.4

Error output

error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied
 --> 3c7a22d440d7586a3e549c35827ad5805e535744.rs:2:17
  |
2 |     field1: dyn Bar<'a, 'b, >
  |                 ^^^ expected 1 generic argument
  |
note: trait defined here, with 1 generic parameter: `U`
 --> 3c7a22d440d7586a3e549c35827ad5805e535744.rs:5:7
  |
5 | trait Bar<'x, 's, U>
  |       ^^^         -
help: add missing generic argument
  |
2 |     field1: dyn Bar<'a, 'b, U, >
  |                           +++

error[E0227]: ambiguous lifetime bound, explicit lifetime bound required
 --> 3c7a22d440d7586a3e549c35827ad5805e535744.rs:2:13
  |
2 |     field1: dyn Bar<'a, 'b, >
  |             ^^^^^^^^^^^^^^^^^
Backtrace

thread 'rustc' panicked at 'Unable to fulfill trait DefId(2:2645 ~ core[20f2]::marker::Send) for 'Foo<'a, 'b, T>': [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<(dyn Bar<'a, 'b, [type error]> + 'b) as std::marker::Send>, polarity:Positive), []), depth=1),Ambiguity)]', /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/compiler/rustc_trait_selection/src/traits/auto_trait.rs:186:13
stack backtrace:
   0:     0x7f3c191662da - std::backtrace_rs::backtrace::libunwind::trace::h6fe28ad196a3e4ed
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3c191662da - std::backtrace_rs::backtrace::trace_unsynchronized::hdad13e56b75cb767
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3c191662da - std::sys_common::backtrace::_print_fmt::h72698cd49f57f169
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3c191662da - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he1fafb2965ae8597
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3c191c8ece - core::fmt::write::hd89239c1da17525f
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f3c19156795 - std::io::Write::write_fmt::hab2ba8c4cc7c81ad
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/io/mod.rs:1682:15
   6:     0x7f3c191660a5 - std::sys_common::backtrace::_print::h06824445c27eddc7
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f3c191660a5 - std::sys_common::backtrace::print::h26084488db770bf5
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f3c19168def - std::panicking::default_hook::{{closure}}::h28bd5d5e965e5d01
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/panicking.rs:267:22
   9:     0x7f3c19168b2b - std::panicking::default_hook::h0619f06d194d8c45
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/panicking.rs:286:9
  10:     0x7f3c1916960c - std::panicking::rust_panic_with_hook::h3e553e07d5fd01e7
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/panicking.rs:688:13
  11:     0x7f3c191693a9 - std::panicking::begin_panic_handler::{{closure}}::ha64b2b2abb6ffa74
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/panicking.rs:579:13
  12:     0x7f3c1916678c - std::sys_common::backtrace::__rust_end_short_backtrace::h0ed3e558b8469848
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7f3c191690b2 - rust_begin_unwind
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/panicking.rs:575:5
  14:     0x7f3c191c58b3 - core::panicking::panic_fmt::h0000e7abdb8aa8da
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/core/src/panicking.rs:64:14
  15:     0x561e7e25c7a4 - <rustc_trait_selection[15c87c01405d530d]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[4d62e6a838d5304]::clean::types::Generics, <rustdoc[4d62e6a838d5304]::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  16:     0x561e7dfec2c3 - <rustdoc[4d62e6a838d5304]::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  17:     0x561e7e0a23e7 - <alloc[9916749a77d582e4]::vec::Vec<rustdoc[4d62e6a838d5304]::clean::types::Item> as alloc[9916749a77d582e4]::vec::spec_from_iter::SpecFromIter<rustdoc[4d62e6a838d5304]::clean::types::Item, core[20f247eb21f65857]::iter::adapters::filter_map::FilterMap<alloc[9916749a77d582e4]::vec::into_iter::IntoIter<rustc_span[fcb1f4a96315ac3a]::def_id::DefId>, <rustdoc[4d62e6a838d5304]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls::{closure#0}>>>::from_iter
  18:     0x561e7dfecf9e - <rustdoc[4d62e6a838d5304]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls
  19:     0x561e7e133c25 - rustdoc[4d62e6a838d5304]::clean::utils::get_auto_trait_and_blanket_impls
  20:     0x561e7e213462 - <rustdoc[4d62e6a838d5304]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[4d62e6a838d5304]::visit::DocVisitor>::visit_item
  21:     0x561e7e2135aa - <rustdoc[4d62e6a838d5304]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[4d62e6a838d5304]::visit::DocVisitor>::visit_item
  22:     0x561e7e210777 - rustdoc[4d62e6a838d5304]::passes::collect_trait_impls::collect_trait_impls
  23:     0x561e7e1e78ae - <rustc_session[b65adb5ed222d526]::session::Session>::time::<rustdoc[4d62e6a838d5304]::clean::types::Crate, rustdoc[4d62e6a838d5304]::core::run_global_ctxt::{closure#7}>
  24:     0x561e7e17a650 - rustdoc[4d62e6a838d5304]::core::run_global_ctxt
  25:     0x561e7e1e7b7c - <rustc_session[b65adb5ed222d526]::session::Session>::time::<(rustdoc[4d62e6a838d5304]::clean::types::Crate, rustdoc[4d62e6a838d5304]::config::RenderOptions, rustdoc[4d62e6a838d5304]::formats::cache::Cache), rustdoc[4d62e6a838d5304]::main_args::{closure#1}::{closure#0}::{closure#1}::{closure#0}>
  26:     0x561e7e25a26f - <rustc_interface[2984e52930de60b0]::passes::QueryContext>::enter::<rustdoc[4d62e6a838d5304]::main_args::{closure#1}::{closure#0}::{closure#1}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>
  27:     0x561e7e0e9baa - <rustc_interface[2984e52930de60b0]::interface::Compiler>::enter::<rustdoc[4d62e6a838d5304]::main_args::{closure#1}::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>
  28:     0x561e7e146e55 - rustc_span[fcb1f4a96315ac3a]::with_source_map::<core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>, rustc_interface[2984e52930de60b0]::interface::run_compiler<core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>, rustdoc[4d62e6a838d5304]::main_args::{closure#1}>::{closure#0}::{closure#0}>
  29:     0x561e7dfc77e5 - <scoped_tls[8cc3120407342670]::ScopedKey<rustc_span[fcb1f4a96315ac3a]::SessionGlobals>>::set::<rustc_interface[2984e52930de60b0]::interface::run_compiler<core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>, rustdoc[4d62e6a838d5304]::main_args::{closure#1}>::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>
  30:     0x561e7e1bce90 - std[84bdfa5f30581670]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[2984e52930de60b0]::util::run_in_thread_pool_with_globals<rustc_interface[2984e52930de60b0]::interface::run_compiler<core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>, rustdoc[4d62e6a838d5304]::main_args::{closure#1}>::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>
  31:     0x561e7e2b24bd - <<std[84bdfa5f30581670]::thread::Builder>::spawn_unchecked_<rustc_interface[2984e52930de60b0]::util::run_in_thread_pool_with_globals<rustc_interface[2984e52930de60b0]::interface::run_compiler<core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>, rustdoc[4d62e6a838d5304]::main_args::{closure#1}>::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[20f247eb21f65857]::result::Result<(), rustc_errors[c36b833622a99705]::ErrorGuaranteed>>::{closure#1} as core[20f247eb21f65857]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f3c19173343 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf16302793057de5b
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/alloc/src/boxed.rs:2000:9
  33:     0x7f3c19173343 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h98a6e7c9c7148daa
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/alloc/src/boxed.rs:2000:9
  34:     0x7f3c19173343 - std::sys::unix::thread::Thread::new::thread_start::h40d01ba5e8c2eb10
                               at /rustc/e1d819583f0bf13b016b119c1c2c43e6d3979450/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7f3c18ec28fd - <unknown>
  36:     0x7f3c18f44a60 - <unknown>
  37:                0x0 - <unknown>
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0107, E0227.
For more information about an error, try `rustc --explain E0107`.

@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 Dec 7, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Dec 8, 2022
@GuillaumeGomez
Copy link
Member

Some news about this: #105457 is fixing this but is currently blocked on some compiler updates.

@bors bors closed this as completed in b3ddfeb Dec 11, 2022
RalfJung pushed a commit to RalfJung/miri that referenced this issue Dec 16, 2022
…ieval, r=notriddle

rustdoc: Prevent auto/blanket impl retrieval if there were compiler errors

Fixes rust-lang/rust#105404.

I'm not sure happy about this fix but since it's how passes work (ie, even if there are errors, it runs all passes), I think it's fine as is.

Just as a sidenote: I also gave a try to prevent running all passes in case there were compiler errors but then a lot of rustdoc tests were failing so I went for this fix instead.

r? `@notriddle`
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) ❄️ 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.

2 participants