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 […] due to ambiguity involving higher-ranked lifetimes & projection predicates #110741

Open
matthiaskrgr opened this issue Apr 23, 2023 · 2 comments
Assignees
Labels
A-auto-traits Area: auto traits (`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. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 23, 2023

Code

mod foo {
    pub trait MyTrait<'a> {
        type MyItem: ?Sized;
    }

    pub struct Inner<'a, Q, R: ?Sized> {
        field: Q,
        field3: &'a u8,
        my_foo: Foo<Q>,
        field2: R,
    }

    pub struct Outer<'a, T, K: for<'b> Fn((&'b bool, &'a u8)) -> &'b i8> {
        my_inner: Inner<'a, T, K>,
    }

    pub struct Foo<T> {
        myfield: T,
    }
}

pub use foo::{Foo, Inner as NotInner, MyTrait as NotMyTrait, Outer as NotOuter};

unsafe impl<T> Send for Foo<T> where T: NotMyTrait<'static> {}

unsafe impl<'a, Q, R: ?Sized> Send for NotInner<'a, Q, R>
where
    Q: NotMyTrait<'a>,
    <Q as NotMyTrait<'a>>::MyItem: Copy,
    R: for<'b> Fn((&'b bool, &'a u8)) -> &'b i8,
    Foo<Q>: Send,
{
}

Meta

rustc --version --verbose:

rustdoc 1.71.0-nightly (b628260df 2023-04-22)
binary: rustdoc
commit-hash: b628260df0587ae559253d8640ecb8738d3de613
commit-date: 2023-04-22
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

thread 'rustc' panicked at 'Unable to fulfill trait DefId(2:2667 ~ core[6cf6]::marker::Send) for 'foo::Outer<'a, T, K>': [FulfillmentError(Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [K, ((&'b bool, &u8),)], def_id: DefId(2:2941 ~ core[6cf6]::ops::function::FnOnce::Output) }, Term::Ty(&'b i8)), [Region(BrNamed(DefId(0:35 ~ 6FE45A2C6E5FED2D2D1DB7DB67AB01ACD3334D81EA9E40465D43C623BE26A177[00f4]::{impl#1}::'b), 'b))]), depth=1),Ambiguity)]', /rustc/b628260df0587ae559253d8640ecb8738d3de613/compiler/rustc_trait_selection/src/traits/auto_trait.rs:186:13
stack backtrace:
   0:     0x7f1267168d93 - std::backtrace_rs::backtrace::libunwind::trace::hb9265895128f1f9c
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f1267168d93 - std::backtrace_rs::backtrace::trace_unsynchronized::h028901cb3a0224b1
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1267168d93 - std::sys_common::backtrace::_print_fmt::hfa5c37f64d314fee
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f1267168d93 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5b30f1684e8bd3e6
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f12671c977f - core::fmt::write::h997ecd0e22e2af7a
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/fmt/mod.rs:1247:17
   5:     0x7f126715bde1 - std::io::Write::write_fmt::h291317e85b978e13
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/io/mod.rs:1698:15
   6:     0x7f1267168ba5 - std::sys_common::backtrace::_print::h0133b24def7b99d9
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f1267168ba5 - std::sys_common::backtrace::print::h4a42174c7f3bd207
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f126716b69f - std::panicking::default_hook::{{closure}}::h0847452fe926d6e5
   9:     0x7f126716b357 - std::panicking::default_hook::hbcdd7833994c05d0
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:293:9
  10:     0x7f126a42a815 - <rustc_driver_impl[6beef204b99823c0]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[6cf684c3b560543b]::ops::function::FnOnce<(&core[6cf684c3b560543b]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f126716be55 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hd538136c3a298239
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1976:9
  12:     0x7f126716be55 - std::panicking::rust_panic_with_hook::hb55c52c8e21298f0
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:704:13
  13:     0x7f126716bbc3 - std::panicking::begin_panic_handler::{{closure}}::h51ad0ee3ee1b4d02
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:595:13
  14:     0x7f12671691d6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd1006853c72eedaf
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f126716b8c2 - rust_begin_unwind
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:584:5
  16:     0x7f12671c5a13 - core::panicking::panic_fmt::h0405aceea833a54b
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/panicking.rs:67:14
  17:     0x562dff19f504 - <rustc_trait_selection[d0b596a23f484fce]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[528331f52b1a723d]::clean::types::Generics, <rustdoc[528331f52b1a723d]::clean::auto_trait::AutoTraitFinder>::generate_for_trait::{closure#0}>
  18:     0x562dfef32a2d - <rustdoc[528331f52b1a723d]::clean::auto_trait::AutoTraitFinder>::generate_for_trait
  19:     0x562dff0cae81 - <alloc[dc090090a0f7fcb0]::vec::Vec<rustdoc[528331f52b1a723d]::clean::types::Item> as alloc[dc090090a0f7fcb0]::vec::spec_from_iter::SpecFromIter<rustdoc[528331f52b1a723d]::clean::types::Item, core[6cf684c3b560543b]::iter::adapters::filter_map::FilterMap<alloc[dc090090a0f7fcb0]::vec::into_iter::IntoIter<rustc_span[2bbd0fdc9680f436]::def_id::DefId>, <rustdoc[528331f52b1a723d]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls::{closure#0}>>>::from_iter
  20:     0x562dfef333a7 - <rustdoc[528331f52b1a723d]::clean::auto_trait::AutoTraitFinder>::get_auto_trait_impls
  21:     0x562dff030521 - rustdoc[528331f52b1a723d]::clean::utils::get_auto_trait_and_blanket_impls
  22:     0x562dff2276ef - <rustdoc[528331f52b1a723d]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[528331f52b1a723d]::visit::DocVisitor>::visit_item
  23:     0x562dff2277fa - <rustdoc[528331f52b1a723d]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[528331f52b1a723d]::visit::DocVisitor>::visit_item
  24:     0x562dff2277fa - <rustdoc[528331f52b1a723d]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[528331f52b1a723d]::visit::DocVisitor>::visit_item
  25:     0x562dff22c0f6 - <rustdoc[528331f52b1a723d]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[528331f52b1a723d]::visit::DocVisitor>::visit_crate
  26:     0x562dff0edc31 - <rustc_session[a507976b3601bb0a]::session::Session>::time::<alloc[dc090090a0f7fcb0]::vec::Vec<rustdoc[528331f52b1a723d]::clean::types::Item>, rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls::{closure#0}>
  27:     0x562dff2246a9 - rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls
  28:     0x562dff0ede42 - <rustc_session[a507976b3601bb0a]::session::Session>::time::<rustdoc[528331f52b1a723d]::clean::types::Crate, rustdoc[528331f52b1a723d]::core::run_global_ctxt::{closure#8}>
  29:     0x562dff19770f - rustdoc[528331f52b1a723d]::core::run_global_ctxt
  30:     0x562dff0ee0be - <rustc_session[a507976b3601bb0a]::session::Session>::time::<(rustdoc[528331f52b1a723d]::clean::types::Crate, rustdoc[528331f52b1a723d]::config::RenderOptions, rustdoc[528331f52b1a723d]::formats::cache::Cache), rustdoc[528331f52b1a723d]::main_args::{closure#1}::{closure#0}::{closure#0}::{closure#0}>
  31:     0x562dfef5f9a0 - <rustc_middle[c2d73d0bca510e43]::ty::context::GlobalCtxt>::enter::<rustdoc[528331f52b1a723d]::main_args::{closure#1}::{closure#0}::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>
  32:     0x562dfeff89aa - <rustc_interface[f51b23ce14955e2d]::interface::Compiler>::enter::<rustdoc[528331f52b1a723d]::main_args::{closure#1}::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>
  33:     0x562dff198d2b - rustc_span[2bbd0fdc9680f436]::set_source_map::<core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>, rustc_interface[f51b23ce14955e2d]::interface::run_compiler<core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}::{closure#0}>
  34:     0x562dfeffa66d - <scoped_tls[ab8992ac05ee2537]::ScopedKey<rustc_span[2bbd0fdc9680f436]::SessionGlobals>>::set::<rustc_interface[f51b23ce14955e2d]::interface::run_compiler<core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>
  35:     0x562dfef148e9 - std[7eada91b7b6d60d5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f51b23ce14955e2d]::util::run_in_thread_pool_with_globals<rustc_interface[f51b23ce14955e2d]::interface::run_compiler<core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>
  36:     0x562dff24ab5d - <<std[7eada91b7b6d60d5]::thread::Builder>::spawn_unchecked_<rustc_interface[f51b23ce14955e2d]::util::run_in_thread_pool_with_globals<rustc_interface[f51b23ce14955e2d]::interface::run_compiler<core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>>::{closure#1} as core[6cf684c3b560543b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f1267176255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he5dc381da166b1f4
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9
  38:     0x7f1267176255 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2873f5088eb028a4
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9
  39:     0x7f1267176255 - std::sys::unix::thread::Thread::new::thread_start::h737c68bdf349b13b
                               at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7f1266e28bb5 - <unknown>
  41:     0x7f1266eaad90 - <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.71.0-nightly (b628260df 2023-04-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack

@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 Apr 23, 2023
@GuillaumeGomez GuillaumeGomez added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 27, 2023
@matthiaskrgr
Copy link
Member Author

crashing since at least mid 2020 😅

@fmease
Copy link
Member

fmease commented Apr 30, 2023

Further minimized:

pub struct Outer<'a, R>(Inner<'a, R>)
where
    R: for<'b> Fn(&'b bool, &'a u8);

pub struct Inner<'a, R>(&'a (), R);

unsafe impl<'a, R> Send for Inner<'a, R>
where
    R: for<'b> Fn(&'b bool, &'a u8)
{}

@rustbot label A-auto-traits A-synthetic-impls
@rustbot claim

@rustbot rustbot added A-auto-traits Area: auto traits (`auto trait Send`) A-synthetic-impls Area: Synthetic impls, used by rustdoc to document auto traits and traits with blanket impls labels May 1, 2023
@fmease fmease removed their assignment Oct 16, 2023
@fmease fmease changed the title ICE: rustdoc: Unable to fulfill trait rustdoc: ICE: synthetic auto trait impls: unable to fulfill trait […] involving higher-ranked lifetimes & projection predicates Mar 31, 2024
@fmease fmease changed the title rustdoc: ICE: synthetic auto trait impls: unable to fulfill trait […] involving higher-ranked lifetimes & projection predicates rustdoc: ICE: synthetic auto trait impls: unable to fulfill trait […] due to ambiguity involving higher-ranked lifetimes & projection predicates Mar 31, 2024
@fmease fmease self-assigned this Jun 23, 2024
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 (`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. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants