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(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("verify_if_eq_b")
}> =
::tracing::__macro_support::FieldName::new("verify_if_eq_b");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("test_ty")
}> =
::tracing::__macro_support::FieldName::new("test_ty");
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(&verify_if_eq_b)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&test_ty)
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: 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();
if true {
if !(!tcx.next_trait_solver_globally() ||
!(verify_if_eq.ty, test_ty).has_non_rigid_aliases()) {
::core::panicking::panic("assertion failed: !tcx.next_trait_solver_globally() ||\n !(verify_if_eq.ty, test_ty).has_non_rigid_aliases()")
};
};
m.relate(verify_if_eq.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 debug_assert!(
48 !tcx.next_trait_solver_globally() || !(verify_if_eq.ty, test_ty).has_non_rigid_aliases()
49 );
50 m.relate(verify_if_eq.ty, test_ty).ok()?;
51
52 if let ty::RegionKind::ReBound(index_kind, br) = verify_if_eq.bound.kind() {
53 assert!(matches!(index_kind, ty::BoundVarIndexKind::Bound(ty::INNERMOST)));
54 match m.map.get(&br) {
55 Some(&r) => Some(r),
56 None => {
57 Some(tcx.lifetimes.re_static)
60 }
61 }
62 } else {
63 Some(verify_if_eq.bound)
73 }
74}
75
76#[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(77u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("outlives_clause")
}> =
::tracing::__macro_support::FieldName::new("outlives_clause");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("erased_ty")
}> =
::tracing::__macro_support::FieldName::new("erased_ty");
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(&outlives_clause)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&erased_ty)
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: bool = loop {};
return __tracing_attr_fake_return;
}
{
if !!outlives_clause.has_escaping_bound_vars() {
::core::panicking::panic("assertion failed: !outlives_clause.has_escaping_bound_vars()")
};
let erased_outlives_clause =
tcx.erase_and_anonymize_regions(outlives_clause);
let outlives_ty = erased_outlives_clause.skip_binder().0;
if outlives_ty == erased_ty {
true
} else {
MatchAgainstHigherRankedOutlives::new(tcx).relate(outlives_ty,
erased_ty).is_ok()
}
}
}
}#[instrument(level = "debug", skip(tcx))]
78pub(super) fn can_match_erased_ty<'tcx>(
79 tcx: TyCtxt<'tcx>,
80 outlives_clause: ty::Binder<'tcx, ty::TypeOutlivesClause<'tcx>>,
81 erased_ty: Ty<'tcx>,
82) -> bool {
83 assert!(!outlives_clause.has_escaping_bound_vars());
84 let erased_outlives_clause = tcx.erase_and_anonymize_regions(outlives_clause);
85 let outlives_ty = erased_outlives_clause.skip_binder().0;
86 if outlives_ty == erased_ty {
87 true
89 } else {
90 MatchAgainstHigherRankedOutlives::new(tcx).relate(outlives_ty, erased_ty).is_ok()
91 }
92}
93
94struct MatchAgainstHigherRankedOutlives<'tcx> {
95 tcx: TyCtxt<'tcx>,
96 pattern_depth: ty::DebruijnIndex,
97 map: FxHashMap<ty::BoundRegion<'tcx>, ty::Region<'tcx>>,
98}
99
100impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
101 fn new(tcx: TyCtxt<'tcx>) -> MatchAgainstHigherRankedOutlives<'tcx> {
102 MatchAgainstHigherRankedOutlives {
103 tcx,
104 pattern_depth: ty::INNERMOST,
105 map: FxHashMap::default(),
106 }
107 }
108}
109
110impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
111 fn no_match<T>(&self) -> RelateResult<'tcx, T> {
113 Err(TypeError::Mismatch)
114 }
115
116 #[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(118u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("br")
}> =
::tracing::__macro_support::FieldName::new("br");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&br)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
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:
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))]
119 fn bind(
120 &mut self,
121 br: ty::BoundRegion<'tcx>,
122 value: ty::Region<'tcx>,
123 ) -> RelateResult<'tcx, ty::Region<'tcx>> {
124 match self.map.entry(br) {
125 Entry::Occupied(entry) => {
126 if *entry.get() == value {
127 Ok(value)
128 } else {
129 self.no_match()
130 }
131 }
132 Entry::Vacant(entry) => {
133 entry.insert(value);
134 Ok(value)
135 }
136 }
137 }
138}
139
140impl<'tcx> TypeRelation<TyCtxt<'tcx>> for MatchAgainstHigherRankedOutlives<'tcx> {
141 fn cx(&self) -> TyCtxt<'tcx> {
142 self.tcx
143 }
144
145 fn relate_ty_args(
146 &mut self,
147 a_ty: Ty<'tcx>,
148 _: Ty<'tcx>,
149 def_id: DefId,
150 a_args: ty::GenericArgsRef<'tcx>,
151 b_args: ty::GenericArgsRef<'tcx>,
152 _: impl FnOnce(ty::GenericArgsRef<'tcx>) -> Ty<'tcx>,
153 ) -> RelateResult<'tcx, Ty<'tcx>> {
154 let variances = self.cx().variances_of(def_id);
155 relate_args_with_variances(self, variances, a_args, b_args)?;
156 Ok(a_ty)
157 }
158
159 #[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(159u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("variance")
}> =
::tracing::__macro_support::FieldName::new("variance");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("a")
}> =
::tracing::__macro_support::FieldName::new("a");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("b")
}> =
::tracing::__macro_support::FieldName::new("b");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&variance)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&a)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&b)
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: 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))]
160 fn relate_with_variance<T: Relate<TyCtxt<'tcx>>>(
161 &mut self,
162 variance: ty::Variance,
163 _: ty::VarianceDiagInfo<TyCtxt<'tcx>>,
164 a: T,
165 b: T,
166 ) -> RelateResult<'tcx, T> {
167 if variance != ty::Bivariant { self.relate(a, b) } else { Ok(a) }
174 }
175
176 #[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(176u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("pattern")
}> =
::tracing::__macro_support::FieldName::new("pattern");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
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:
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")]
177 fn regions(
178 &mut self,
179 pattern: ty::Region<'tcx>,
180 value: ty::Region<'tcx>,
181 ) -> RelateResult<'tcx, ty::Region<'tcx>> {
182 if let ty::RegionKind::ReBound(ty::BoundVarIndexKind::Bound(depth), br) = pattern.kind()
183 && depth == self.pattern_depth
184 {
185 self.bind(br, value)
186 } else if pattern == value {
187 Ok(pattern)
188 } else {
189 self.no_match()
190 }
191 }
192
193 #[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(193u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("pattern")
}> =
::tracing::__macro_support::FieldName::new("pattern");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
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: 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")]
194 fn tys(&mut self, pattern: Ty<'tcx>, value: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
195 if matches!(pattern.kind(), ty::Error(_) | ty::Bound(..)) {
197 self.no_match()
199 } else if pattern == value {
200 Ok(pattern)
201 } else {
202 relate::structurally_relate_tys(self, pattern, value)
203 }
204 }
205
206 #[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(206u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("pattern")
}> =
::tracing::__macro_support::FieldName::new("pattern");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
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:
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")]
207 fn consts(
208 &mut self,
209 pattern: ty::Const<'tcx>,
210 value: ty::Const<'tcx>,
211 ) -> RelateResult<'tcx, ty::Const<'tcx>> {
212 if pattern == value {
213 Ok(pattern)
214 } else {
215 relate::structurally_relate_consts(self, pattern, value)
216 }
217 }
218
219 #[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(219u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::test_type_match"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("pattern")
}> =
::tracing::__macro_support::FieldName::new("pattern");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
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::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};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&pattern)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&value)
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:
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")]
220 fn binders<T>(
221 &mut self,
222 pattern: ty::Binder<'tcx, T>,
223 value: ty::Binder<'tcx, T>,
224 ) -> RelateResult<'tcx, ty::Binder<'tcx, T>>
225 where
226 T: Relate<TyCtxt<'tcx>>,
227 {
228 self.pattern_depth.shift_in(1);
229 let result = Ok(pattern.rebind(self.relate(pattern.skip_binder(), value.skip_binder())?));
230 self.pattern_depth.shift_out(1);
231 result
232 }
233}