1use std::collections::hash_map::Entry;
2
3use rustc_data_structures::fx::FxHashMap;
4use rustc_hir::def_id::DefId;
5use rustc_middle::ty::error::TypeError;
6use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
7use rustc_type_ir::relate::relate_args_with_variances;
8use tracing::instrument;
9
10use crate::infer::region_constraints::VerifyIfEq;
11use crate::infer::relate::{self as relate, Relate, RelateResult, TypeRelation};
12
13#[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("extract_verify_if_eq",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(38u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["verify_if_eq_b",
"test_ty"],
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&verify_if_eq_b)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&test_ty)
as &dyn 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: Option<ty::Region<'tcx>> =
loop {};
return __tracing_attr_fake_return;
}
{
if !!verify_if_eq_b.has_escaping_bound_vars() {
::core::panicking::panic("assertion failed: !verify_if_eq_b.has_escaping_bound_vars()")
};
let mut m = MatchAgainstHigherRankedOutlives::new(tcx);
let verify_if_eq = verify_if_eq_b.skip_binder();
let (verify_ty, test_ty) =
ty::set_aliases_to_non_rigid(tcx,
(verify_if_eq.ty, test_ty)).skip_norm_wip();
m.relate(verify_ty, test_ty).ok()?;
if let ty::RegionKind::ReBound(index_kind, br) =
verify_if_eq.bound.kind() {
if !#[allow(non_exhaustive_omitted_patterns)] match index_kind
{
ty::BoundVarIndexKind::Bound(ty::INNERMOST) => true,
_ => false,
} {
::core::panicking::panic("assertion failed: matches!(index_kind, ty::BoundVarIndexKind::Bound(ty::INNERMOST))")
};
match m.map.get(&br) {
Some(&r) => Some(r),
None => { Some(tcx.lifetimes.re_static) }
}
} else { Some(verify_if_eq.bound) }
}
}
}#[instrument(level = "debug", skip(tcx))]
39pub fn extract_verify_if_eq<'tcx>(
40 tcx: TyCtxt<'tcx>,
41 verify_if_eq_b: &ty::Binder<'tcx, VerifyIfEq<'tcx>>,
42 test_ty: Ty<'tcx>,
43) -> Option<ty::Region<'tcx>> {
44 assert!(!verify_if_eq_b.has_escaping_bound_vars());
45 let mut m = MatchAgainstHigherRankedOutlives::new(tcx);
46 let verify_if_eq = verify_if_eq_b.skip_binder();
47 let (verify_ty, test_ty) =
52 ty::set_aliases_to_non_rigid(tcx, (verify_if_eq.ty, test_ty)).skip_norm_wip();
53 m.relate(verify_ty, test_ty).ok()?;
54
55 if let ty::RegionKind::ReBound(index_kind, br) = verify_if_eq.bound.kind() {
56 assert!(matches!(index_kind, ty::BoundVarIndexKind::Bound(ty::INNERMOST)));
57 match m.map.get(&br) {
58 Some(&r) => Some(r),
59 None => {
60 Some(tcx.lifetimes.re_static)
63 }
64 }
65 } else {
66 Some(verify_if_eq.bound)
76 }
77}
78
79#[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("can_match_erased_ty",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(80u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["outlives_predicate",
"erased_ty"],
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&outlives_predicate)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&erased_ty)
as &dyn 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: bool = loop {};
return __tracing_attr_fake_return;
}
{
if !!outlives_predicate.has_escaping_bound_vars() {
::core::panicking::panic("assertion failed: !outlives_predicate.has_escaping_bound_vars()")
};
let erased_outlives_predicate =
tcx.erase_and_anonymize_regions(outlives_predicate);
let outlives_ty = erased_outlives_predicate.skip_binder().0;
let (outlives_ty, erased_ty) =
ty::set_aliases_to_non_rigid(tcx,
(outlives_ty, erased_ty)).skip_normalization();
if outlives_ty == erased_ty {
true
} else {
MatchAgainstHigherRankedOutlives::new(tcx).relate(outlives_ty,
erased_ty).is_ok()
}
}
}
}#[instrument(level = "debug", skip(tcx))]
81pub(super) fn can_match_erased_ty<'tcx>(
82 tcx: TyCtxt<'tcx>,
83 outlives_predicate: ty::Binder<'tcx, ty::TypeOutlivesPredicate<'tcx>>,
84 erased_ty: Ty<'tcx>,
85) -> bool {
86 assert!(!outlives_predicate.has_escaping_bound_vars());
87 let erased_outlives_predicate = tcx.erase_and_anonymize_regions(outlives_predicate);
88 let outlives_ty = erased_outlives_predicate.skip_binder().0;
89 let (outlives_ty, erased_ty) =
94 ty::set_aliases_to_non_rigid(tcx, (outlives_ty, erased_ty)).skip_normalization();
95 if outlives_ty == erased_ty {
96 true
98 } else {
99 MatchAgainstHigherRankedOutlives::new(tcx).relate(outlives_ty, erased_ty).is_ok()
100 }
101}
102
103struct MatchAgainstHigherRankedOutlives<'tcx> {
104 tcx: TyCtxt<'tcx>,
105 pattern_depth: ty::DebruijnIndex,
106 map: FxHashMap<ty::BoundRegion<'tcx>, ty::Region<'tcx>>,
107}
108
109impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
110 fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstHigherRankedOutlives<'tcx> {
111 MatchAgainstHigherRankedOutlives {
112 tcx,
113 pattern_depth: ty::INNERMOST,
114 map: FxHashMap::default(),
115 }
116 }
117}
118
119impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
120 fn no_match<T>(&self) -> RelateResult<'tcx, T> {
122 Err(TypeError::Mismatch)
123 }
124
125 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("bind",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(127u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["br", "value"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&br)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
as &dyn 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:
RelateResult<'tcx, ty::Region<'tcx>> = loop {};
return __tracing_attr_fake_return;
}
{
match self.map.entry(br) {
Entry::Occupied(entry) => {
if *entry.get() == value {
Ok(value)
} else { self.no_match() }
}
Entry::Vacant(entry) => { entry.insert(value); Ok(value) }
}
}
}
}#[instrument(level = "trace", skip(self))]
128 fn bind(
129 &mut self,
130 br: ty::BoundRegion<'tcx>,
131 value: ty::Region<'tcx>,
132 ) -> RelateResult<'tcx, ty::Region<'tcx>> {
133 match self.map.entry(br) {
134 Entry::Occupied(entry) => {
135 if *entry.get() == value {
136 Ok(value)
137 } else {
138 self.no_match()
139 }
140 }
141 Entry::Vacant(entry) => {
142 entry.insert(value);
143 Ok(value)
144 }
145 }
146 }
147}
148
149impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstHigherRankedOutlives<'tcx> {
150 fn cx(&self) -> TyCtxt<'tcx> {
151 self.tcx
152 }
153
154 fn relate_ty_args(
155 &mut self,
156 a_ty: Ty<'tcx>,
157 _: Ty<'tcx>,
158 def_id: DefId,
159 a_args: ty::GenericArgsRef<'tcx>,
160 b_args: ty::GenericArgsRef<'tcx>,
161 _: impl FnOnce(ty::GenericArgsRef<'tcx>) -> Ty<'tcx>,
162 ) -> RelateResult<'tcx, Ty<'tcx>> {
163 let variances = self.cx().variances_of(def_id);
164 relate_args_with_variances(self, variances, a_args, b_args)?;
165 Ok(a_ty)
166 }
167
168 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("relate_with_variance",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(168u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["variance", "a",
"b"], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&variance)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&a)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&b)
as &dyn 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: RelateResult<'tcx, T> = loop {};
return __tracing_attr_fake_return;
}
{ if variance != ty::Bivariant { self.relate(a, b) } else { Ok(a) } }
}
}#[instrument(level = "trace", skip(self))]
169 fn relate_with_variance<T: Relate<TyCtxt<'tcx>>>(
170 &mut self,
171 variance: ty::Variance,
172 _: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
173 a: T,
174 b: T,
175 ) -> RelateResult<'tcx, T> {
176 if variance != ty::Bivariant { self.relate(a, b) } else { Ok(a) }
183 }
184
185 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("regions",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(185u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["pattern", "value"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
as &dyn 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:
RelateResult<'tcx, ty::Region<'tcx>> = loop {};
return __tracing_attr_fake_return;
}
{
if let ty::RegionKind::ReBound(ty::BoundVarIndexKind::Bound(depth),
br) = pattern.kind() && depth == self.pattern_depth {
self.bind(br, value)
} else if pattern == value {
Ok(pattern)
} else { self.no_match() }
}
}
}#[instrument(skip(self), level = "trace")]
186 fn regions(
187 &mut self,
188 pattern: ty::Region<'tcx>,
189 value: ty::Region<'tcx>,
190 ) -> RelateResult<'tcx, ty::Region<'tcx>> {
191 if let ty::RegionKind::ReBound(ty::BoundVarIndexKind::Bound(depth), br) = pattern.kind()
192 && depth == self.pattern_depth
193 {
194 self.bind(br, value)
195 } else if pattern == value {
196 Ok(pattern)
197 } else {
198 self.no_match()
199 }
200 }
201
202 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("tys",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(202u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["pattern", "value"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
as &dyn 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: RelateResult<'tcx, Ty<'tcx>> =
loop {};
return __tracing_attr_fake_return;
}
{
if #[allow(non_exhaustive_omitted_patterns)] match pattern.kind()
{
ty::Error(_) | ty::Bound(..) => true,
_ => false,
} {
self.no_match()
} else if pattern == value {
Ok(pattern)
} else { relate::structurally_relate_tys(self, pattern, value) }
}
}
}#[instrument(skip(self), level = "trace")]
203 fn tys(&mut self, pattern: Ty<'tcx>, value: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
204 if matches!(pattern.kind(), ty::Error(_) | ty::Bound(..)) {
206 self.no_match()
208 } else if pattern == value {
209 Ok(pattern)
210 } else {
211 relate::structurally_relate_tys(self, pattern, value)
212 }
213 }
214
215 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("consts",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(215u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["pattern", "value"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
as &dyn 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:
RelateResult<'tcx, ty::Const<'tcx>> = loop {};
return __tracing_attr_fake_return;
}
{
if pattern == value {
Ok(pattern)
} else {
relate::structurally_relate_consts(self, pattern, value)
}
}
}
}#[instrument(skip(self), level = "trace")]
216 fn consts(
217 &mut self,
218 pattern: ty::Const<'tcx>,
219 value: ty::Const<'tcx>,
220 ) -> RelateResult<'tcx, ty::Const<'tcx>> {
221 if pattern == value {
222 Ok(pattern)
223 } else {
224 relate::structurally_relate_consts(self, pattern, value)
225 }
226 }
227
228 #[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::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("binders",
"rustc_infer::infer::outlives::test_type_match",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/test_type_match.rs"),
::tracing_core::__macro_support::Option::Some(228u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&["pattern", "value"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::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};
let mut iter = meta.fields().iter();
meta.fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn Value)),
(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
as &dyn 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:
RelateResult<'tcx, ty::Binder<'tcx, T>> = loop {};
return __tracing_attr_fake_return;
}
{
self.pattern_depth.shift_in(1);
let result =
Ok(pattern.rebind(self.relate(pattern.skip_binder(),
value.skip_binder())?));
self.pattern_depth.shift_out(1);
result
}
}
}#[instrument(skip(self), level = "trace")]
229 fn binders<T>(
230 &mut self,
231 pattern: ty::Binder<'tcx, T>,
232 value: ty::Binder<'tcx, T>,
233 ) -> RelateResult<'tcx, ty::Binder<'tcx, T>>
234 where
235 T: Relate<TyCtxt<'tcx>>,
236 {
237 self.pattern_depth.shift_in(1);
238 let result = Ok(pattern.rebind(self.relate(pattern.skip_binder(), value.skip_binder())?));
239 self.pattern_depth.shift_out(1);
240 result
241 }
242}