Skip to content

rustdoc: ICE: Cannot turn UnevaluatedConst into AliasTy when synthesizing auto trait impls #134775

Open
@sigurd4

Description

@sigurd4

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

$ rustc --version --verbose
rustc 1.85.0-nightly (409998c4e 2024-12-24)
binary: rustc
commit-hash: 409998c4e8cae45344fd434b358b697cc93870d0
commit-date: 2024-12-24
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.6

Current error output

thread 'rustc' panicked at /rustc/409998c4e8cae45344fd434b358b697cc93870d0/compiler/rustc_type_ir/src/predicate.rs:532:17:
Cannot turn `UnevaluatedConst` into `AliasTy`
stack backtrace:
   0:     0x70b15b517ce5 - std::backtrace::Backtrace::create::hf812a409703b1040
   1:     0x70b159aa5a15 - std::backtrace::Backtrace::force_capture::h337865a52d86378d
   2:     0x70b158c28e2e - std[414f5e51836a5eb3]::panicking::update_hook::<alloc[13c93d87da526635]::boxed::Box<rustc_driver_impl[eca950f79a9af99a]::install_ice_hook::{closure#0}>>::{closure#0}
   3:     0x70b159abd988 - std::panicking::rust_panic_with_hook::hed82fa161e5d609f
   4:     0x70b159abd646 - std::panicking::begin_panic_handler::{{closure}}::he20c607c9af2a417
   5:     0x70b159abb2d9 - std::sys::backtrace::__rust_end_short_backtrace::h916664e470597950
   6:     0x70b159abd33d - rust_begin_unwind
   7:     0x70b15679a3b0 - core::panicking::panic_fmt::h79463041cd375e0d
   8:     0x5a581dd0518c - rustdoc[a07283fe33c1a0a8]::clean::clean_predicate
   9:     0x5a581dd0aa26 - rustdoc[a07283fe33c1a0a8]::clean::clean_ty_generics
  10:     0x5a581dcfd19e - rustdoc[a07283fe33c1a0a8]::clean::utils::synthesize_auto_trait_and_blanket_impls
  11:     0x5a581de37c2c - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  12:     0x5a581de37d8a - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  13:     0x5a581de37d8a - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  14:     0x5a581de34414 - rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::collect_trait_impls
  15:     0x5a581dd2fa38 - rustdoc[a07283fe33c1a0a8]::core::run_global_ctxt
  16:     0x5a581dbddb5e - rustc_interface[c6732610254ef852]::passes::create_and_enter_global_ctxt::<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0}>::{closure#2}::{closure#0}
  17:     0x5a581dbeb449 - <rustc_interface[c6732610254ef852]::passes::create_and_enter_global_ctxt<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0}>::{closure#2} as core[3bb849e6baf5fd92]::ops::function::FnOnce<(&rustc_session[ffc7f553f070d4e4]::session::Session, rustc_middle[995178121f49996]::ty::context::CurrentGcx, &std[414f5e51836a5eb3]::sync::once_lock::OnceLock<rustc_middle[995178121f49996]::ty::context::GlobalCtxt>, &rustc_data_structures[ce73ec690cecbb88]::sync::worker_local::WorkerLocal<rustc_middle[995178121f49996]::arena::Arena>, &rustc_data_structures[ce73ec690cecbb88]::sync::worker_local::WorkerLocal<rustc_hir[3757cb245ac16ec5]::Arena>, rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0})>>::call_once::{shim:vtable#0}
  18:     0x5a581dbd73c8 - rustc_interface[c6732610254ef852]::interface::run_compiler::<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}
  19:     0x5a581db5bc49 - std[414f5e51836a5eb3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c6732610254ef852]::util::run_in_thread_with_globals<rustc_interface[c6732610254ef852]::util::run_in_thread_pool_with_globals<rustc_interface[c6732610254ef852]::interface::run_compiler<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  20:     0x5a581dbe738e - <<std[414f5e51836a5eb3]::thread::Builder>::spawn_unchecked_<rustc_interface[c6732610254ef852]::util::run_in_thread_with_globals<rustc_interface[c6732610254ef852]::util::run_in_thread_pool_with_globals<rustc_interface[c6732610254ef852]::interface::run_compiler<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3bb849e6baf5fd92]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:     0x70b15b04f3af - std::sys::pal::unix::thread::Thread::new::thread_start::hbd4482c1e0b8221a
  22:     0x70b1554a339d - <unknown>
  23:     0x70b15552849c - <unknown>
  24:                0x0 - <unknown>


rustc version: 1.85.0-nightly (409998c4e 2024-12-24)
platform: x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Backtrace

$ cargo docs-rs
 Documenting option_trait v1.0.6 (/home/sigurd/Code/rust/sss/option_trait)
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
  --> option_trait/src/lib.rs:14:12
   |
14 | #![feature(specialization)]
   |            ^^^^^^^^^^^^^^
   |
   = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
   = help: consider using `min_specialization` instead, which is more stable and complete
   = note: `#[warn(incomplete_features)]` on by default

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
  --> option_trait/src/lib.rs:15:12
   |
15 | #![feature(generic_const_exprs)]
   |            ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

