1use tracing::{debug, instrument};
2
3use self::combine::{PredicateEmittingRelation, super_combine_consts, super_combine_tys};
4use crate::data_structures::DelayedSet;
5use crate::relate::combine::combine_ty_args;
6pub use crate::relate::*;
7use crate::solve::{Goal, VisibleForLeakCheck};
8use crate::{self as ty, Const, InferCtxtLike, Interner, Region};
9
10pub trait RelateExt: InferCtxtLike {
11 fn relate<T: Relate<Self::Interner>>(
12 &self,
13 param_env: <Self::Interner as Interner>::ParamEnv,
14 lhs: T,
15 variance: ty::Variance,
16 rhs: T,
17 span: <Self::Interner as Interner>::Span,
18 ) -> Result<
19 Vec<Goal<Self::Interner, <Self::Interner as Interner>::Predicate>>,
20 TypeError<Self::Interner>,
21 >;
22}
23
24impl<Infcx: InferCtxtLike> RelateExt for Infcx {
25 fn relate<T: Relate<Self::Interner>>(
26 &self,
27 param_env: <Self::Interner as Interner>::ParamEnv,
28 lhs: T,
29 variance: ty::Variance,
30 rhs: T,
31 span: <Self::Interner as Interner>::Span,
32 ) -> Result<
33 Vec<Goal<Self::Interner, <Self::Interner as Interner>::Predicate>>,
34 TypeError<Self::Interner>,
35 > {
36 let mut relate = SolverRelating::new(self, variance, param_env, span);
37 relate.relate(lhs, rhs)?;
38 Ok(relate.goals)
39 }
40}
41
42pub struct SolverRelating<'infcx, Infcx, I: Interner> {
44 infcx: &'infcx Infcx,
45 param_env: I::ParamEnv,
47 span: I::Span,
48 ambient_variance: ty::Variance,
50 goals: Vec<Goal<I, I::Predicate>>,
51 cache: DelayedSet<(ty::Variance, I::Ty, I::Ty)>,
74}
75
76impl<'infcx, Infcx, I> SolverRelating<'infcx, Infcx, I>
77where
78 Infcx: InferCtxtLike<Interner = I>,
79 I: Interner,
80{
81 pub fn new(
82 infcx: &'infcx Infcx,
83 ambient_variance: ty::Variance,
84 param_env: I::ParamEnv,
85 span: I::Span,
86 ) -> Self {
87 if true {
if !infcx.next_trait_solver() {
::core::panicking::panic("assertion failed: infcx.next_trait_solver()")
};
};debug_assert!(infcx.next_trait_solver());
88 SolverRelating {
89 infcx,
90 span,
91 ambient_variance,
92 param_env,
93 goals: ::alloc::vec::Vec::new()vec![],
94 cache: Default::default(),
95 }
96 }
97}
98
99impl<Infcx, I> TypeRelation<I> for SolverRelating<'_, Infcx, I>
100where
101 Infcx: InferCtxtLike<Interner = I>,
102 I: Interner,
103{
104 fn cx(&self) -> I {
105 self.infcx.cx()
106 }
107
108 fn relate_ty_args(
109 &mut self,
110 a_ty: I::Ty,
111 b_ty: I::Ty,
112 def_id: I::DefId,
113 a_args: I::GenericArgs,
114 b_args: I::GenericArgs,
115 _: impl FnOnce(I::GenericArgs) -> I::Ty,
116 ) -> RelateResult<I, I::Ty> {
117 if self.ambient_variance == ty::Invariant {
118 relate_args_invariantly(self, a_args, b_args)?;
122 Ok(a_ty)
123 } else {
124 let variances = self.cx().variances_of(def_id);
125 combine_ty_args(self.infcx, self, a_ty, b_ty, variances, a_args, b_args, |_| a_ty)
126 }
127 }
128
129 fn relate_with_variance<T: Relate<I>>(
130 &mut self,
131 variance: ty::Variance,
132 _info: VarianceDiagInfo<I>,
133 a: T,
134 b: T,
135 ) -> RelateResult<I, T> {
136 let old_ambient_variance = self.ambient_variance;
137 self.ambient_variance = self.ambient_variance.xform(variance);
138 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/3ef0c22cdb86ac42dc6b8f0f1ec36857daa6f2a1/compiler/rustc_type_ir/src/relate/solver_relating.rs:138",
"rustc_type_ir::relate::solver_relating",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/3ef0c22cdb86ac42dc6b8f0f1ec36857daa6f2a1/compiler/rustc_type_ir/src/relate/solver_relating.rs"),
::tracing_core::__macro_support::Option::Some(138u32),
::tracing_core::__macro_support::Option::Some("rustc_type_ir::relate::solver_relating"),
::tracing_core::field::FieldSet::new(&["message",
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("self.ambient_variance")
}> =
::tracing::__macro_support::FieldName::new("self.ambient_variance");
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!("new ambient variance")
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&self.ambient_variance)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?self.ambient_variance, "new ambient variance");
139
140 let r = if self.ambient_variance == ty::Bivariant { Ok(a) } else { self.relate(a, b) };
141
142 self.ambient_variance = old_ambient_variance;
143 r
144 }
145
146 {}
#[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_type_ir::relate::solver_relating",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/3ef0c22cdb86ac42dc6b8f0f1ec36857daa6f2a1/compiler/rustc_type_ir/src/relate/solver_relating.rs"),
::tracing_core::__macro_support::Option::Some(146u32),
::tracing_core::__macro_support::Option::Some("rustc_type_ir::relate::solver_relating"),
::tracing_core::field::FieldSet::new(&[{
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(&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<I, I::Ty> = loop {};
return __tracing_attr_fake_return;
}
{
if a == b { return Ok(a); }
let infcx = self.infcx;
let a = infcx.shallow_resolve(a);
let b = infcx.shallow_resolve(b);
if self.cache.contains(&(self.ambient_variance, a, b)) {
return Ok(a);
}
match (a.kind(), b.kind()) {
(ty::Infer(ty::TyVar(a_id)), ty::Infer(ty::TyVar(b_id))) => {
match self.ambient_variance {
ty::Covariant => {
self.goals.push(Goal::new(self.cx(), self.param_env,
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
a_is_expected: true,
a,
b,
}))));
}
ty::Contravariant => {
self.goals.push(Goal::new(self.cx(), self.param_env,
ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
a_is_expected: false,
a: b,
b: a,
}))));
}
ty::Invariant => { infcx.equate_ty_vids_raw(a_id, b_id); }
ty::Bivariant => {
{
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("Expected bivariance to be handled in relate_with_variance")));
}
}
}
}
(ty::Alias(ty::IsRigid::No, alias), _) if
infcx.next_trait_solver() => {
let new_var = infcx.next_ty_infer();
self.goals.push(Goal::new(self.cx(), self.param_env,
ty::ProjectionClause {
projection_term: alias.into(),
term: new_var.into(),
}));
self.tys(new_var, b)?;
}
(_, ty::Alias(ty::IsRigid::No, alias)) if
infcx.next_trait_solver() => {
let new_var = infcx.next_ty_infer();
self.goals.push(Goal::new(self.cx(), self.param_env,
ty::ProjectionClause {
projection_term: alias.into(),
term: new_var.into(),
}));
self.tys(a, new_var)?;
}
(ty::Infer(ty::TyVar(a_vid)), _) => {
infcx.instantiate_ty_var(self, true, a_vid,
self.ambient_variance, b)?;
}
(_, ty::Infer(ty::TyVar(b_vid))) => {
infcx.instantiate_ty_var(self, false, b_vid,
self.ambient_variance.xform(ty::Contravariant), a)?;
}
_ => { super_combine_tys(self.infcx, self, a, b)?; }
}
if !self.cache.insert((self.ambient_variance, a, b)) {
::core::panicking::panic("assertion failed: self.cache.insert((self.ambient_variance, a, b))")
};
Ok(a)
}
}
}#[instrument(skip(self), level = "trace")]
147 fn tys(&mut self, a: I::Ty, b: I::Ty) -> RelateResult<I, I::Ty> {
148 if a == b {
149 return Ok(a);
150 }
151
152 let infcx = self.infcx;
153 let a = infcx.shallow_resolve(a);
154 let b = infcx.shallow_resolve(b);
155
156 if self.cache.contains(&(self.ambient_variance, a, b)) {
157 return Ok(a);
158 }
159
160 match (a.kind(), b.kind()) {
161 (ty::Infer(ty::TyVar(a_id)), ty::Infer(ty::TyVar(b_id))) => {
162 match self.ambient_variance {
163 ty::Covariant => {
164 self.goals.push(Goal::new(
167 self.cx(),
168 self.param_env,
169 ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
170 a_is_expected: true,
171 a,
172 b,
173 })),
174 ));
175 }
176 ty::Contravariant => {
177 self.goals.push(Goal::new(
180 self.cx(),
181 self.param_env,
182 ty::Binder::dummy(ty::PredicateKind::Subtype(ty::SubtypePredicate {
183 a_is_expected: false,
184 a: b,
185 b: a,
186 })),
187 ));
188 }
189 ty::Invariant => {
190 infcx.equate_ty_vids_raw(a_id, b_id);
191 }
192 ty::Bivariant => {
193 unreachable!("Expected bivariance to be handled in relate_with_variance")
194 }
195 }
196 }
197
198 (ty::Alias(ty::IsRigid::No, alias), _) if infcx.next_trait_solver() => {
199 let new_var = infcx.next_ty_infer();
200 self.goals.push(Goal::new(
201 self.cx(),
202 self.param_env,
203 ty::ProjectionClause { projection_term: alias.into(), term: new_var.into() },
204 ));
205 self.tys(new_var, b)?;
206 }
207 (_, ty::Alias(ty::IsRigid::No, alias)) if infcx.next_trait_solver() => {
208 let new_var = infcx.next_ty_infer();
209 self.goals.push(Goal::new(
210 self.cx(),
211 self.param_env,
212 ty::ProjectionClause { projection_term: alias.into(), term: new_var.into() },
213 ));
214 self.tys(a, new_var)?;
215 }
216
217 (ty::Infer(ty::TyVar(a_vid)), _) => {
218 infcx.instantiate_ty_var(self, true, a_vid, self.ambient_variance, b)?;
219 }
220 (_, ty::Infer(ty::TyVar(b_vid))) => {
221 infcx.instantiate_ty_var(
222 self,
223 false,
224 b_vid,
225 self.ambient_variance.xform(ty::Contravariant),
226 a,
227 )?;
228 }
229
230 _ => {
231 super_combine_tys(self.infcx, self, a, b)?;
232 }
233 }
234
235 assert!(self.cache.insert((self.ambient_variance, a, b)));
236
237 Ok(a)
238 }
239
240 {}
#[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_type_ir::relate::solver_relating",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/3ef0c22cdb86ac42dc6b8f0f1ec36857daa6f2a1/compiler/rustc_type_ir/src/relate/solver_relating.rs"),
::tracing_core::__macro_support::Option::Some(240u32),
::tracing_core::__macro_support::Option::Some("rustc_type_ir::relate::solver_relating"),
::tracing_core::field::FieldSet::new(&[{
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(&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<I, Region<I>> =
loop {};
return __tracing_attr_fake_return;
}
{
match self.ambient_variance {
ty::Covariant =>
self.infcx.sub_regions(b, a, VisibleForLeakCheck::Yes,
self.span),
ty::Contravariant =>
self.infcx.sub_regions(a, b, VisibleForLeakCheck::Yes,
self.span),
ty::Invariant =>
self.infcx.equate_regions(a, b, VisibleForLeakCheck::Yes,
self.span),
ty::Bivariant => {
{
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("Expected bivariance to be handled in relate_with_variance")));
}
}
}
Ok(a)
}
}
}#[instrument(skip(self), level = "trace")]
241 fn regions(&mut self, a: Region<I>, b: Region<I>) -> RelateResult<I, Region<I>> {
242 match self.ambient_variance {
243 ty::Covariant => self.infcx.sub_regions(b, a, VisibleForLeakCheck::Yes, self.span),
245 ty::Contravariant => self.infcx.sub_regions(a, b, VisibleForLeakCheck::Yes, self.span),
247 ty::Invariant => self.infcx.equate_regions(a, b, VisibleForLeakCheck::Yes, self.span),
248 ty::Bivariant => {
249 unreachable!("Expected bivariance to be handled in relate_with_variance")
250 }
251 }
252
253 Ok(a)
254 }
255
256 {}
#[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_type_ir::relate::solver_relating",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/3ef0c22cdb86ac42dc6b8f0f1ec36857daa6f2a1/compiler/rustc_type_ir/src/relate/solver_relating.rs"),
::tracing_core::__macro_support::Option::Some(256u32),
::tracing_core::__macro_support::Option::Some("rustc_type_ir::relate::solver_relating"),
::tracing_core::field::FieldSet::new(&[{
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(&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<I, Const<I>> =
loop {};
return __tracing_attr_fake_return;
}
{ super_combine_consts(self.infcx, self, a, b) }
}
}#[instrument(skip(self), level = "trace")]
257 fn consts(&mut self, a: Const<I>, b: Const<I>) -> RelateResult<I, Const<I>> {
258 super_combine_consts(self.infcx, self, a, b)
259 }
260
261 fn binders<T>(
262 &mut self,
263 a: ty::Binder<I, T>,
264 b: ty::Binder<I, T>,
265 ) -> RelateResult<I, ty::Binder<I, T>>
266 where
267 T: Relate<I>,
268 {
269 if a == b {
271 return Ok(a);
272 }
273
274 if let Some(a_inner) = a.no_bound_vars()
276 && let Some(b_inner) = b.no_bound_vars()
277 {
278 self.relate(a_inner, b_inner)?;
279 return Ok(a);
280 }
281
282 match self.ambient_variance {
283 ty::Covariant => {
299 self.infcx.enter_forall_with_empty_assumptions(b, |b| {
300 let a = self.infcx.instantiate_binder_with_infer(a);
301 self.relate(a, b)
302 })?;
303 }
304 ty::Contravariant => {
305 self.infcx.enter_forall_with_empty_assumptions(a, |a| {
306 let b = self.infcx.instantiate_binder_with_infer(b);
307 self.relate(a, b)
308 })?;
309 }
310
311 ty::Invariant => {
322 self.infcx.enter_forall_with_empty_assumptions(b, |b| {
323 let a = self.infcx.instantiate_binder_with_infer(a);
324 self.relate(a, b)
325 })?;
326
327 self.infcx.enter_forall_with_empty_assumptions(a, |a| {
329 let b = self.infcx.instantiate_binder_with_infer(b);
330 self.relate(a, b)
331 })?;
332 }
333 ty::Bivariant => {
334 {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("Expected bivariance to be handled in relate_with_variance")));
}unreachable!("Expected bivariance to be handled in relate_with_variance")
335 }
336 }
337 Ok(a)
338 }
339}
340
341impl<Infcx, I> PredicateEmittingRelation<Infcx> for SolverRelating<'_, Infcx, I>
342where
343 Infcx: InferCtxtLike<Interner = I>,
344 I: Interner,
345{
346 fn span(&self) -> I::Span {
347 Span::dummy()
348 }
349
350 fn param_env(&self) -> I::ParamEnv {
351 self.param_env
352 }
353
354 fn register_predicates(
355 &mut self,
356 obligations: impl IntoIterator<Item: ty::Upcast<I, I::Predicate>>,
357 ) {
358 self.goals.extend(
359 obligations.into_iter().map(|pred| Goal::new(self.infcx.cx(), self.param_env, pred)),
360 );
361 }
362
363 fn register_goals(&mut self, obligations: impl IntoIterator<Item = Goal<I, I::Predicate>>) {
364 self.goals.extend(obligations);
365 }
366}