Skip to content

rustdoc RPITIT ICE: compiler\rustc_middle\src\ty\generic_args.rs:900:9: type parameter impl ToString/#1 (impl ToString/1) out of range when substituting, args=[MyStruct] #113929

Closed
@PhiSyX

Description

@PhiSyX

The cargo doc command causes an ICE error. This happens when we use the features of #[feature(return_position_impl_trait_in_trait)] (impl Trait) in different workspaces.

Code

[workspace]
members = ["workspace-a", "workspace-b"]
resolver = "2"

workspace-a/src/lib.rs :

use workspace_b::MyTrait;

pub struct MyStruct;

impl MyTrait for MyStruct {}

workspace-b/src/lib.rs :

#![feature(return_position_impl_trait_in_trait)]

pub trait MyTrait {
    fn hello(_: impl ToString) -> impl Default {}
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (39f42ad9e 2023-07-19)
binary: rustc
commit-hash: 39f42ad9e8430a8abb06c262346e89593278c515
commit-date: 2023-07-19
host: x86_64-pc-windows-msvc
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

error: internal compiler error: compiler\rustc_middle\src\ty\generic_args.rs:900:9: type parameter `impl ToString/#1` (impl ToString/1) out of range when substituting, args=[MyStruct]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/39f42ad9e8430a8abb06c262346e89593278c515\compiler\rustc_errors\src\lib.rs:1651:9

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.73.0-nightly (39f42ad9e 2023-07-19) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib

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

query stack during panic:
#0 [is_impossible_method] checking if `workspace_b::MyTrait::{opaque#0}` is impossible to call within `<impl at workspace-a\src\lib.rs:5:1: 5:26>`
end of query stack
error: could not document `workspace-a`

Caused by:
  process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name workspace_a workspace-a\src\lib.rs -o C:\Users\PhiSyX\Labs\test\rust-doc\target\doc --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=103 -C metadata=3bf3f8c83c26edc0 -L dependency=C:\Users\PhiSyX\Labs\test\rust-doc\target\debug\deps --extern workspace_b=C:\Users\PhiSyX\Labs\test\rust-doc\target\debug\deps\libworkspace_b-797ce636f4eee694.rmeta --crate-version 0.1.0` (exit code: 101)
Backtrace


thread 'rustc' panicked at 'Box<dyn Any>', /rustc/39f42ad9e8430a8abb06c262346e89593278c515\compiler\rustc_errors\src\lib.rs:1651:9
stack backtrace:
   0:     0x7ffd1ffb812c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0dff57502b84ae55
   1:     0x7ffd1fff1e1b - core::fmt::write::h37362cd9ebacde36
   2:     0x7ffd1ffad421 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h84a5016f3ff21fcf
   3:     0x7ffd1ffb7edb - std::sys::common::alloc::realloc_fallback::hc496092f8c3f66af
   4:     0x7ffd1ffbb73a - std::panicking::default_hook::h5affd2c37c289324
   5:     0x7ffd1ffbb397 - std::panicking::default_hook::h5affd2c37c289324
   6:     0x7ffcb3bc8500 - rustc_driver_impl[64a7dfb7d520951d]::describe_lints
   7:     0x7ffd1ffbc038 - std::panicking::rust_panic_with_hook::h6db59a9929652506
   8:     0x7ffcb4d08673 - <rustc_middle[65cd754bbc6f0771]::ty::sty::ExistentialProjection as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
   9:     0x7ffcb4d06bd9 - <rustc_middle[65cd754bbc6f0771]::ty::sty::ExistentialProjection as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
  10:     0x7ffcb4ce0db9 - <rustc_middle[65cd754bbc6f0771]::ty::typeck_results::UserType as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
  11:     0x7ffcb4c9e770 - <rustc_ast[5f794c73ab5b89fb]::ast::InlineAsmOptions as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
  12:     0x7ffcb4c9e54c - <rustc_ast[5f794c73ab5b89fb]::ast::InlineAsmOptions as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
  13:     0x7ffcb4cdb63d - rustc_middle[65cd754bbc6f0771]::util::bug::bug_fmt
  14:     0x7ffcb4cdb12d - rustc_middle[65cd754bbc6f0771]::traits::specialization_graph::ancestors
  15:     0x7ffcb4cdb0fa - rustc_middle[65cd754bbc6f0771]::traits::specialization_graph::ancestors
  16:     0x7ffcb4cdb532 - rustc_middle[65cd754bbc6f0771]::util::bug::bug_fmt
  17:     0x7ffcb4d63365 - <rustc_middle[65cd754bbc6f0771]::ty::generic_args::GenericArg as rustc_middle[65cd754bbc6f0771]::ty::context::Lift>::lift_to_tcx
  18:     0x7ffcb3af9595 - <rustc_middle[65cd754bbc6f0771]::ty::generic_args::ArgFolder as rustc_type_ir[bc2610c847b845b7]::fold::TypeFolder<rustc_middle[65cd754bbc6f0771]::ty::context::TyCtxt>>::fold_ty
  19:     0x7ffcb39b316e - <rustc_middle[65cd754bbc6f0771]::ty::sty::FnSig as rustc_trait_selection[343eaea0290ae000]::traits::query::type_op::normalize::Normalizable>::type_op_method
  20:     0x7ffcb391fb78 - <rustc_trait_selection[343eaea0290ae000]::traits::select::SelectionContext>::poly_select
  21:     0x7ffcb4b16084 - rustc_trait_selection[343eaea0290ae000]::traits::wf::unnormalized_obligations
  22:     0x7ffcb4568f0b - <rustc_query_impl[8cb5bda6a677e261]::plumbing::QueryCtxt as rustc_query_system[9dcbd7aa9d35dd35]::query::QueryContext>::depth_limit_error
  23:     0x7ffcb45e54d6 - <rustc_middle[65cd754bbc6f0771]::ty::generic_args::EarlyBinder<rustc_middle[65cd754bbc6f0771]::ty::Ty> as rustc_query_system[9dcbd7aa9d35dd35]::values::Value<rustc_middle[65cd754bbc6f0771]::ty::context::TyCtxt, rustc_middle[65cd754bbc6f0771]::dep_graph::dep_node::DepKind>>::from_cycle_error
  24:     0x7ffcb35c6bcf - rustc_query_impl[8cb5bda6a677e261]::query_callbacks
  25:     0x7ffcb4608a31 - <rustc_middle[65cd754bbc6f0771]::ty::generic_args::EarlyBinder<rustc_middle[65cd754bbc6f0771]::ty::Ty> as rustc_query_system[9dcbd7aa9d35dd35]::values::Value<rustc_middle[65cd754bbc6f0771]::ty::context::TyCtxt, rustc_middle[65cd754bbc6f0771]::dep_graph::dep_node::DepKind>>::from_cycle_error
  26:     0x7ff6398e3611 - <unknown>
  27:     0x7ff63993d612 - <unknown>
  28:     0x7ff639846ae5 - <unknown>
  29:     0x7ff6398dc78f - <unknown>
  30:     0x7ff6398e1496 - <unknown>
  31:     0x7ff639731ecd - <unknown>
  32:     0x7ffd1fff1e1b - core::fmt::write::h37362cd9ebacde36
  33:     0x7ff6397b4b3d - <unknown>
  34:     0x7ff639775f60 - <unknown>
  35:     0x7ff639784952 - <unknown>
  36:     0x7ff639658115 - <unknown>
  37:     0x7ff63961002b - <unknown>
  38:     0x7ff6397dfab2 - <unknown>
  39:     0x7ff6396197b9 - <unknown>
  40:     0x7ff6396ea9e6 - <unknown>
  41:     0x7ff63961591f - <unknown>
  42:     0x7ff63971766d - <unknown>
  43:     0x7ff63971abae - <unknown>
  44:     0x7ffd1ffcf6cc - std::sys::windows::thread::Thread::new::hb464be62f345c3d5
  45:     0x7ffd5d8b244d - BaseThreadInitThunk
  46:     0x7ffd5eecdf78 - RtlUserThreadStart

Metadata

Metadata

Assignees

Labels

A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.F-return_position_impl_trait_in_trait`#![feature(return_position_impl_trait_in_trait)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions