Dejargnonize subst
This commit is contained in:
@@ -557,7 +557,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
obligation.predicate.def_id(),
|
||||
obligation.predicate.skip_binder().trait_ref.self_ty(),
|
||||
|impl_def_id| {
|
||||
// Before we create the substitutions and everything, first
|
||||
// Before we create the generic parameters and everything, first
|
||||
// consider a "quick reject". This avoids creating more types
|
||||
// and so forth that we need to.
|
||||
let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap();
|
||||
|
||||
@@ -444,7 +444,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
) -> ImplSourceUserDefinedData<'tcx, PredicateObligation<'tcx>> {
|
||||
debug!(?obligation, ?impl_def_id, "confirm_impl_candidate");
|
||||
|
||||
// First, create the substitutions by matching the impl again,
|
||||
// First, create the generic parameters by matching the impl again,
|
||||
// this time not in a probe.
|
||||
let args = self.rematch_impl(impl_def_id, obligation);
|
||||
debug!(?args, "impl args");
|
||||
@@ -585,7 +585,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
// higher-ranked things.
|
||||
// Prevent, e.g., `dyn Iterator<Item = str>`.
|
||||
for bound in self.tcx().item_bounds(assoc_type).transpose_iter() {
|
||||
let subst_bound = if defs.count() == 0 {
|
||||
let arg_bound = if defs.count() == 0 {
|
||||
bound.instantiate(tcx, trait_predicate.trait_ref.args)
|
||||
} else {
|
||||
let mut args = smallvec::SmallVec::with_capacity(defs.count());
|
||||
@@ -649,7 +649,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
obligation.param_env,
|
||||
obligation.cause.clone(),
|
||||
obligation.recursion_depth + 1,
|
||||
subst_bound,
|
||||
arg_bound,
|
||||
&mut nested,
|
||||
);
|
||||
nested.push(obligation.with(tcx, normalized_bound));
|
||||
|
||||
@@ -1684,7 +1684,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
|
||||
/// Return `Yes` if the obligation's predicate type applies to the env_predicate, and
|
||||
/// `No` if it does not. Return `Ambiguous` in the case that the projection type is a GAT,
|
||||
/// and applying this env_predicate constrains any of the obligation's GAT substitutions.
|
||||
/// and applying this env_predicate constrains any of the obligation's GAT parameters.
|
||||
///
|
||||
/// This behavior is a somewhat of a hack to prevent over-constraining inference variables
|
||||
/// in cases like #91762.
|
||||
@@ -2673,7 +2673,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
}
|
||||
|
||||
/// Returns the obligations that are implied by instantiating an
|
||||
/// impl or trait. The obligations are substituted and fully
|
||||
/// impl or trait. The obligations are instantiated and fully
|
||||
/// normalized. This is used when confirming an impl or default
|
||||
/// impl.
|
||||
#[instrument(level = "debug", skip(self, cause, param_env))]
|
||||
@@ -2698,7 +2698,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
// U: Iterator, U: Sized,
|
||||
// V: Iterator, V: Sized,
|
||||
// <U as Iterator>::Item: Copy
|
||||
// When we substitute, say, `V => IntoIter<u32>, U => $0`, the last
|
||||
// When we instantiate, say, `V => IntoIter<u32>, U => $0`, the last
|
||||
// obligation will normalize to `<$0 as Iterator>::Item = $1` and
|
||||
// `$1: Copy`, so we must ensure the obligations are emitted in
|
||||
// that order.
|
||||
|
||||
Reference in New Issue
Block a user