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: synthetic auto trait impls: unable to fulfill trait […] for […] due to ambiguity involving to unconstrained param in impl #112828

Closed
bvanjoi opened this issue Jun 20, 2023 · 4 comments · Fixed by #123348
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@bvanjoi
Copy link
Contributor

bvanjoi commented Jun 20, 2023

Code

rustdoc code.rs

// code.rs
trait MyTrait {}
struct Inner;
struct Outer(Inner);

unsafe impl<Q> Send for Inner
where
  Q: MyTrait 
{}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (fe7454bf4 2023-06-19)
binary: rustc
commit-hash: fe7454bf439c93cbe9ac8a8f7fcfacd5a40244c2
commit-date: 2023-06-19
host: aarch64-apple-darwin
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

thread 'rustc' panicked at 'Unable to fulfill trait DefId(2:2683 ~ core[0f69]::marker::Send) for 'Outer': [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<_ as std::marker::Sized>, polarity:Positive), []), depth=2),Ambiguity), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<_ as MyTrait>, polarity:Positive), []), depth=2),Ambiguity)]', /rustc/fe7454bf439c93cbe9ac8a8f7fcfacd5a40244c2/compiler/rustc_trait_selection/src/traits/auto_trait.rs:186:13
stack backtrace:
   0:        0x1015c40f4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h98bf6f1b8a3176b4
   1:        0x10161475c - core::fmt::write::h32b4394822667739
   2:        0x1015b999c - std::io::Write::write_fmt::h19e6965a4f1b2789
   3:        0x1015c3f4c - std::sys_common::backtrace::print::h75a318905bc68cf1
   4:        0x1015c6ac8 - std::panicking::default_hook::{{closure}}::hd804ed281d7e08a7
   5:        0x1015c6858 - std::panicking::default_hook::hf1f7a911542630ee
   6:        0x109b456cc - rustc_driver_impl[d5bfd45cb53215fb]::install_ice_hook::{closure#0}
   7:        0x1015c7248 - std::panicking::rust_panic_with_hook::h74c8b87d4371442c
   8:        0x1015c701c - std::panicking::begin_panic_handler::{{closure}}::hd7ff9b18e4ab7574
   9:        0x1015c44d4 - std::sys_common::backtrace::__rust_end_short_backtrace::hdc7391160fc74630
  10:        0x1015c6d88 - _rust_begin_unwind
  11:        0x10163f924 - core::panicking::panic_fmt::hb1c27fe21c4f1f37
  12:        0x100300f28 - <rustc_trait_selection[3bfe20a7ab0ad0d3]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[e386f36fe3828e32]::clean::types::Generics, <rustdoc[e386f36fe3828e32]::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  13:        0x1004030b0 - <rustdoc[e386f36fe3828e32]::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  14:        0x100445ad4 - <alloc[480d25cc58e20263]::vec::Vec<rustdoc[e386f36fe3828e32]::clean::types::Item> as alloc[480d25cc58e20263]::vec::spec_from_iter::SpecFromIter<rustdoc[e386f36fe3828e32]::clean::types::Item, core[f69943f7197f08d]::iter::adapters::filter_map::FilterMap<alloc[480d25cc58e20263]::vec::into_iter::IntoIter<rustc_span[131a45c9b4032fd]::def_id::DefId>, <rustdoc[e386f36fe3828e32]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls::{closure#0}>>>::from_iter
  15:        0x100403698 - <rustdoc[e386f36fe3828e32]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls
  16:        0x100395f54 - rustdoc[e386f36fe3828e32]::clean::utils::get_auto_trait_and_blanket_impls
  17:        0x10052afa0 - <rustdoc[e386f36fe3828e32]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[e386f36fe3828e32]::visit::DocVisitor>::visit_item
  18:        0x10052b070 - <rustdoc[e386f36fe3828e32]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[e386f36fe3828e32]::visit::DocVisitor>::visit_item
  19:        0x10052c36c - <rustdoc[e386f36fe3828e32]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[e386f36fe3828e32]::visit::DocVisitor>::visit_crate
  20:        0x10039e61c - <rustc_session[b33ec7bea72ab9c0]::session::Session>::time::<alloc[480d25cc58e20263]::vec::Vec<rustdoc[e386f36fe3828e32]::clean::types::Item>, rustdoc[e386f36fe3828e32]::passes::collect_trait_impls::collect_trait_impls::{closure#0}>
  21:        0x100528cfc - rustdoc[e386f36fe3828e32]::passes::collect_trait_impls::collect_trait_impls
  22:        0x10039e914 - <rustc_session[b33ec7bea72ab9c0]::session::Session>::time::<rustdoc[e386f36fe3828e32]::clean::types::Crate, rustdoc[e386f36fe3828e32]::core::run_global_ctxt::{closure#7}>
  23:        0x100526c94 - rustdoc[e386f36fe3828e32]::core::run_global_ctxt
  24:        0x10039ec58 - <rustc_session[b33ec7bea72ab9c0]::session::Session>::time::<(rustdoc[e386f36fe3828e32]::clean::types::Crate, rustdoc[e386f36fe3828e32]::config::RenderOptions, rustdoc[e386f36fe3828e32]::formats::cache::Cache), rustdoc[e386f36fe3828e32]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
  25:        0x10037c4ac - <rustc_middle[69929678d7438a39]::ty::context::GlobalCtxt>::enter::<rustdoc[e386f36fe3828e32]::main_args::{closure#1}::{closure#0}::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>
  26:        0x1003cfb54 - <rustc_interface[f4474a023a28a1e1]::interface::Compiler>::enter::<rustdoc[e386f36fe3828e32]::main_args::{closure#1}::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>
  27:        0x10047b0b4 - rustc_span[131a45c9b4032fd]::set_source_map::<core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>, rustc_interface[f4474a023a28a1e1]::interface::run_compiler<core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>, rustdoc[e386f36fe3828e32]::main_args::{closure#1}>::{closure#0}::{closure#0}>
  28:        0x100533b38 - <scoped_tls[14441d0542f530d4]::ScopedKey<rustc_span[131a45c9b4032fd]::SessionGlobals>>::set::<rustc_interface[f4474a023a28a1e1]::interface::run_compiler<core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>, rustdoc[e386f36fe3828e32]::main_args::{closure#1}>::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>
  29:        0x1003ad540 - std[305047cfbd8f31b0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f4474a023a28a1e1]::util::run_in_thread_pool_with_globals<rustc_interface[f4474a023a28a1e1]::interface::run_compiler<core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>, rustdoc[e386f36fe3828e32]::main_args::{closure#1}>::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>
  30:        0x100495fb0 - <<std[305047cfbd8f31b0]::thread::Builder>::spawn_unchecked_<rustc_interface[f4474a023a28a1e1]::util::run_in_thread_pool_with_globals<rustc_interface[f4474a023a28a1e1]::interface::run_compiler<core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>, rustdoc[e386f36fe3828e32]::main_args::{closure#1}>::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f69943f7197f08d]::result::Result<(), rustc_span[131a45c9b4032fd]::ErrorGuaranteed>>::{closure#1} as core[f69943f7197f08d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:        0x1015cfa6c - std::sys::unix::thread::Thread::new::thread_start::hdf5e17a1fe30b937
  32:        0x191d6bfa8 - __pthread_joiner_wake

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-rustdoc&template=ice.md

note: rustc 1.72.0-nightly (fe7454bf4 2023-06-19) running on aarch64-apple-darwin

query stack during panic:
end of query stack

@bvanjoi bvanjoi 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 Jun 20, 2023
@Noratrieb Noratrieb added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 20, 2023
@fmease
Copy link
Member

fmease commented Jun 24, 2023

@rustbot label A-synthetic-impls A-auto-traits T-compiler

T-compiler [next to T-rustdoc]

The bug originates in AutoTraitFinder which lives in rustc, so having both team labels is valid.

@rustbot rustbot added A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2023
@apiraino
Copy link
Contributor

Bisection seems to point to nightly-2022-10-24, one of these:

commit[0] 2022-10-22: Auto merge of #103240 - BelovDV:issue-102290, r=petrochenkov
commit[1] 2022-10-23: Auto merge of #102660 - camsteffen:uninhabited-perf, r=oli-obk
commit[2] 2022-10-23: Auto merge of #103426 - matthiaskrgr:rollup-n6dqdy8, r=matthiaskrgr
commit[3] 2022-10-23: Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errors
commit[4] 2022-10-23: Auto merge of #103431 - Dylan-DPC:rollup-oozfo89, r=Dylan-DPC
commit[5] 2022-10-23: Auto merge of #101403 - bjorn3:dylib_lto, r=Mark-Simulacrum
commit[6] 2022-10-23: Auto merge of #103137 - dtolnay:readdir, r=Mark-Simulacrum

@apiraino apiraino added P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Jun 27, 2023
@fmease
Copy link
Member

fmease commented Jul 3, 2023

Out of those, #103368 looks the most likely (from Auto merge of #103426 - matthiaskrgr:rollup-n6dqdy8, r=matthiaskrgr).

@fmease fmease added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Mar 31, 2024
@fmease fmease changed the title rustdoc panic: Unable to fulfill trait DefId(2:2683 ~ core[0f69]::marker::Send) for 'Outer' rustdoc: ICE: synthetic auto trait impls: unable to fulfill trait […] for […] due to ambiguity involving to unconstrained param in impl Mar 31, 2024
@fmease
Copy link
Member

fmease commented Mar 31, 2024

I can no longer reproduce this. Fixed: ICE → errors. Probably fixed by one of those PRs that made rustdoc run more of rustc's passes.

bors added a commit to rust-lang-ci/rust that referenced this issue Apr 2, 2024
…sts, r=GuillaumeGomez

rustdoc: add a couple of regression tests

Fixes rust-lang#114657.
Fixes rust-lang#112828.
Fixes rust-lang#112242.
Fixes rust-lang#107715.

r? rustdoc
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Apr 2, 2024
…tests, r=GuillaumeGomez

rustdoc: add a couple of regression tests

Fixes rust-lang#114657.
Fixes rust-lang#112828.
Fixes rust-lang#107715.

r? rustdoc
@bors bors closed this as completed in 464f264 Apr 2, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 2, 2024
Rollup merge of rust-lang#123348 - fmease:add-synth-auto-trait-impls-tests, r=GuillaumeGomez

rustdoc: add a couple of regression tests

Fixes rust-lang#114657.
Fixes rust-lang#112828.
Fixes rust-lang#107715.

r? rustdoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auto-traits Area: auto traits (e.g., `auto trait Send {}`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium 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. 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.

5 participants