rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.57k stars 12.74k forks source link

rustdoc: ICE: synthetic auto trait impls: `failed to fully process […]` involving projections & projection predicates #110740

Open matthiaskrgr opened 1 year ago

matthiaskrgr commented 1 year ago

Code

pub struct Inner<'a, T: 'a> {
    field: &'a T,
}

trait MyTrait {
    type MyItem;
}

trait OtherTrait {}

unsafe impl<'a, T> Send for Inner<'a, T>
where
    'a: 'static,
    T: MyTrait<MyItem = bool>,
{
}

unsafe impl<'a, T> Sync for Inner<'a, T>
where
    'a: 'static,
    T: MyTrait<MyItem = bool>,
    <T as MyTrait>::MyItem: OtherTrait,
{
}

pub struct Foo<'c, K: 'c> {
    inner_field: Inner<'c, K>,
}

Meta

rustc --version --verbose:

Error output

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
Backtrace

``` thread 'rustc' panicked at 'Failed to fully process: Foo<'c, K> DefId(2:2681 ~ core[6cf6]::marker::Sync) ParamEnv { caller_bounds: [Binder(TraitPredicate(, polarity:Positive), []), Binder(OutlivesPredicate(K, ReEarlyBound(0, 'c)), [])], reveal: UserFacing, constness: NotConst }', /rustc/b628260df0587ae559253d8640ecb8738d3de613/compiler/rustc_trait_selection/src/traits/auto_trait.rs:169:17 stack backtrace: 0: 0x7ff454b68d93 - std::backtrace_rs::backtrace::libunwind::trace::hb9265895128f1f9c at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7ff454b68d93 - std::backtrace_rs::backtrace::trace_unsynchronized::h028901cb3a0224b1 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7ff454b68d93 - std::sys_common::backtrace::_print_fmt::hfa5c37f64d314fee at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7ff454b68d93 - ::fmt::h5b30f1684e8bd3e6 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7ff454bc977f - core::fmt::write::h997ecd0e22e2af7a at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/fmt/mod.rs:1247:17 5: 0x7ff454b5bde1 - std::io::Write::write_fmt::h291317e85b978e13 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/io/mod.rs:1698:15 6: 0x7ff454b68ba5 - std::sys_common::backtrace::_print::h0133b24def7b99d9 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7ff454b68ba5 - std::sys_common::backtrace::print::h4a42174c7f3bd207 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7ff454b6b69f - std::panicking::default_hook::{{closure}}::h0847452fe926d6e5 9: 0x7ff454b6b357 - std::panicking::default_hook::hbcdd7833994c05d0 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:293:9 10: 0x7ff457e2a815 - >::call_once::{shim:vtable#0} 11: 0x7ff454b6be55 - as core::ops::function::Fn>::call::hd538136c3a298239 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1976:9 12: 0x7ff454b6be55 - std::panicking::rust_panic_with_hook::hb55c52c8e21298f0 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:704:13 13: 0x7ff454b6bbc3 - std::panicking::begin_panic_handler::{{closure}}::h51ad0ee3ee1b4d02 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:595:13 14: 0x7ff454b691d6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd1006853c72eedaf at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:150:18 15: 0x7ff454b6b8c2 - rust_begin_unwind at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:584:5 16: 0x7ff454bc5a13 - core::panicking::panic_fmt::h0405aceea833a54b at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/panicking.rs:67:14 17: 0x555b2bd80460 - ::find_auto_trait_generics::::generate_for_trait::{closure#0}> 18: 0x555b2bb13a2d - ::generate_for_trait 19: 0x555b2bcabe81 - as alloc[dc090090a0f7fcb0]::vec::spec_from_iter::SpecFromIter, ::get_auto_trait_impls::{closure#0}>>>::from_iter 20: 0x555b2bb143a7 - ::get_auto_trait_impls 21: 0x555b2bc11521 - rustdoc[528331f52b1a723d]::clean::utils::get_auto_trait_and_blanket_impls 22: 0x555b2be086ef - ::visit_item 23: 0x555b2be087fa - ::visit_item 24: 0x555b2be0d0f6 - ::visit_crate 25: 0x555b2bccec31 - ::time::, rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls::{closure#0}> 26: 0x555b2be056a9 - rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls 27: 0x555b2bccee42 - ::time:: 28: 0x555b2bd7870f - rustdoc[528331f52b1a723d]::core::run_global_ctxt 29: 0x555b2bccf0be - ::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}> 30: 0x555b2bb409a0 - ::enter::> 31: 0x555b2bbd99aa - ::enter::> 32: 0x555b2bd79d2b - rustc_span[2bbd0fdc9680f436]::set_source_map::, rustc_interface[f51b23ce14955e2d]::interface::run_compiler, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}::{closure#0}> 33: 0x555b2bbdb66d - >::set::, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>> 34: 0x555b2baf58e9 - std[7eada91b7b6d60d5]::sys_common::backtrace::__rust_begin_short_backtrace::, 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>> 35: 0x555b2be2bb5d - <::spawn_unchecked_, 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} 36: 0x7ff454b76255 - as core::ops::function::FnOnce>::call_once::he5dc381da166b1f4 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9 37: 0x7ff454b76255 - as core::ops::function::FnOnce>::call_once::h2873f5088eb028a4 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9 38: 0x7ff454b76255 - std::sys::unix::thread::Thread::new::thread_start::h737c68bdf349b13b at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys/unix/thread.rs:108:17 39: 0x7ff454828bb5 - 40: 0x7ff4548aad90 - 41: 0x0 - error: the compiler unexpectedly panthread 'rustc' panicked at 'Failed to fully process: Foo<'c, K> DefId(2:2681 ~ core[6cf6]::marker::Sync) ParamEnv { caller_bounds: [Binder(TraitPredicate(, polarity:Positive), []), Binder(OutlivesPredicate(K, ReEarlyBound(0, 'c)), [])], reveal: UserFacing, constness: NotConst }', /rustc/b628260df0587ae559253d8640ecb8738d3de613/compiler/rustc_trait_selection/src/traits/auto_trait.rs:169:17 stack backtrace: 0: 0x7ff454b68d93 - std::backtrace_rs::backtrace::libunwind::trace::hb9265895128f1f9c at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7ff454b68d93 - std::backtrace_rs::backtrace::trace_unsynchronized::h028901cb3a0224b1 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7ff454b68d93 - std::sys_common::backtrace::_print_fmt::hfa5c37f64d314fee at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7ff454b68d93 - ::fmt::h5b30f1684e8bd3e6 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7ff454bc977f - core::fmt::write::h997ecd0e22e2af7a at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/fmt/mod.rs:1247:17 5: 0x7ff454b5bde1 - std::io::Write::write_fmt::h291317e85b978e13 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/io/mod.rs:1698:15 6: 0x7ff454b68ba5 - std::sys_common::backtrace::_print::h0133b24def7b99d9 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7ff454b68ba5 - std::sys_common::backtrace::print::h4a42174c7f3bd207 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7ff454b6b69f - std::panicking::default_hook::{{closure}}::h0847452fe926d6e5 9: 0x7ff454b6b357 - std::panicking::default_hook::hbcdd7833994c05d0 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:293:9 10: 0x7ff457e2a815 - >::call_once::{shim:vtable#0} 11: 0x7ff454b6be55 - as core::ops::function::Fn>::call::hd538136c3a298239 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1976:9 12: 0x7ff454b6be55 - std::panicking::rust_panic_with_hook::hb55c52c8e21298f0 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:704:13 13: 0x7ff454b6bbc3 - std::panicking::begin_panic_handler::{{closure}}::h51ad0ee3ee1b4d02 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:595:13 14: 0x7ff454b691d6 - std::sys_common::backtrace::__rust_end_short_backtrace::hd1006853c72eedaf at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys_common/backtrace.rs:150:18 15: 0x7ff454b6b8c2 - rust_begin_unwind at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/panicking.rs:584:5 16: 0x7ff454bc5a13 - core::panicking::panic_fmt::h0405aceea833a54b at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/core/src/panicking.rs:67:14 17: 0x555b2bd80460 - ::find_auto_trait_generics::::generate_for_trait::{closure#0}> 18: 0x555b2bb13a2d - ::generate_for_trait 19: 0x555b2bcabe81 - as alloc[dc090090a0f7fcb0]::vec::spec_from_iter::SpecFromIter, ::get_auto_trait_impls::{closure#0}>>>::from_iter 20: 0x555b2bb143a7 - ::get_auto_trait_impls 21: 0x555b2bc11521 - rustdoc[528331f52b1a723d]::clean::utils::get_auto_trait_and_blanket_impls 22: 0x555b2be086ef - ::visit_item 23: 0x555b2be087fa - ::visit_item 24: 0x555b2be0d0f6 - ::visit_crate 25: 0x555b2bccec31 - ::time::, rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls::{closure#0}> 26: 0x555b2be056a9 - rustdoc[528331f52b1a723d]::passes::collect_trait_impls::collect_trait_impls 27: 0x555b2bccee42 - ::time:: 28: 0x555b2bd7870f - rustdoc[528331f52b1a723d]::core::run_global_ctxt 29: 0x555b2bccf0be - ::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}> 30: 0x555b2bb409a0 - ::enter::> 31: 0x555b2bbd99aa - ::enter::> 32: 0x555b2bd79d2b - rustc_span[2bbd0fdc9680f436]::set_source_map::, rustc_interface[f51b23ce14955e2d]::interface::run_compiler, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}::{closure#0}> 33: 0x555b2bbdb66d - >::set::, rustdoc[528331f52b1a723d]::main_args::{closure#1}>::{closure#0}, core[6cf684c3b560543b]::result::Result<(), rustc_span[2bbd0fdc9680f436]::ErrorGuaranteed>> 34: 0x555b2baf58e9 - std[7eada91b7b6d60d5]::sys_common::backtrace::__rust_begin_short_backtrace::, 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>> 35: 0x555b2be2bb5d - <::spawn_unchecked_, 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} 36: 0x7ff454b76255 - as core::ops::function::FnOnce>::call_once::he5dc381da166b1f4 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9 37: 0x7ff454b76255 - as core::ops::function::FnOnce>::call_once::h2873f5088eb028a4 at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/alloc/src/boxed.rs:1962:9 38: 0x7ff454b76255 - std::sys::unix::thread::Thread::new::thread_start::h737c68bdf349b13b at /rustc/b628260df0587ae559253d8640ecb8738d3de613/library/std/src/sys/unix/thread.rs:108:17 39: 0x7ff454828bb5 - 40: 0x7ff4548aad90 - 41: 0x0 - 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 query stack during panic: end of query stackicked. 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 query stack during panic: end of query stack ```

matthiaskrgr commented 1 year ago

crashing since at least mid 2020

fmease commented 1 year ago

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

bvanjoi commented 1 year ago

reduce:

pub struct Inner<T>(T);

trait MyTrait {
    type MyItem;
}

trait OtherTrait {}

unsafe impl<T> Sync for Inner<T>
where
    T: MyTrait<MyItem = bool>,
    <T as MyTrait>::MyItem: OtherTrait,
{
}

pub struct Foo<K> {
    inner_field: Inner<K>,
}