thread 'rustc' panicked at /rustc/409998c4e8cae45344fd434b358b697cc93870d0/compiler/rustc_type_ir/src/predicate.rs:532:17:
Cannot turn `UnevaluatedConst` into `AliasTy`
stack backtrace:
   0:     0x7419a16bae3a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h80cfa1530c2694c1
   1:     0x7419a1e138a6 - core::fmt::write::h3039031fbbd12aba
   2:     0x7419a2d66891 - std::io::Write::write_fmt::hc1db23927ce1b8c5
   3:     0x7419a16bac92 - std::sys::backtrace::BacktraceLock::print::heb1afe01e589bc80
   4:     0x7419a16bd18a - std::panicking::default_hook::{{closure}}::h32ec7a671b90f2d3
   5:     0x7419a16bcfd3 - std::panicking::default_hook::he9daa37af576e716
   6:     0x7419a08286c8 - std[414f5e51836a5eb3]::panicking::update_hook::<alloc[13c93d87da526635]::boxed::Box<rustc_driver_impl[eca950f79a9af99a]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7419a16bd988 - std::panicking::rust_panic_with_hook::hed82fa161e5d609f
   8:     0x7419a16bd646 - std::panicking::begin_panic_handler::{{closure}}::he20c607c9af2a417
   9:     0x7419a16bb2d9 - std::sys::backtrace::__rust_end_short_backtrace::h916664e470597950
  10:     0x7419a16bd33d - rust_begin_unwind
  11:     0x74199e39a3b0 - core::panicking::panic_fmt::h79463041cd375e0d
  12:     0x6005c5c0a18c - rustdoc[a07283fe33c1a0a8]::clean::clean_predicate
  13:     0x6005c5c0fa26 - rustdoc[a07283fe33c1a0a8]::clean::clean_ty_generics
  14:     0x6005c5c0219e - rustdoc[a07283fe33c1a0a8]::clean::utils::synthesize_auto_trait_and_blanket_impls
  15:     0x6005c5d3cc2c - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  16:     0x6005c5d3cd8a - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  17:     0x6005c5d3cd8a - <rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[a07283fe33c1a0a8]::visit::DocVisitor>::visit_item
  18:     0x6005c5d39414 - rustdoc[a07283fe33c1a0a8]::passes::collect_trait_impls::collect_trait_impls
  19:     0x6005c5c34a38 - rustdoc[a07283fe33c1a0a8]::core::run_global_ctxt
  20:     0x6005c5ae2b5e - rustc_interface[c6732610254ef852]::passes::create_and_enter_global_ctxt::<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0}>::{closure#2}::{closure#0}
  21:     0x6005c5af0449 - <rustc_interface[c6732610254ef852]::passes::create_and_enter_global_ctxt<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0}>::{closure#2} as core[3bb849e6baf5fd92]::ops::function::FnOnce<(&rustc_session[ffc7f553f070d4e4]::session::Session, rustc_middle[995178121f49996]::ty::context::CurrentGcx, &std[414f5e51836a5eb3]::sync::once_lock::OnceLock<rustc_middle[995178121f49996]::ty::context::GlobalCtxt>, &rustc_data_structures[ce73ec690cecbb88]::sync::worker_local::WorkerLocal<rustc_middle[995178121f49996]::arena::Arena>, &rustc_data_structures[ce73ec690cecbb88]::sync::worker_local::WorkerLocal<rustc_hir[3757cb245ac16ec5]::Arena>, rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}::{closure#0})>>::call_once::{shim:vtable#0}
  22:     0x6005c5adc3c8 - rustc_interface[c6732610254ef852]::interface::run_compiler::<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}
  23:     0x6005c5a60c49 - std[414f5e51836a5eb3]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c6732610254ef852]::util::run_in_thread_with_globals<rustc_interface[c6732610254ef852]::util::run_in_thread_pool_with_globals<rustc_interface[c6732610254ef852]::interface::run_compiler<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x6005c5aec38e - <<std[414f5e51836a5eb3]::thread::Builder>::spawn_unchecked_<rustc_interface[c6732610254ef852]::util::run_in_thread_with_globals<rustc_interface[c6732610254ef852]::util::run_in_thread_pool_with_globals<rustc_interface[c6732610254ef852]::interface::run_compiler<(), rustdoc[a07283fe33c1a0a8]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3bb849e6baf5fd92]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7419a2c4f3af - std::sys::pal::unix::thread::Thread::new::thread_start::hbd4482c1e0b8221a
  26:     0x74199d0a339d - <unknown>
  27:     0x74199d12849c - <unknown>
  28:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly

note: please attach the file at `/home/sigurd/Code/rust/sss/rustc-ice-2024-12-26T01_23_44-881333.txt` to your bug report

note: compiler flags: --crate-type lib -Z unstable-options -Z unstable-options

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `option_trait` (lib doc) generated 2 warnings
error: could not document `option_trait`

Anything else?

Initially reported on: rust-lang/docs.rs#2698 (comment)

This ICE only appears when i run cargo docs-rs (with the cargo-docs-rs plugin installed) and when the crate is uploaded to docs.rs.

I have a feature that enables the module in question, and disabling this feature makes it build with docs.rs successfully.

It only happens when the file opt_cell.rs exists, is included as a module and includes a struct definition. Even if the entire contents of the file opt_cell.rs is replaced with the following line, the error still occurs, but if the file is empty, it doesn't.

struct Whatever(u32);

I'm not entirely sure what in my project is causing this, but it's definitely something more than just that single file, that together causes the error. Declaring a struct like above in a new project does not produce the error. It's kind of hard to figure out what part of my code that causes this error. See my previous report on this error for more information about things i've tried to isolate the error (and failed).

It compiles fine with cargo build --all-features and it compiles fine with cargo docs-rs, but not cargo docs-rs when all features are enabled in the Cargo.toml.

Build that showcases the error on docs.rs: https://docs.rs/crate/option_trait/1.0.4/source/
Crate repo: https://www.github.com/sigurd4/option_trait

I've removed all type aliases in my crate, and the error still occurs.

Metadata

Metadata

Assignees

Labels

A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-bugCategory: This is a bug.F-associated_const_equality`#![feature(associated_const_equality)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

Status

Can Do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions