Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions compiler/rustc_middle/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::fmt::Write;
use std::ops::ControlFlow;

use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync;
use rustc_errors::codes::*;
use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err};
use rustc_hir as hir;
Expand Down Expand Up @@ -50,9 +51,18 @@ impl<'tcx> Value<TyCtxt<'tcx>> for ty::Binder<'_, ty::FnSig<'_>> {
) -> Self {
let err = Ty::new_error(tcx, guar);

let arity = if let Some(frame) = cycle_error.cycle.get(0)
&& frame.query.dep_kind == dep_kinds::fn_sig
&& let Some(def_id) = frame.query.def_id
let frame = cycle_error.cycle.first().map(|info| &info.query).or_else(|| {
// FIXME: patchwork for #142064
if !sync::is_dyn_thread_safe() {
tcx.dcx().abort_if_errors();
unreachable!()
}
cycle_error.usage.as_ref().map(|(_, query)| query)
});

let arity = if let Some(frame) = frame
&& frame.dep_kind == dep_kinds::fn_sig
&& let Some(def_id) = frame.def_id
&& let Some(node) = tcx.hir_get_if_local(def_id)
&& let Some(sig) = node.fn_sig()
{
Expand Down
Loading