Skip to content

Commit 9d46c7a

Browse files
committedNov 18, 2022
Auto merge of #104555 - matthiaskrgr:rollup-tncyca8, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #103852 (Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl`) - #104366 (Simplify settings theme choice) - #104433 (Fix `emit_unused_delims_expr` ICE) - #104444 (Fix ICE in in_operand for ty error) - #104483 (Convert predicates into Predicate in the Obligation constructor) - #104496 (Don't attempt to normalize compiler backtraces) - #104503 (rustdoc: remove redundant font-color CSS on `.where`) - #104508 (Check `dyn*` return type correctly) - #104515 (ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug) - #104532 (Migrate tooltip style to CSS variables) - #104545 (Readd the matches_macro diag item) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 30117a1 + 239f84b commit 9d46c7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+640
-372
lines changed
 

‎compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ use rustc_infer::infer::{DefiningAnchor, InferCtxt};
77
use rustc_infer::traits::{Obligation, ObligationCause};
88
use rustc_middle::ty::subst::{GenericArgKind, InternalSubsts};
99
use rustc_middle::ty::visit::TypeVisitable;
10-
use rustc_middle::ty::{
11-
self, OpaqueHiddenType, OpaqueTypeKey, ToPredicate, Ty, TyCtxt, TypeFoldable,
12-
};
10+
use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt, TypeFoldable};
1311
use rustc_span::Span;
1412
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
1513
use rustc_trait_selection::traits::ObligationCtxt;
@@ -256,8 +254,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
256254
// Require the hidden type to be well-formed with only the generics of the opaque type.
257255
// Defining use functions may have more bounds than the opaque type, which is ok, as long as the
258256
// hidden type is well formed even without those bounds.
259-
let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()))
260-
.to_predicate(infcx.tcx);
257+
let predicate = ty::Binder::dummy(ty::PredicateKind::WellFormed(definition_ty.into()));
261258

262259
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id.to_def_id());
263260

@@ -282,6 +279,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
282279
}
283280

284281
ocx.register_obligation(Obligation::misc(
282+
infcx.tcx,
285283
instantiated_ty.span,
286284
body_id,
287285
param_env,

‎compiler/rustc_borrowck/src/type_check/canonical.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
9292
trait_ref,
9393
constness: ty::BoundConstness::NotConst,
9494
polarity: ty::ImplPolarity::Positive,
95-
}))
96-
.to_predicate(self.tcx()),
95+
})),
9796
locations,
9897
category,
9998
);
@@ -122,26 +121,26 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
122121

123122
pub(super) fn prove_predicates(
124123
&mut self,
125-
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
124+
predicates: impl IntoIterator<
125+
Item = impl ToPredicate<'tcx, ty::Predicate<'tcx>> + std::fmt::Debug,
126+
>,
126127
locations: Locations,
127128
category: ConstraintCategory<'tcx>,
128129
) {
129130
for predicate in predicates {
130-
let predicate = predicate.to_predicate(self.tcx());
131-
debug!("prove_predicates(predicate={:?}, locations={:?})", predicate, locations,);
132-
133131
self.prove_predicate(predicate, locations, category);
134132
}
135133
}
136134

137135
#[instrument(skip(self), level = "debug")]
138136
pub(super) fn prove_predicate(
139137
&mut self,
140-
predicate: ty::Predicate<'tcx>,
138+
predicate: impl ToPredicate<'tcx, ty::Predicate<'tcx>> + std::fmt::Debug,
141139
locations: Locations,
142140
category: ConstraintCategory<'tcx>,
143141
) {
144142
let param_env = self.param_env;
143+
let predicate = predicate.to_predicate(self.tcx());
145144
self.fully_perform_op(
146145
locations,
147146
category,

0 commit comments

Comments
 (0)