rust-lang / rust-lang/rust

rustdoc: ICE: synthetic auto trait impls: `unexpected result when selecting […]`

Open
#127,593 0 comments 1 reaction 1 assignee View on GitHub

@fmease is already working on this.

Since Jul 11, 2024.

A-auto-traits A-synthetic-impls C-bug I-ICE S-has-mcve T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
pub struct Struct<T>
where
    T: Trait<Type2 = ()>,
{
    pub field: T::Type1,
}
pub trait Trait: BaseTrait<Type1 = <Self as Trait>::Type2> {
    type Type2;
}
pub trait BaseTrait {
    type Type1;
}
Meta

rustc --version --verbose:

rustc 1.79.0 (129f3b996 2024-06-10)
binary: rustc
commit-hash: 129f3b9964af4d4a709d1383930ade12dfe7c081
commit-date: 2024-06-10
host: x86_64-unknown-linux-gnu
release: 1.79.0
LLVM version: 18.1.7

bug also occurs on nightly

rustc --version --verbose:

rustc 1.81.0-nightly (0c81f94b9 2024-07-10)
binary: rustc
commit-hash: 0c81f94b9a6207fb1fc080caa83584dea2d71fc6
commit-date: 2024-07-10
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Error output
thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/auto_trait.rs:728:33:
Unexpected result when selecting Struct<T/#0> Obligation(predicate=Binder { value: ProjectionPredicate(AliasTerm { args: [T/#0], def_id: DefId(0:9 ~ lib[e681]::BaseTrait::Type1) }, Term::Ty(?0t)), bound_vars: [] }, depth=2)

rustc-ice-2024-07-11T03_38_08-433375.txt

Backtrace

stack backtrace:
   0:     0x7f29816b6655 - std::backtrace_rs::backtrace::libunwind::trace::ha33d49b62179466d
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7f29816b6655 - std::backtrace_rs::backtrace::trace_unsynchronized::h62aca976e31fe218
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f29816b6655 - std::sys::backtrace::_print_fmt::hca96100d9e18721f
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/backtrace.rs:68:5
   3:     0x7f29816b6655 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf8366c5ef1b524a9
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/backtrace.rs:44:22
   4:     0x7f2981705d3b - core::fmt::rt::Argument::fmt::h7fd777d4d54cce4a
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/core/src/fmt/rt.rs:173:76
   5:     0x7f2981705d3b - core::fmt::write::ha5f64323c8f45816
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/core/src/fmt/mod.rs:1182:21
   6:     0x7f29816aaf8f - std::io::Write::write_fmt::h009396e769a8aa9b
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/io/mod.rs:1835:15
   7:     0x7f29816b642e - std::sys::backtrace::_print::h193bb74a56dbb373
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/backtrace.rs:47:5
   8:     0x7f29816b642e - std::sys::backtrace::print::h2895220bf278ca26
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/backtrace.rs:34:9
   9:     0x7f29816b8d79 - std::panicking::default_hook::{{closure}}::had1eb0933af91d17
  10:     0x7f29816b8b1c - std::panicking::default_hook::h77401536babb35bd
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/panicking.rs:292:9
  11:     0x7f2984b594da - std[69163dc58001fbdc]::panicking::update_hook::<alloc[3d433dcf797e1c4c]::boxed::Box<rustc_driver_impl[17a8534abb3728b2]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f29816b969f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h46ff1cf8739abfbf
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/alloc/src/boxed.rs:2078:9
  13:     0x7f29816b969f - std::panicking::rust_panic_with_hook::hb2f290c059c9227c
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/panicking.rs:804:13
  14:     0x7f29816b92c7 - std::panicking::begin_panic_handler::{{closure}}::hbdd6dbac1d79bc65
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/panicking.rs:670:13
  15:     0x7f29816b6b19 - std::sys::backtrace::__rust_end_short_backtrace::habe2c623ddb8abb4
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/backtrace.rs:171:18
  16:     0x7f29816b8f54 - rust_begin_unwind
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/panicking.rs:661:5
  17:     0x7f29817022f3 - core::panicking::panic_fmt::hf48eda04dd8cb30c
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/core/src/panicking.rs:74:14
  18:     0x7f298581c0b0 - <rustc_trait_selection[32ec608b802ae219]::traits::auto_trait::AutoTraitFinder>::evaluate_predicates
  19:     0x55f996befdd9 - rustdoc[da0500aaae5a6627]::clean::auto_trait::synthesize_auto_trait_impl
  20:     0x55f996aac1d8 - rustdoc[da0500aaae5a6627]::clean::utils::synthesize_auto_trait_and_blanket_impls
  21:     0x55f996bc4cf1 - <rustdoc[da0500aaae5a6627]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[da0500aaae5a6627]::visit::DocVisitor>::visit_item
  22:     0x55f996bc4fea - <rustdoc[da0500aaae5a6627]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[da0500aaae5a6627]::visit::DocVisitor>::visit_item
  23:     0x55f996bc177e - rustdoc[da0500aaae5a6627]::passes::collect_trait_impls::collect_trait_impls
  24:     0x55f996adbaac - rustdoc[da0500aaae5a6627]::core::run_global_ctxt
  25:     0x55f996994fb8 - <rustc_middle[f955c2d190e152df]::ty::context::GlobalCtxt>::enter::<rustdoc[da0500aaae5a6627]::main_args::{closure#1}::{closure#0}::{closure#0}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#1}
  26:     0x55f99699ebc7 - rustc_interface[850405b0f2da8be8]::interface::run_compiler::<core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>, rustdoc[da0500aaae5a6627]::main_args::{closure#1}>::{closure#1}
  27:     0x55f99692a575 - std[69163dc58001fbdc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[850405b0f2da8be8]::util::run_in_thread_with_globals<rustc_interface[850405b0f2da8be8]::util::run_in_thread_pool_with_globals<rustc_interface[850405b0f2da8be8]::interface::run_compiler<core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>, rustdoc[da0500aaae5a6627]::main_args::{closure#1}>::{closure#1}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#0}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>
  28:     0x55f9969a9f47 - <<std[69163dc58001fbdc]::thread::Builder>::spawn_unchecked_<rustc_interface[850405b0f2da8be8]::util::run_in_thread_with_globals<rustc_interface[850405b0f2da8be8]::util::run_in_thread_pool_with_globals<rustc_interface[850405b0f2da8be8]::interface::run_compiler<core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>, rustdoc[da0500aaae5a6627]::main_args::{closure#1}>::{closure#1}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#0}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[168fded7e7f0f235]::result::Result<(), rustc_span[fe275b7a592f40ac]::ErrorGuaranteed>>::{closure#2} as core[168fded7e7f0f235]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  29:     0x7f29816c34fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd131f6f2527e7623
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/alloc/src/boxed.rs:2064:9
  30:     0x7f29816c34fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hde4508abfffa77b1
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/alloc/src/boxed.rs:2064:9
  31:     0x7f29816c34fb - std::sys::pal::unix::thread::Thread::new::thread_start::ha2d1c999409fd904
                               at /rustc/0c81f94b9a6207fb1fc080caa83584dea2d71fc6/library/std/src/sys/pal/unix/thread.rs:108:17
  32:     0x7f2981585609 - start_thread
                               at /build/glibc-LcI20x/glibc-2.31/nptl/pthread_create.c:477:8
  33:     0x7f2981359353 - clone
                               at /build/glibc-LcI20x/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  34:                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-rustdoc&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/jacob/projects/fayalite/rustc-ice-2024-07-11T03_38_08-433375.txt` to your bug report

query stack during panic:
end of query stack

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.