summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs')
-rw-r--r--compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
index 09a1651c2..79b0b32be 100644
--- a/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
+++ b/compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs
@@ -68,13 +68,17 @@ declare_lint_pass!(OpaqueHiddenInferredBound => [OPAQUE_HIDDEN_INFERRED_BOUND]);
impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
- let hir::ItemKind::OpaqueTy(opaque) = &item.kind else { return; };
+ let hir::ItemKind::OpaqueTy(opaque) = &item.kind else {
+ return;
+ };
let def_id = item.owner_id.def_id.to_def_id();
let infcx = &cx.tcx.infer_ctxt().build();
// For every projection predicate in the opaque type's explicit bounds,
// check that the type that we're assigning actually satisfies the bounds
// of the associated type.
- for (pred, pred_span) in cx.tcx.explicit_item_bounds(def_id).subst_identity_iter_copied() {
+ for (pred, pred_span) in
+ cx.tcx.explicit_item_bounds(def_id).instantiate_identity_iter_copied()
+ {
// Liberate bound regions in the predicate since we
// don't actually care about lifetimes in this check.
let predicate = cx.tcx.liberate_late_bound_regions(def_id, pred.kind());
@@ -97,7 +101,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
}
let proj_ty =
- Ty::new_projection(cx.tcx, proj.projection_ty.def_id, proj.projection_ty.substs);
+ Ty::new_projection(cx.tcx, proj.projection_ty.def_id, proj.projection_ty.args);
// For every instance of the projection type in the bounds,
// replace them with the term we're assigning to the associated
// type in our opaque type.
@@ -113,10 +117,15 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
for (assoc_pred, assoc_pred_span) in cx
.tcx
.explicit_item_bounds(proj.projection_ty.def_id)
- .subst_iter_copied(cx.tcx, &proj.projection_ty.substs)
+ .iter_instantiated_copied(cx.tcx, &proj.projection_ty.args)
{
let assoc_pred = assoc_pred.fold_with(proj_replacer);
- let Ok(assoc_pred) = traits::fully_normalize(infcx, traits::ObligationCause::dummy(), cx.param_env, assoc_pred) else {
+ let Ok(assoc_pred) = traits::fully_normalize(
+ infcx,
+ traits::ObligationCause::dummy(),
+ cx.param_env,
+ assoc_pred,
+ ) else {
continue;
};
// If that predicate doesn't hold modulo regions (but passed during type-check),
@@ -147,7 +156,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
ty: Ty::new_opaque(
cx.tcx,
def_id,
- ty::InternalSubsts::identity_for_item(cx.tcx, def_id),
+ ty::GenericArgs::identity_for_item(cx.tcx, def_id),
),
proj_ty: proj_term,
assoc_pred_span,