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

ICE: clippy: inherent_associated_types item_bounds called on DefId(0:6 ~ ambiguous_inherent_assoc_ty #111399

Closed
matthiaskrgr opened this issue May 9, 2023 · 2 comments · Fixed by #111695
Assignees
Labels
A-clippy Area: Clippy C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` 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.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented May 9, 2023

Code

clippy-driver --crate-type lib file.rs

// check-pass
// This test ensures that rustdoc does not panic on inherented associated types
// that are referred to without fully-qualified syntax.

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

pub struct Struct;

impl Struct {
    pub type AssocTy = usize;
    pub const AssocConst: Self::AssocTy = 42;
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (2f2c438dc 2023-05-08)
binary: rustc
commit-hash: 2f2c438dce75d8cc532c3baa849eeddc0901802c
commit-date: 2023-05-08
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_hir_analysis/src/collect/item_bounds.rs:125:14: item_bounds called on DefId(0:6 ~ ambiguous_inherent_assoc_ty[34fe]::{impl#0}::AssocTy)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7fd66116a361 - std::backtrace_rs::backtrace::libunwind::trace::he9e9030cf5bcddaa
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd66116a361 - std::backtrace_rs::backtrace::trace_unsynchronized::hb5e44a77ff0586eb
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd66116a361 - std::sys_common::backtrace::_print_fmt::h38e8723c5d83f22f
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fd66116a361 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5e394c4b1f1cb045
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fd6611ca6ff - core::fmt::rt::Argument::fmt::ha5dde4cb71578cc2
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/core/src/fmt/rt.rs:138:9
   5:     0x7fd6611ca6ff - core::fmt::write::hb1413899fd777907
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/core/src/fmt/mod.rs:1094:21
   6:     0x7fd66115d5c1 - std::io::Write::write_fmt::h08b4eac68313bb0d
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/io/mod.rs:1712:15
   7:     0x7fd66116a175 - std::sys_common::backtrace::_print::h2bb25f41b1777226
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fd66116a175 - std::sys_common::backtrace::print::ha21981aa5a1c5802
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fd66116ce07 - std::panicking::default_hook::{{closure}}::h603ce04329232051
  10:     0x7fd66116cbf4 - std::panicking::default_hook::hd4285764fbdb24e1
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/panicking.rs:288:9
  11:     0x7fd6643bf94b - <rustc_driver_impl[27c68de0ac55b06a]::install_ice_hook::{closure#0} as core[3afeaedfb140cde7]::ops::function::FnOnce<(&core[3afeaedfb140cde7]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7fd66116d527 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h401f21a7538313bc
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/alloc/src/boxed.rs:1999:9
  13:     0x7fd66116d527 - std::panicking::rust_panic_with_hook::h2322eda2481f33bc
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/panicking.rs:695:13
  14:     0x7fd6648ae031 - std[53b54636b4f52653]::panicking::begin_panic::<rustc_errors[2afb0e2cc7c4c42d]::ExplicitBug>::{closure#0}
  15:     0x7fd6648aa7e6 - std[53b54636b4f52653]::sys_common::backtrace::__rust_end_short_backtrace::<std[53b54636b4f52653]::panicking::begin_panic<rustc_errors[2afb0e2cc7c4c42d]::ExplicitBug>::{closure#0}, !>
  16:     0x7fd6648aa6d6 - std[53b54636b4f52653]::panicking::begin_panic::<rustc_errors[2afb0e2cc7c4c42d]::ExplicitBug>
  17:     0x7fd6648a5264 - <rustc_errors[2afb0e2cc7c4c42d]::HandlerInner>::bug::<alloc[a4f318becb59a05]::string::String>
  18:     0x7fd6648a4d76 - <rustc_errors[2afb0e2cc7c4c42d]::Handler>::bug::<alloc[a4f318becb59a05]::string::String>
  19:     0x7fd664931bac - rustc_middle[232bd29a687eeda3]::util::bug::opt_span_bug_fmt::<rustc_span[811089187935bcb6]::span_encoding::Span>::{closure#0}
  20:     0x7fd66493137a - rustc_middle[232bd29a687eeda3]::ty::context::tls::with_opt::<rustc_middle[232bd29a687eeda3]::util::bug::opt_span_bug_fmt<rustc_span[811089187935bcb6]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fd66493134a - rustc_middle[232bd29a687eeda3]::ty::context::tls::with_context_opt::<rustc_middle[232bd29a687eeda3]::ty::context::tls::with_opt<rustc_middle[232bd29a687eeda3]::util::bug::opt_span_bug_fmt<rustc_span[811089187935bcb6]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fd6625c8f8d - rustc_middle[232bd29a687eeda3]::util::bug::bug_fmt
  23:     0x7fd663716ba8 - rustc_hir_analysis[7b141ba67a9c3bd8]::collect::item_bounds::explicit_item_bounds
  24:     0x7fd663b0a6f0 - rustc_query_system[8be5ea0cc4c28ea6]::query::plumbing::try_execute_query::<rustc_query_impl[94005537e54250be]::queries::explicit_item_bounds, rustc_query_impl[94005537e54250be]::plumbing::QueryCtxt>
  25:     0x7fd663b09e3f - rustc_query_impl[94005537e54250be]::get_query::explicit_item_bounds
  26:     0x7fd66373f8ff - rustc_middle[232bd29a687eeda3]::ty::query::query_get_at::<rustc_query_system[8be5ea0cc4c28ea6]::query::caches::DefaultCache<rustc_span[811089187935bcb6]::def_id::DefId, rustc_middle[232bd29a687eeda3]::query::erase::Erased<[u8; 16usize]>>>
  27:     0x7fd663a24568 - rustc_hir_analysis[7b141ba67a9c3bd8]::collect::item_bounds::item_bounds
  28:     0x7fd663b1b6f2 - rustc_query_system[8be5ea0cc4c28ea6]::query::plumbing::try_execute_query::<rustc_query_impl[94005537e54250be]::queries::item_bounds, rustc_query_impl[94005537e54250be]::plumbing::QueryCtxt>
  29:     0x7fd663b1b29f - rustc_query_impl[94005537e54250be]::get_query::item_bounds
  30:     0x7fd662aec72d - <rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::match_projection_obligation_against_definition_bounds
  31:     0x7fd662abba94 - <rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  32:     0x7fd662a867b8 - <rustc_query_system[8be5ea0cc4c28ea6]::dep_graph::graph::DepGraph<rustc_middle[232bd29a687eeda3]::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle[232bd29a687eeda3]::ty::context::TyCtxt, <rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::in_task<<rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core[3afeaedfb140cde7]::result::Result<core[3afeaedfb140cde7]::option::Option<rustc_middle[232bd29a687eeda3]::traits::select::SelectionCandidate>, rustc_middle[232bd29a687eeda3]::traits::SelectionError>>::{closure#0}, core[3afeaedfb140cde7]::result::Result<core[3afeaedfb140cde7]::option::Option<rustc_middle[232bd29a687eeda3]::traits::select::SelectionCandidate>, rustc_middle[232bd29a687eeda3]::traits::SelectionError>>
  33:     0x7fd662a81d03 - <rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::evaluate_stack
  34:     0x7fd662fe7c0f - <rustc_trait_selection[3f922efa7a809006]::traits::select::SelectionContext>::evaluate_predicate_recursively
  35:     0x7fd662b6889c - rustc_traits[25c73fbcfaba5379]::evaluate_obligation::evaluate_obligation
  36:     0x7fd662b66607 - rustc_query_system[8be5ea0cc4c28ea6]::query::plumbing::try_execute_query::<rustc_query_impl[94005537e54250be]::queries::evaluate_obligation, rustc_query_impl[94005537e54250be]::plumbing::QueryCtxt>
  37:     0x7fd662683741 - <rustc_infer[11979153bc07d692]::infer::InferCtxt as rustc_trait_selection[3f922efa7a809006]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  38:     0x7fd662f7e8cf - rustc_ty_utils[715b58352551311c]::common_traits::is_item_raw
  39:     0x7fd662be6020 - rustc_query_system[8be5ea0cc4c28ea6]::query::plumbing::try_execute_query::<rustc_query_impl[94005537e54250be]::queries::is_freeze_raw, rustc_query_impl[94005537e54250be]::plumbing::QueryCtxt>
  40:     0x7fd662c7b14e - <rustc_middle[232bd29a687eeda3]::ty::Ty>::is_freeze
  41:     0x55d9e3f08951 - <clippy_lints[cb7769da6400a715]::non_copy_const::NonCopyConst as rustc_lint[f5703fc1484f1a7a]::passes::LateLintPass>::check_impl_item
  42:     0x7fd66477e586 - <rustc_lint[f5703fc1484f1a7a]::early::RuntimeCombinedEarlyLintPass as rustc_lint[f5703fc1484f1a7a]::passes::EarlyLintPass>::check_attribute
  43:     0x7fd664753cd6 - <rustc_lint[f5703fc1484f1a7a]::late::LateContextAndPass<rustc_lint[f5703fc1484f1a7a]::late::RuntimeCombinedLateLintPass> as rustc_hir[2c98ace9d294e49]::intravisit::Visitor>::visit_nested_impl_item
  44:     0x7fd6647320f7 - rustc_hir[2c98ace9d294e49]::intravisit::walk_item::<rustc_lint[f5703fc1484f1a7a]::late::LateContextAndPass<rustc_lint[f5703fc1484f1a7a]::late::RuntimeCombinedLateLintPass>>
  45:     0x7fd664753b82 - <rustc_lint[f5703fc1484f1a7a]::late::LateContextAndPass<rustc_lint[f5703fc1484f1a7a]::late::RuntimeCombinedLateLintPass> as rustc_hir[2c98ace9d294e49]::intravisit::Visitor>::visit_nested_item
  46:     0x7fd66473169c - rustc_hir[2c98ace9d294e49]::intravisit::walk_mod::<rustc_lint[f5703fc1484f1a7a]::late::LateContextAndPass<rustc_lint[f5703fc1484f1a7a]::late::RuntimeCombinedLateLintPass>>
  47:     0x7fd663a2c851 - rustc_lint[f5703fc1484f1a7a]::late::late_lint_crate::<rustc_lint[f5703fc1484f1a7a]::BuiltinCombinedLateLintPass>
  48:     0x7fd663a2bb90 - <rustc_session[f2a4139b8ec92988]::session::Session>::time::<(), rustc_lint[f5703fc1484f1a7a]::late::check_crate<rustc_lint[f5703fc1484f1a7a]::BuiltinCombinedLateLintPass, rustc_interface[1005215f39c21569]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}::{closure#0}>::{closure#0}::{closure#0}>
  49:     0x7fd663ab08e9 - <rustc_session[f2a4139b8ec92988]::session::Session>::time::<(), rustc_interface[1005215f39c21569]::passes::analysis::{closure#5}::{closure#1}::{closure#2}::{closure#0}>
  50:     0x7fd6637ef01f - <core[3afeaedfb140cde7]::panic::unwind_safe::AssertUnwindSafe<rustc_interface[1005215f39c21569]::passes::analysis::{closure#5}::{closure#1}> as core[3afeaedfb140cde7]::ops::function::FnOnce<()>>::call_once
  51:     0x7fd6637eaa8f - rustc_interface[1005215f39c21569]::passes::analysis
  52:     0x7fd663b2bd47 - rustc_query_system[8be5ea0cc4c28ea6]::query::plumbing::try_execute_query::<rustc_query_impl[94005537e54250be]::queries::analysis, rustc_query_impl[94005537e54250be]::plumbing::QueryCtxt>
  53:     0x7fd663b2ba63 - rustc_query_impl[94005537e54250be]::get_query::analysis
  54:     0x7fd6635ccbcf - <rustc_middle[232bd29a687eeda3]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[27c68de0ac55b06a]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>>
  55:     0x7fd6635cbcaf - <rustc_interface[1005215f39c21569]::interface::Compiler>::enter::<rustc_driver_impl[27c68de0ac55b06a]::run_compiler::{closure#1}::{closure#2}, core[3afeaedfb140cde7]::result::Result<core[3afeaedfb140cde7]::option::Option<rustc_interface[1005215f39c21569]::queries::Linker>, rustc_span[811089187935bcb6]::ErrorGuaranteed>>
  56:     0x7fd6635c933b - std[53b54636b4f52653]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1005215f39c21569]::util::run_in_thread_pool_with_globals<rustc_interface[1005215f39c21569]::interface::run_compiler<core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>, rustc_driver_impl[27c68de0ac55b06a]::run_compiler::{closure#1}>::{closure#0}, core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>>
  57:     0x7fd663c98f55 - <<std[53b54636b4f52653]::thread::Builder>::spawn_unchecked_<rustc_interface[1005215f39c21569]::util::run_in_thread_pool_with_globals<rustc_interface[1005215f39c21569]::interface::run_compiler<core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>, rustc_driver_impl[27c68de0ac55b06a]::run_compiler::{closure#1}>::{closure#0}, core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3afeaedfb140cde7]::result::Result<(), rustc_span[811089187935bcb6]::ErrorGuaranteed>>::{closure#1} as core[3afeaedfb140cde7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  58:     0x7fd6611779d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h20fe0a24dda744f1
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/alloc/src/boxed.rs:1985:9
  59:     0x7fd6611779d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb11b4529d66356f4
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/alloc/src/boxed.rs:1985:9
  60:     0x7fd6611779d5 - std::sys::unix::thread::Thread::new::thread_start::h896be1b4ceadbc98
                               at /rustc/2f2c438dce75d8cc532c3baa849eeddc0901802c/library/std/src/sys/unix/thread.rs:108:17
  61:     0x7fd660e2bbb5 - <unknown>
  62:     0x7fd660eadd90 - <unknown>
  63:                0x0 - <unknown>

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: rustc 1.71.0-nightly (2f2c438dc 2023-05-08) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
#0 [explicit_item_bounds] finding item bounds for `<impl at /home/matthias/vcs/github/rust_icemaker/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs:10:1: 10:12>::AssocTy`
#1 [item_bounds] elaborating item bounds for `<impl at /home/matthias/vcs/github/rust_icemaker/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs:10:1: 10:12>::AssocTy`
#2 [evaluate_obligation] evaluating trait selection obligation `<impl at /home/matthias/vcs/github/rust_icemaker/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs:10:1: 10:12>::AssocTy: core::marker::Freeze`
#3 [is_freeze_raw] computing whether `<impl at /home/matthias/vcs/github/rust_icemaker/tests/rustdoc-ui/ambiguous-inherent-assoc-ty.rs:10:1: 10:12>::AssocTy` is freeze
#4 [analysis] running analysis passes on this crate
end of query stack
note: Clippy version: clippy 0.1.71 (2f2c438 2023-05-08)

error: aborting due to previous error

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. A-clippy Area: Clippy labels May 9, 2023
@matthiaskrgr
Copy link
Member Author

This might also be related to #109410 cc @fmease

@fmease
Copy link
Member

fmease commented May 9, 2023

@rustbot label F-inherent_associated_types
@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy C-bug Category: This is a bug. F-inherent_associated_types `#![feature(inherent_associated_types)]` 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants