rustc_infer/infer/canonical/query_response.rs
1//! This module contains the code to instantiate a "query result", and
2//! in particular to extract out the resulting region obligations and
3//! encode them therein.
4//!
5//! For an overview of what canonicalization is and how it fits into
6//! rustc, check out the [chapter in the rustc dev guide][c].
7//!
8//! [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html
9
10use std::fmt::Debug;
11use std::iter;
12
13use rustc_index::{Idx, IndexVec};
14use rustc_middle::arena::ArenaAllocatable;
15use rustc_middle::bug;
16use rustc_middle::infer::canonical::CanonicalVarKind;
17use rustc_middle::ty::{self, BoundVar, GenericArg, GenericArgKind, Ty, TyCtxt, TypeFoldable};
18use tracing::{debug, instrument};
19
20use crate::infer::canonical::instantiate::{CanonicalExt, instantiate_value};
21use crate::infer::canonical::{
22 Canonical, CanonicalQueryResponse, CanonicalVarValues, Certainty, OriginalQueryValues,
23 QueryRegionConstraints, QueryResponse,
24};
25use crate::infer::region_constraints::RegionConstraintData;
26use crate::infer::{
27 DefineOpaqueTypes, InferCtxt, InferOk, InferResult, SubregionOrigin, TypeOutlivesConstraint,
28};
29use crate::traits::query::NoSolution;
30use crate::traits::{ObligationCause, PredicateObligations, ScrubbedTraitError, TraitEngine};
31
32impl<'tcx> InferCtxt<'tcx> {
33 /// This method is meant to be invoked as the final step of a canonical query
34 /// implementation. It is given:
35 ///
36 /// - the instantiated variables `inference_vars` created from the query key
37 /// - the result `answer` of the query
38 /// - a fulfillment context `fulfill_cx` that may contain various obligations which
39 /// have yet to be proven.
40 ///
41 /// Given this, the function will process the obligations pending
42 /// in `fulfill_cx`:
43 ///
44 /// - If all the obligations can be proven successfully, it will
45 /// package up any resulting region obligations (extracted from
46 /// `infcx`) along with the fully resolved value `answer` into a
47 /// query result (which is then itself canonicalized).
48 /// - If some obligations can be neither proven nor disproven, then
49 /// the same thing happens, but the resulting query is marked as ambiguous.
50 /// - Finally, if any of the obligations result in a hard error,
51 /// then `Err(NoSolution)` is returned.
52 #[instrument(skip(self, inference_vars, answer, fulfill_cx), level = "trace")]
53 pub fn make_canonicalized_query_response<T>(
54 &self,
55 inference_vars: CanonicalVarValues<'tcx>,
56 answer: T,
57 fulfill_cx: &mut dyn TraitEngine<'tcx, ScrubbedTraitError<'tcx>>,
58 ) -> Result<CanonicalQueryResponse<'tcx, T>, NoSolution>
59 where
60 T: Debug + TypeFoldable<TyCtxt<'tcx>>,
61 Canonical<'tcx, QueryResponse<'tcx, T>>: ArenaAllocatable<'tcx>,
62 {
63 let query_response = self.make_query_response(inference_vars, answer, fulfill_cx)?;
64 debug!("query_response = {:#?}", query_response);
65 let canonical_result = self.canonicalize_response(query_response);
66 debug!("canonical_result = {:#?}", canonical_result);
67
68 Ok(self.tcx.arena.alloc(canonical_result))
69 }
70
71 /// A version of `make_canonicalized_query_response` that does
72 /// not pack in obligations, for contexts that want to drop
73 /// pending obligations instead of treating them as an ambiguity (e.g.
74 /// typeck "probing" contexts).
75 ///
76 /// If you DO want to keep track of pending obligations (which
77 /// include all region obligations, so this includes all cases
78 /// that care about regions) with this function, you have to
79 /// do it yourself, by e.g., having them be a part of the answer.
80 pub fn make_query_response_ignoring_pending_obligations<T>(
81 &self,
82 inference_vars: CanonicalVarValues<'tcx>,
83 answer: T,
84 ) -> Canonical<'tcx, QueryResponse<'tcx, T>>
85 where
86 T: Debug + TypeFoldable<TyCtxt<'tcx>>,
87 {
88 self.canonicalize_response(QueryResponse {
89 var_values: inference_vars,
90 region_constraints: QueryRegionConstraints::default(),
91 certainty: Certainty::Proven, // Ambiguities are OK!
92 opaque_types: vec![],
93 value: answer,
94 })
95 }
96
97 /// Helper for `make_canonicalized_query_response` that does
98 /// everything up until the final canonicalization.
99 #[instrument(skip(self, fulfill_cx), level = "debug")]
100 fn make_query_response<T>(
101 &self,
102 inference_vars: CanonicalVarValues<'tcx>,
103 answer: T,
104 fulfill_cx: &mut dyn TraitEngine<'tcx, ScrubbedTraitError<'tcx>>,
105 ) -> Result<QueryResponse<'tcx, T>, NoSolution>
106 where
107 T: Debug + TypeFoldable<TyCtxt<'tcx>>,
108 {
109 // Select everything, returning errors.
110 let errors = fulfill_cx.select_all_or_error(self);
111
112 // True error!
113 if errors.iter().any(|e| e.is_true_error()) {
114 return Err(NoSolution);
115 }
116
117 let region_obligations = self.take_registered_region_obligations();
118 let region_assumptions = self.take_registered_region_assumptions();
119 debug!(?region_obligations);
120 let region_constraints = self.with_region_constraints(|region_constraints| {
121 make_query_region_constraints(
122 region_obligations,
123 region_constraints,
124 region_assumptions,
125 )
126 });
127 debug!(?region_constraints);
128
129 let certainty = if errors.is_empty() { Certainty::Proven } else { Certainty::Ambiguous };
130
131 let opaque_types = self
132 .inner
133 .borrow_mut()
134 .opaque_type_storage
135 .take_opaque_types()
136 .map(|(k, v)| (k, v.ty))
137 .collect();
138
139 Ok(QueryResponse {
140 var_values: inference_vars,
141 region_constraints,
142 certainty,
143 value: answer,
144 opaque_types,
145 })
146 }
147
148 /// Given the (canonicalized) result to a canonical query,
149 /// instantiates the result so it can be used, plugging in the
150 /// values from the canonical query. (Note that the result may
151 /// have been ambiguous; you should check the certainty level of
152 /// the query before applying this function.)
153 ///
154 /// To get a good understanding of what is happening here, check
155 /// out the [chapter in the rustc dev guide][c].
156 ///
157 /// [c]: https://rust-lang.github.io/chalk/book/canonical_queries/canonicalization.html#processing-the-canonicalized-query-result
158 pub fn instantiate_query_response_and_region_obligations<R>(
159 &self,
160 cause: &ObligationCause<'tcx>,
161 param_env: ty::ParamEnv<'tcx>,
162 original_values: &OriginalQueryValues<'tcx>,
163 query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
164 ) -> InferResult<'tcx, R>
165 where
166 R: Debug + TypeFoldable<TyCtxt<'tcx>>,
167 {
168 let InferOk { value: result_args, obligations } =
169 self.query_response_instantiation(cause, param_env, original_values, query_response)?;
170
171 for (predicate, _category) in &query_response.value.region_constraints.outlives {
172 let predicate = instantiate_value(self.tcx, &result_args, *predicate);
173 self.register_outlives_constraint(predicate, cause);
174 }
175
176 for assumption in &query_response.value.region_constraints.assumptions {
177 let assumption = instantiate_value(self.tcx, &result_args, *assumption);
178 self.register_region_assumption(assumption);
179 }
180
181 let user_result: R =
182 query_response.instantiate_projected(self.tcx, &result_args, |q_r| q_r.value.clone());
183
184 Ok(InferOk { value: user_result, obligations })
185 }
186
187 /// An alternative to
188 /// `instantiate_query_response_and_region_obligations` that is more
189 /// efficient for NLL. NLL is a bit more advanced in the
190 /// "transition to chalk" than the rest of the compiler. During
191 /// the NLL type check, all of the "processing" of types and
192 /// things happens in queries -- the NLL checker itself is only
193 /// interested in the region obligations (`'a: 'b` or `T: 'b`)
194 /// that come out of these queries, which it wants to convert into
195 /// MIR-based constraints and solve. Therefore, it is most
196 /// convenient for the NLL Type Checker to **directly consume**
197 /// the `QueryOutlivesConstraint` values that arise from doing a
198 /// query. This is contrast to other parts of the compiler, which
199 /// would prefer for those `QueryOutlivesConstraint` to be converted
200 /// into the older infcx-style constraints (e.g., calls to
201 /// `sub_regions` or `register_region_obligation`).
202 ///
203 /// Therefore, `instantiate_nll_query_response_and_region_obligations` performs the same
204 /// basic operations as `instantiate_query_response_and_region_obligations` but
205 /// it returns its result differently:
206 ///
207 /// - It creates an instantiation `S` that maps from the original
208 /// query variables to the values computed in the query
209 /// result. If any errors arise, they are propagated back as an
210 /// `Err` result.
211 /// - In the case of a successful instantiation, we will append
212 /// `QueryOutlivesConstraint` values onto the
213 /// `output_query_region_constraints` vector for the solver to
214 /// use (if an error arises, some values may also be pushed, but
215 /// they should be ignored).
216 /// - It **can happen** (though it rarely does currently) that
217 /// equating types and things will give rise to subobligations
218 /// that must be processed. In this case, those subobligations
219 /// are propagated back in the return value.
220 /// - Finally, the query result (of type `R`) is propagated back,
221 /// after applying the instantiation `S`.
222 pub fn instantiate_nll_query_response_and_region_obligations<R>(
223 &self,
224 cause: &ObligationCause<'tcx>,
225 param_env: ty::ParamEnv<'tcx>,
226 original_values: &OriginalQueryValues<'tcx>,
227 query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
228 output_query_region_constraints: &mut QueryRegionConstraints<'tcx>,
229 ) -> InferResult<'tcx, R>
230 where
231 R: Debug + TypeFoldable<TyCtxt<'tcx>>,
232 {
233 let InferOk { value: result_args, mut obligations } = self
234 .query_response_instantiation_guess(
235 cause,
236 param_env,
237 original_values,
238 query_response,
239 )?;
240
241 // Compute `QueryOutlivesConstraint` values that unify each of
242 // the original values `v_o` that was canonicalized into a
243 // variable...
244
245 let constraint_category = cause.to_constraint_category();
246
247 for (index, original_value) in original_values.var_values.iter().enumerate() {
248 // ...with the value `v_r` of that variable from the query.
249 let result_value = query_response.instantiate_projected(self.tcx, &result_args, |v| {
250 v.var_values[BoundVar::new(index)]
251 });
252 match (original_value.kind(), result_value.kind()) {
253 (GenericArgKind::Lifetime(re1), GenericArgKind::Lifetime(re2))
254 if re1.is_erased() && re2.is_erased() =>
255 {
256 // No action needed.
257 }
258
259 (GenericArgKind::Lifetime(v_o), GenericArgKind::Lifetime(v_r)) => {
260 // To make `v_o = v_r`, we emit `v_o: v_r` and `v_r: v_o`.
261 if v_o != v_r {
262 output_query_region_constraints
263 .outlives
264 .push((ty::OutlivesPredicate(v_o.into(), v_r), constraint_category));
265 output_query_region_constraints
266 .outlives
267 .push((ty::OutlivesPredicate(v_r.into(), v_o), constraint_category));
268 }
269 }
270
271 (GenericArgKind::Type(v1), GenericArgKind::Type(v2)) => {
272 obligations.extend(
273 self.at(&cause, param_env)
274 .eq(DefineOpaqueTypes::Yes, v1, v2)?
275 .into_obligations(),
276 );
277 }
278
279 (GenericArgKind::Const(v1), GenericArgKind::Const(v2)) => {
280 obligations.extend(
281 self.at(&cause, param_env)
282 .eq(DefineOpaqueTypes::Yes, v1, v2)?
283 .into_obligations(),
284 );
285 }
286
287 _ => {
288 bug!("kind mismatch, cannot unify {:?} and {:?}", original_value, result_value);
289 }
290 }
291 }
292
293 // ...also include the other query region constraints from the query.
294 output_query_region_constraints.outlives.extend(
295 query_response.value.region_constraints.outlives.iter().filter_map(|&r_c| {
296 let r_c = instantiate_value(self.tcx, &result_args, r_c);
297
298 // Screen out `'a: 'a` cases.
299 let ty::OutlivesPredicate(k1, r2) = r_c.0;
300 if k1 != r2.into() { Some(r_c) } else { None }
301 }),
302 );
303
304 // FIXME(higher_ranked_auto): Optimize this to instantiate all assumptions
305 // at once, rather than calling `instantiate_value` repeatedly which may
306 // create more universes.
307 output_query_region_constraints.assumptions.extend(
308 query_response
309 .value
310 .region_constraints
311 .assumptions
312 .iter()
313 .map(|&r_c| instantiate_value(self.tcx, &result_args, r_c)),
314 );
315
316 let user_result: R =
317 query_response.instantiate_projected(self.tcx, &result_args, |q_r| q_r.value.clone());
318
319 Ok(InferOk { value: user_result, obligations })
320 }
321
322 /// Given the original values and the (canonicalized) result from
323 /// computing a query, returns an instantiation that can be applied
324 /// to the query result to convert the result back into the
325 /// original namespace.
326 ///
327 /// The instantiation also comes accompanied with subobligations
328 /// that arose from unification; these might occur if (for
329 /// example) we are doing lazy normalization and the value
330 /// assigned to a type variable is unified with an unnormalized
331 /// projection.
332 fn query_response_instantiation<R>(
333 &self,
334 cause: &ObligationCause<'tcx>,
335 param_env: ty::ParamEnv<'tcx>,
336 original_values: &OriginalQueryValues<'tcx>,
337 query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
338 ) -> InferResult<'tcx, CanonicalVarValues<'tcx>>
339 where
340 R: Debug + TypeFoldable<TyCtxt<'tcx>>,
341 {
342 debug!(
343 "query_response_instantiation(original_values={:#?}, query_response={:#?})",
344 original_values, query_response,
345 );
346
347 let mut value = self.query_response_instantiation_guess(
348 cause,
349 param_env,
350 original_values,
351 query_response,
352 )?;
353
354 value.obligations.extend(
355 self.unify_query_response_instantiation_guess(
356 cause,
357 param_env,
358 original_values,
359 &value.value,
360 query_response,
361 )?
362 .into_obligations(),
363 );
364
365 Ok(value)
366 }
367
368 /// Given the original values and the (canonicalized) result from
369 /// computing a query, returns a **guess** at an instantiation that
370 /// can be applied to the query result to convert the result back
371 /// into the original namespace. This is called a **guess**
372 /// because it uses a quick heuristic to find the values for each
373 /// canonical variable; if that quick heuristic fails, then we
374 /// will instantiate fresh inference variables for each canonical
375 /// variable instead. Therefore, the result of this method must be
376 /// properly unified
377 #[instrument(level = "debug", skip(self, param_env))]
378 fn query_response_instantiation_guess<R>(
379 &self,
380 cause: &ObligationCause<'tcx>,
381 param_env: ty::ParamEnv<'tcx>,
382 original_values: &OriginalQueryValues<'tcx>,
383 query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
384 ) -> InferResult<'tcx, CanonicalVarValues<'tcx>>
385 where
386 R: Debug + TypeFoldable<TyCtxt<'tcx>>,
387 {
388 // For each new universe created in the query result that did
389 // not appear in the original query, create a local
390 // superuniverse.
391 let mut universe_map = original_values.universe_map.clone();
392 let num_universes_in_query = original_values.universe_map.len();
393 let num_universes_in_response = query_response.max_universe.as_usize() + 1;
394 for _ in num_universes_in_query..num_universes_in_response {
395 universe_map.push(self.create_next_universe());
396 }
397 assert!(!universe_map.is_empty()); // always have the root universe
398 assert_eq!(universe_map[ty::UniverseIndex::ROOT.as_usize()], ty::UniverseIndex::ROOT);
399
400 // Every canonical query result includes values for each of
401 // the inputs to the query. Therefore, we begin by unifying
402 // these values with the original inputs that were
403 // canonicalized.
404 let result_values = &query_response.value.var_values;
405 assert_eq!(original_values.var_values.len(), result_values.len());
406
407 // Quickly try to find initial values for the canonical
408 // variables in the result in terms of the query. We do this
409 // by iterating down the values that the query gave to each of
410 // the canonical inputs. If we find that one of those values
411 // is directly equal to one of the canonical variables in the
412 // result, then we can type the corresponding value from the
413 // input. See the example above.
414 let mut opt_values: IndexVec<BoundVar, Option<GenericArg<'tcx>>> =
415 IndexVec::from_elem_n(None, query_response.variables.len());
416
417 for (original_value, result_value) in iter::zip(&original_values.var_values, result_values)
418 {
419 match result_value.kind() {
420 GenericArgKind::Type(result_value) => {
421 // We disable the instantiation guess for inference variables
422 // and only use it for placeholders. We need to handle the
423 // `sub_root` of type inference variables which would make this
424 // more involved. They are also a lot rarer than region variables.
425 if let ty::Bound(debruijn, b) = *result_value.kind()
426 && !matches!(
427 query_response.variables[b.var.as_usize()],
428 CanonicalVarKind::Ty { .. }
429 )
430 {
431 // We only allow a `ty::INNERMOST` index in generic parameters.
432 assert_eq!(debruijn, ty::INNERMOST);
433 opt_values[b.var] = Some(*original_value);
434 }
435 }
436 GenericArgKind::Lifetime(result_value) => {
437 if let ty::ReBound(debruijn, b) = result_value.kind() {
438 // We only allow a `ty::INNERMOST` index in generic parameters.
439 assert_eq!(debruijn, ty::INNERMOST);
440 opt_values[b.var] = Some(*original_value);
441 }
442 }
443 GenericArgKind::Const(result_value) => {
444 if let ty::ConstKind::Bound(debruijn, b) = result_value.kind() {
445 // We only allow a `ty::INNERMOST` index in generic parameters.
446 assert_eq!(debruijn, ty::INNERMOST);
447 opt_values[b.var] = Some(*original_value);
448 }
449 }
450 }
451 }
452
453 // Create result arguments: if we found a value for a
454 // given variable in the loop above, use that. Otherwise, use
455 // a fresh inference variable.
456 let tcx = self.tcx;
457 let variables = query_response.variables;
458 let var_values = CanonicalVarValues::instantiate(tcx, variables, |var_values, kind| {
459 if kind.universe() != ty::UniverseIndex::ROOT {
460 // A variable from inside a binder of the query. While ideally these shouldn't
461 // exist at all, we have to deal with them for now.
462 self.instantiate_canonical_var(cause.span, kind, &var_values, |u| {
463 universe_map[u.as_usize()]
464 })
465 } else if kind.is_existential() {
466 match opt_values[BoundVar::new(var_values.len())] {
467 Some(k) => k,
468 None => self.instantiate_canonical_var(cause.span, kind, &var_values, |u| {
469 universe_map[u.as_usize()]
470 }),
471 }
472 } else {
473 // For placeholders which were already part of the input, we simply map this
474 // universal bound variable back the placeholder of the input.
475 opt_values[BoundVar::new(var_values.len())]
476 .expect("expected placeholder to be unified with itself during response")
477 }
478 });
479
480 let mut obligations = PredicateObligations::new();
481
482 // Carry all newly resolved opaque types to the caller's scope
483 for &(a, b) in &query_response.value.opaque_types {
484 let a = instantiate_value(self.tcx, &var_values, a);
485 let b = instantiate_value(self.tcx, &var_values, b);
486 debug!(?a, ?b, "constrain opaque type");
487 // We use equate here instead of, for example, just registering the
488 // opaque type's hidden value directly, because the hidden type may have been an inference
489 // variable that got constrained to the opaque type itself. In that case we want to equate
490 // the generic args of the opaque with the generic params of its hidden type version.
491 obligations.extend(
492 self.at(cause, param_env)
493 .eq(
494 DefineOpaqueTypes::Yes,
495 Ty::new_opaque(self.tcx, a.def_id.to_def_id(), a.args),
496 b,
497 )?
498 .obligations,
499 );
500 }
501
502 Ok(InferOk { value: var_values, obligations })
503 }
504
505 /// Given a "guess" at the values for the canonical variables in
506 /// the input, try to unify with the *actual* values found in the
507 /// query result. Often, but not always, this is a no-op, because
508 /// we already found the mapping in the "guessing" step.
509 ///
510 /// See also: [`Self::query_response_instantiation_guess`]
511 fn unify_query_response_instantiation_guess<R>(
512 &self,
513 cause: &ObligationCause<'tcx>,
514 param_env: ty::ParamEnv<'tcx>,
515 original_values: &OriginalQueryValues<'tcx>,
516 result_args: &CanonicalVarValues<'tcx>,
517 query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
518 ) -> InferResult<'tcx, ()>
519 where
520 R: Debug + TypeFoldable<TyCtxt<'tcx>>,
521 {
522 // A closure that yields the result value for the given
523 // canonical variable; this is taken from
524 // `query_response.var_values` after applying the instantiation
525 // by `result_args`.
526 let instantiated_query_response = |index: BoundVar| -> GenericArg<'tcx> {
527 query_response.instantiate_projected(self.tcx, result_args, |v| v.var_values[index])
528 };
529
530 // Unify the original value for each variable with the value
531 // taken from `query_response` (after applying `result_args`).
532 self.unify_canonical_vars(cause, param_env, original_values, instantiated_query_response)
533 }
534
535 /// Given two sets of values for the same set of canonical variables, unify them.
536 /// The second set is produced lazily by supplying indices from the first set.
537 fn unify_canonical_vars(
538 &self,
539 cause: &ObligationCause<'tcx>,
540 param_env: ty::ParamEnv<'tcx>,
541 variables1: &OriginalQueryValues<'tcx>,
542 variables2: impl Fn(BoundVar) -> GenericArg<'tcx>,
543 ) -> InferResult<'tcx, ()> {
544 let mut obligations = PredicateObligations::new();
545 for (index, value1) in variables1.var_values.iter().enumerate() {
546 let value2 = variables2(BoundVar::new(index));
547
548 match (value1.kind(), value2.kind()) {
549 (GenericArgKind::Type(v1), GenericArgKind::Type(v2)) => {
550 obligations.extend(
551 self.at(cause, param_env)
552 .eq(DefineOpaqueTypes::Yes, v1, v2)?
553 .into_obligations(),
554 );
555 }
556 (GenericArgKind::Lifetime(re1), GenericArgKind::Lifetime(re2))
557 if re1.is_erased() && re2.is_erased() =>
558 {
559 // no action needed
560 }
561 (GenericArgKind::Lifetime(v1), GenericArgKind::Lifetime(v2)) => {
562 self.inner.borrow_mut().unwrap_region_constraints().make_eqregion(
563 SubregionOrigin::RelateRegionParamBound(cause.span, None),
564 v1,
565 v2,
566 );
567 }
568 (GenericArgKind::Const(v1), GenericArgKind::Const(v2)) => {
569 let ok = self.at(cause, param_env).eq(DefineOpaqueTypes::Yes, v1, v2)?;
570 obligations.extend(ok.into_obligations());
571 }
572 _ => {
573 bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,);
574 }
575 }
576 }
577 Ok(InferOk { value: (), obligations })
578 }
579}
580
581/// Given the region obligations and constraints scraped from the infcx,
582/// creates query region constraints.
583pub fn make_query_region_constraints<'tcx>(
584 outlives_obligations: Vec<TypeOutlivesConstraint<'tcx>>,
585 region_constraints: &RegionConstraintData<'tcx>,
586 assumptions: Vec<ty::ArgOutlivesPredicate<'tcx>>,
587) -> QueryRegionConstraints<'tcx> {
588 let RegionConstraintData { constraints, verifys } = region_constraints;
589
590 assert!(verifys.is_empty());
591
592 debug!(?constraints);
593
594 let outlives: Vec<_> = constraints
595 .iter()
596 .map(|(c, origin)| {
597 // Swap regions because we are going from sub (<=) to outlives (>=).
598 let constraint = ty::OutlivesPredicate(c.sup.into(), c.sub);
599 (constraint, origin.to_constraint_category())
600 })
601 .chain(outlives_obligations.into_iter().map(|obl| {
602 (
603 ty::OutlivesPredicate(obl.sup_type.into(), obl.sub_region),
604 obl.origin.to_constraint_category(),
605 )
606 }))
607 .collect();
608
609 QueryRegionConstraints { outlives, assumptions }
610}