1use rustc_data_structures::unord::UnordSet;
4use rustc_hir::def_id::DefId;
5use rustc_infer::traits::{self, ObligationCause, PredicateObligations};
6use rustc_middle::ty::{self, Ty, TypeVisitableExt};
7use rustc_span::Span;
8use rustc_trait_selection::solve::Certainty;
9use rustc_trait_selection::solve::inspect::{
10 InferCtxtProofTreeExt, InspectConfig, InspectGoal, ProofTreeVisitor,
11};
12use tracing::{debug, instrument, trace};
13
14use crate::FnCtxt;
15
16#[derive(#[automatically_derived]
impl ::core::fmt::Debug for UseSubtyping {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
UseSubtyping::No => "No",
UseSubtyping::Yes => "Yes",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for UseSubtyping { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UseSubtyping {
#[inline]
fn clone(&self) -> UseSubtyping { *self }
}Clone)]
18pub(crate) enum UseSubtyping {
19 No,
22
23 Yes,
29}
30
31impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
32 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("obligations_for_self_ty",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(34u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("self_ty")
}> =
::tracing::__macro_support::FieldName::new("self_ty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("subtyping")
}> =
::tracing::__macro_support::FieldName::new("subtyping");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&self_ty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&subtyping)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: PredicateObligations<'tcx> =
loop {};
return __tracing_attr_fake_return;
}
{
if self.next_trait_solver() {
self.obligations_for_self_ty_next(self_ty, subtyping)
} else {
let mut obligations =
self.fulfillment_cx.borrow().pending_obligations();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs:44",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(44u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("pending_obligations = {0:#?}",
obligations) as &dyn ::tracing::field::Value))])
});
} else { ; }
};
obligations.retain(|obligation|
{
self.predicate_has_self_ty(obligation.predicate, self_ty,
subtyping)
});
obligations
}
}
}
}#[instrument(skip(self), level = "debug")]
35 pub(crate) fn obligations_for_self_ty(
36 &self,
37 self_ty: ty::TyVid,
38 subtyping: UseSubtyping,
39 ) -> PredicateObligations<'tcx> {
40 if self.next_trait_solver() {
41 self.obligations_for_self_ty_next(self_ty, subtyping)
42 } else {
43 let mut obligations = self.fulfillment_cx.borrow().pending_obligations();
44 trace!("pending_obligations = {:#?}", obligations);
45 obligations.retain(|obligation| {
46 self.predicate_has_self_ty(obligation.predicate, self_ty, subtyping)
47 });
48 obligations
49 }
50 }
51
52 x;#[instrument(level = "debug", skip(self), ret)]
53 fn predicate_has_self_ty(
54 &self,
55 predicate: ty::Predicate<'tcx>,
56 expected_vid: ty::TyVid,
57 subtyping: UseSubtyping,
58 ) -> bool {
59 match predicate.kind().skip_binder() {
60 ty::PredicateKind::Clause(ty::ClauseKind::Trait(data)) => {
61 self.type_matches_expected_vid(data.self_ty(), expected_vid, subtyping)
62 }
63 ty::PredicateKind::Clause(ty::ClauseKind::Projection(data)) => {
64 if data.projection_term.kind.is_trait_projection() {
65 self.type_matches_expected_vid(data.self_ty(), expected_vid, subtyping)
66 } else {
67 false
68 }
69 }
70 ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(..))
71 | ty::PredicateKind::Subtype(..)
72 | ty::PredicateKind::Coerce(..)
73 | ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(..))
74 | ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(..))
75 | ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(..))
76 | ty::PredicateKind::DynCompatible(..)
77 | ty::PredicateKind::NormalizesTo(..)
78 | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
79 | ty::PredicateKind::ConstEquate(..)
80 | ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(..))
81 | ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
82 | ty::PredicateKind::Ambiguous => false,
83 }
84 }
85
86 x;#[instrument(level = "debug", skip(self), ret)]
87 fn type_matches_expected_vid(
88 &self,
89 ty: Ty<'tcx>,
90 expected_vid: ty::TyVid,
91 subtyping: UseSubtyping,
92 ) -> bool {
93 let ty = self.shallow_resolve(ty);
94 debug!(?ty);
95
96 match *ty.kind() {
97 ty::Infer(ty::TyVar(found_vid)) => match subtyping {
98 UseSubtyping::No => self.root_var(expected_vid) == self.root_var(found_vid),
99 UseSubtyping::Yes => {
100 self.sub_unification_table_root_var(expected_vid)
101 == self.sub_unification_table_root_var(found_vid)
102 }
103 },
104 _ => false,
105 }
106 }
107
108 pub(crate) fn obligations_for_self_ty_next(
109 &self,
110 self_ty: ty::TyVid,
111 subtyping: UseSubtyping,
112 ) -> PredicateObligations<'tcx> {
113 let sub_root_var = self.sub_unification_table_root_var(self_ty);
121 let obligations = self
122 .fulfillment_cx
123 .borrow()
124 .pending_obligations_potentially_referencing_sub_root(&self.infcx, sub_root_var);
125 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs:125",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(125u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("obligations")
}> =
::tracing::__macro_support::FieldName::new("obligations");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&obligations)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?obligations);
126
127 let mut obligations_for_self_ty = PredicateObligations::new();
128 for obligation in obligations {
129 let mut visitor = NestedObligationsForSelfTy {
130 fcx: self,
131 self_ty,
132 obligations_for_self_ty: &mut obligations_for_self_ty,
133 root_cause: &obligation.cause,
134 subtyping,
135 };
136
137 let goal = obligation.as_goal();
138 self.visit_proof_tree(goal, &mut visitor);
139 }
140
141 obligations_for_self_ty.retain_mut(|obligation| {
142 obligation.predicate = self.resolve_vars_if_possible(obligation.predicate);
143 !obligation.predicate.has_placeholders()
144 });
145 obligations_for_self_ty
146 }
147
148 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("from_float_for_f32_root_vids",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(149u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&[],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{ meta.fields().value_set_all(&[]) })
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: UnordSet<ty::FloatVid> = loop {};
return __tracing_attr_fake_return;
}
{
if self.next_trait_solver() {
self.from_float_for_f32_root_vids_next()
} else {
let Some(from_trait) =
self.tcx.lang_items().from_trait() else {
return UnordSet::new();
};
self.fulfillment_cx.borrow_mut().pending_obligations().into_iter().filter_map(|obligation|
{
self.predicate_from_float_for_f32_root_vid(from_trait,
obligation.predicate)
}).collect()
}
}
}
}#[instrument(skip(self), level = "debug")]
150 pub(crate) fn from_float_for_f32_root_vids(&self) -> UnordSet<ty::FloatVid> {
151 if self.next_trait_solver() {
152 self.from_float_for_f32_root_vids_next()
153 } else {
154 let Some(from_trait) = self.tcx.lang_items().from_trait() else {
155 return UnordSet::new();
156 };
157 self.fulfillment_cx
158 .borrow_mut()
159 .pending_obligations()
160 .into_iter()
161 .filter_map(|obligation| {
162 self.predicate_from_float_for_f32_root_vid(from_trait, obligation.predicate)
163 })
164 .collect()
165 }
166 }
167
168 fn predicate_from_float_for_f32_root_vid(
169 &self,
170 from_trait: DefId,
171 predicate: ty::Predicate<'tcx>,
172 ) -> Option<ty::FloatVid> {
173 match predicate.kind().no_bound_vars() {
177 Some(ty::PredicateKind::Clause(ty::ClauseKind::Trait(ty::TraitPredicate {
178 polarity: ty::PredicatePolarity::Positive,
179 trait_ref,
180 }))) if trait_ref.def_id == from_trait
181 && self.shallow_resolve(trait_ref.self_ty()).kind()
182 == &ty::Float(ty::FloatTy::F32) =>
183 {
184 self.root_float_vid(trait_ref.args.type_at(1))
185 }
186 _ => None,
187 }
188 }
189
190 fn from_float_for_f32_root_vids_next(&self) -> UnordSet<ty::FloatVid> {
191 let Some(from_trait) = self.tcx.lang_items().from_trait() else {
192 return UnordSet::new();
193 };
194 let obligations = self
195 .fulfillment_cx
196 .borrow()
197 .pending_obligations_potentially_referencing_float_infer(self);
198 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs:198",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(198u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("obligations")
}> =
::tracing::__macro_support::FieldName::new("obligations");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&obligations)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?obligations);
199 let mut vids = UnordSet::new();
200 for obligation in obligations {
201 let mut visitor = FindFromFloatForF32RootVids {
202 fcx: self,
203 from_trait,
204 vids: &mut vids,
205 span: obligation.cause.span,
206 };
207
208 let goal = obligation.as_goal();
209 self.visit_proof_tree(goal, &mut visitor);
210 }
211 vids
212 }
213}
214
215const MAX_DEPTH_FOR_OBLIGATIONS_VISITORS: usize = 5;
219
220struct NestedObligationsForSelfTy<'a, 'tcx> {
221 fcx: &'a FnCtxt<'a, 'tcx>,
222 self_ty: ty::TyVid,
223 root_cause: &'a ObligationCause<'tcx>,
224 obligations_for_self_ty: &'a mut PredicateObligations<'tcx>,
225 subtyping: UseSubtyping,
226}
227
228impl<'tcx> ProofTreeVisitor<'tcx> for NestedObligationsForSelfTy<'_, 'tcx> {
229 fn span(&self) -> Span {
230 self.root_cause.span
231 }
232
233 fn config(&self) -> InspectConfig {
234 InspectConfig { max_depth: MAX_DEPTH_FOR_OBLIGATIONS_VISITORS }
235 }
236
237 fn visit_goal(&mut self, inspect_goal: &InspectGoal<'_, 'tcx>) {
238 if inspect_goal.result() == Ok(Certainty::Yes) {
241 return;
242 }
243
244 if !inspect_goal
247 .orig_values()
248 .iter()
249 .filter_map(|arg| arg.as_type())
250 .any(|ty| self.fcx.type_matches_expected_vid(ty, self.self_ty, self.subtyping))
251 {
252 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs:252",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(252u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&["message",
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("goal does not mention self type")
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&inspect_goal.goal())
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(goal = ?inspect_goal.goal(), "goal does not mention self type");
253 return;
254 }
255
256 let tcx = self.fcx.tcx;
257 let goal = inspect_goal.goal();
258 if self.fcx.predicate_has_self_ty(goal.predicate, self.self_ty, self.subtyping) {
259 self.obligations_for_self_ty.push(traits::Obligation::new(
260 tcx,
261 self.root_cause.clone(),
262 goal.param_env,
263 goal.predicate,
264 ));
265 }
266
267 if let Some(candidate) = inspect_goal.unique_applicable_candidate() {
272 candidate.visit_nested_no_probe(self)
273 }
274 }
275}
276
277struct FindFromFloatForF32RootVids<'a, 'tcx> {
278 fcx: &'a FnCtxt<'a, 'tcx>,
279 from_trait: DefId,
280 vids: &'a mut UnordSet<ty::FloatVid>,
281 span: Span,
282}
283
284impl<'tcx> ProofTreeVisitor<'tcx> for FindFromFloatForF32RootVids<'_, 'tcx> {
285 fn span(&self) -> Span {
286 self.span
287 }
288
289 fn config(&self) -> InspectConfig {
290 InspectConfig { max_depth: MAX_DEPTH_FOR_OBLIGATIONS_VISITORS }
291 }
292
293 fn visit_goal(&mut self, inspect_goal: &InspectGoal<'_, 'tcx>) {
294 if inspect_goal.result() == Ok(Certainty::Yes) {
297 return;
298 }
299
300 if !inspect_goal
303 .orig_values()
304 .iter()
305 .filter_map(|arg| arg.as_type())
306 .any(|ty| #[allow(non_exhaustive_omitted_patterns)] match self.fcx.shallow_resolve(ty).kind()
{
ty::Infer(ty::FloatVar(_)) => true,
_ => false,
}matches!(self.fcx.shallow_resolve(ty).kind(), ty::Infer(ty::FloatVar(_))))
307 {
308 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs:308",
"rustc_hir_typeck::fn_ctxt::inspect_obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_hir_typeck/src/fn_ctxt/inspect_obligations.rs"),
::tracing_core::__macro_support::Option::Some(308u32),
::tracing_core::__macro_support::Option::Some("rustc_hir_typeck::fn_ctxt::inspect_obligations"),
::tracing_core::field::FieldSet::new(&["message",
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("goal does not mention float infer var")
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&inspect_goal.goal())
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(goal = ?inspect_goal.goal(), "goal does not mention float infer var");
309 return;
310 }
311
312 if let Some(vid) = self
313 .fcx
314 .predicate_from_float_for_f32_root_vid(self.from_trait, inspect_goal.goal().predicate)
315 {
316 self.vids.insert(vid);
317 }
318
319 if let Some(candidate) = inspect_goal.unique_applicable_candidate() {
320 candidate.visit_nested_no_probe(self);
321 }
322 }
323}