1use core::ops::ControlFlow;
23use rustc_hir::def_id::{DefId, LocalDefId};
4use rustc_hir::intravisit::{self, Visitor, VisitorExt};
5use rustc_hir::{selfas hir, AmbigArg};
6use rustc_middle::hir::nested_filter;
7use rustc_middle::middle::resolve_bound_varsas rbv;
8use rustc_middle::ty::{self, Region, TyCtxt};
9use tracing::debug;
1011/// This function calls the `visit_ty` method for the parameters
12/// corresponding to the anonymous regions. The `nested_visitor.found_type`
13/// contains the anonymous type.
14///
15/// # Arguments
16/// region - the anonymous region corresponding to the anon_anon conflict
17/// br - the bound region corresponding to the above region which is of type `BrAnon(_)`
18///
19/// # Example
20/// ```compile_fail
21/// fn foo(x: &mut Vec<&u8>, y: &u8)
22/// { x.push(y); }
23/// ```
24/// The function returns the nested type corresponding to the anonymous region
25/// for e.g., `&u8` and `Vec<&u8>`.
26pub fn find_anon_type<'tcx>(
27 tcx: TyCtxt<'tcx>,
28 generic_param_scope: LocalDefId,
29 region: Region<'tcx>,
30) -> Option<(&'tcx hir::Ty<'tcx>, &'tcx hir::FnSig<'tcx>)> {
31let anon_reg = tcx.is_suitable_region(generic_param_scope, region)?;
32let fn_sig = tcx.hir_node_by_def_id(anon_reg.scope).fn_sig()?;
3334fn_sig35 .decl
36 .inputs
37 .iter()
38 .find_map(|arg| find_component_for_bound_region(tcx, arg, anon_reg.region_def_id))
39 .map(|ty| (ty, fn_sig))
40}
4142// This method creates a FindNestedTypeVisitor which returns the type corresponding
43// to the anonymous region.
44fn find_component_for_bound_region<'tcx>(
45 tcx: TyCtxt<'tcx>,
46 arg: &'tcx hir::Ty<'tcx>,
47 region_def_id: DefId,
48) -> Option<&'tcx hir::Ty<'tcx>> {
49FindNestedTypeVisitor { tcx, region_def_id, current_index: ty::INNERMOST }
50 .visit_ty_unambig(arg)
51 .break_value()
52}
5354// The FindNestedTypeVisitor captures the corresponding `hir::Ty` of the
55// anonymous region. The example above would lead to a conflict between
56// the two anonymous lifetimes for &u8 in x and y respectively. This visitor
57// would be invoked twice, once for each lifetime, and would
58// walk the types like &mut Vec<&u8> and &u8 looking for the HIR
59// where that lifetime appears. This allows us to highlight the
60// specific part of the type in the error message.
61struct FindNestedTypeVisitor<'tcx> {
62 tcx: TyCtxt<'tcx>,
63// The `DefId` of the region we're looking for.
64region_def_id: DefId,
65 current_index: ty::DebruijnIndex,
66}
6768impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
69type Result = ControlFlow<&'tcx hir::Ty<'tcx>>;
70type NestedFilter = nested_filter::OnlyBodies;
7172fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
73self.tcx
74 }
7576fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) -> Self::Result {
77match arg.kind {
78 hir::TyKind::FnPtr(_) => {
79self.current_index.shift_in(1);
80let _ = intravisit::walk_ty(self, arg);
81self.current_index.shift_out(1);
82return ControlFlow::Continue(());
83 }
8485 hir::TyKind::TraitObject(bounds, ..) => {
86for bound in bounds {
87self.current_index.shift_in(1);
88let _ = self.visit_poly_trait_ref(bound);
89self.current_index.shift_out(1);
90 }
91 }
9293 hir::TyKind::Ref(lifetime, _) => {
94// the lifetime of the Ref
95let hir_id = lifetime.hir_id;
96match self.tcx.named_bound_var(hir_id) {
97// Find the index of the named region that was part of the
98 // error. We will then search the function parameters for a bound
99 // region at the right depth with the same index
100Some(rbv::ResolvedArg::EarlyBound(id)) => {
101{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:101",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(101u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("EarlyBound id={0:?}",
id) as &dyn Value))])
});
} else { ; }
};debug!("EarlyBound id={:?}", id);
102if id.to_def_id() == self.region_def_id {
103return ControlFlow::Break(arg.as_unambig_ty());
104 }
105 }
106107// Find the index of the named region that was part of the
108 // error. We will then search the function parameters for a bound
109 // region at the right depth with the same index
110Some(rbv::ResolvedArg::LateBound(debruijn_index, _, id)) => {
111{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:111",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(111u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("FindNestedTypeVisitor::visit_ty: LateBound depth = {0:?}",
debruijn_index) as &dyn Value))])
});
} else { ; }
};debug!(
112"FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}",
113 debruijn_index
114 );
115{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:115",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(115u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("LateBound id={0:?}",
id) as &dyn Value))])
});
} else { ; }
};debug!("LateBound id={:?}", id);
116if debruijn_index == self.current_index
117 && id.to_def_id() == self.region_def_id
118 {
119return ControlFlow::Break(arg.as_unambig_ty());
120 }
121 }
122123Some(
124 rbv::ResolvedArg::StaticLifetime125 | rbv::ResolvedArg::Free(_, _)
126 | rbv::ResolvedArg::Error(_),
127 )
128 | None => {
129{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:129",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(129u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("no arg found")
as &dyn Value))])
});
} else { ; }
};debug!("no arg found");
130 }
131 }
132 }
133// Checks if it is of type `hir::TyKind::Path` which corresponds to a struct.
134hir::TyKind::Path(_) => {
135// Prefer using the lifetime in type arguments rather than lifetime arguments.
136intravisit::walk_ty(self, arg)?;
137138// Call `walk_ty` as `visit_ty` is empty.
139return if intravisit::walk_ty(
140&mut TyPathVisitor {
141 tcx: self.tcx,
142 region_def_id: self.region_def_id,
143 current_index: self.current_index,
144 },
145arg,
146 )
147 .is_break()
148 {
149 ControlFlow::Break(arg.as_unambig_ty())
150 } else {
151 ControlFlow::Continue(())
152 };
153 }
154_ => {}
155 }
156// walk the embedded contents: e.g., if we are visiting `Vec<&Foo>`,
157 // go on to visit `&Foo`
158intravisit::walk_ty(self, arg)
159 }
160}
161162// The visitor captures the corresponding `hir::Ty` of the anonymous region
163// in the case of structs ie. `hir::TyKind::Path`.
164// This visitor would be invoked for each lifetime corresponding to a struct,
165// and would walk the types like Vec<Ref> in the above example and Ref looking for the HIR
166// where that lifetime appears. This allows us to highlight the
167// specific part of the type in the error message.
168struct TyPathVisitor<'tcx> {
169 tcx: TyCtxt<'tcx>,
170 region_def_id: DefId,
171 current_index: ty::DebruijnIndex,
172}
173174impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> {
175type Result = ControlFlow<()>;
176type NestedFilter = nested_filter::OnlyBodies;
177178fn maybe_tcx(&mut self) -> Self::MaybeTyCtxt {
179self.tcx
180 }
181182fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) -> Self::Result {
183match self.tcx.named_bound_var(lifetime.hir_id) {
184// the lifetime of the TyPath!
185Some(rbv::ResolvedArg::EarlyBound(id)) => {
186{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:186",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(186u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("EarlyBound id={0:?}",
id) as &dyn Value))])
});
} else { ; }
};debug!("EarlyBound id={:?}", id);
187if id.to_def_id() == self.region_def_id {
188return ControlFlow::Break(());
189 }
190 }
191192Some(rbv::ResolvedArg::LateBound(debruijn_index, _, id)) => {
193{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:193",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(193u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("FindNestedTypeVisitor::visit_ty: LateBound depth = {0:?}",
debruijn_index) as &dyn Value))])
});
} else { ; }
};debug!("FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}", debruijn_index,);
194{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:194",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(194u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("id={0:?}",
id) as &dyn Value))])
});
} else { ; }
};debug!("id={:?}", id);
195if debruijn_index == self.current_index && id.to_def_id() == self.region_def_id {
196return ControlFlow::Break(());
197 }
198 }
199200Some(
201 rbv::ResolvedArg::StaticLifetime202 | rbv::ResolvedArg::Free(_, _)
203 | rbv::ResolvedArg::Error(_),
204 )
205 | None => {
206{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:206",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(206u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("no arg found")
as &dyn Value))])
});
} else { ; }
};debug!("no arg found");
207 }
208 }
209 ControlFlow::Continue(())
210 }
211212fn visit_ty(&mut self, arg: &'tcx hir::Ty<'tcx, AmbigArg>) -> Self::Result {
213// ignore nested types
214 //
215 // If you have a type like `Foo<'a, &Ty>` we
216 // are only interested in the immediate lifetimes ('a).
217 //
218 // Making `visit_ty` empty will ignore the `&Ty` embedded
219 // inside, it will get reached by the outer visitor.
220{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs:220",
"rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/find_anon_type.rs"),
::tracing_core::__macro_support::Option::Some(220u32),
::tracing_core::__macro_support::Option::Some("rustc_trait_selection::error_reporting::infer::nice_region_error::find_anon_type"),
::tracing_core::field::FieldSet::new(&["message"],
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("`Ty` corresponding to a struct is {0:?}",
arg) as &dyn Value))])
});
} else { ; }
};debug!("`Ty` corresponding to a struct is {:?}", arg);
221 ControlFlow::Continue(())
222 }
223}