1
Fork 0

Rollup merge of #122577 - fmease:speculative-say-what, r=compiler-errors

Remove obsolete parameter `speculative` from `instantiate_poly_trait_ref`

In #122527 I totally missed that `speculative` has become obsolete with the removal of `hir_trait_to_predicates` / due to #113671.

Fixes #114635.

r? `@compiler-errors`
This commit is contained in:
León Orell Valerian Liehr 2024-03-16 23:28:49 +01:00 committed by GitHub
commit 4cbfa15a2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 48 additions and 58 deletions

View file

@ -149,7 +149,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
polarity, polarity,
param_ty, param_ty,
bounds, bounds,
false,
only_self_bounds, only_self_bounds,
); );
} }
@ -231,14 +230,13 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
/// **A note on binders:** given something like `T: for<'a> Iterator<Item = &'a u32>`, the /// **A note on binders:** given something like `T: for<'a> Iterator<Item = &'a u32>`, the
/// `trait_ref` here will be `for<'a> T: Iterator`. The `binding` data however is from *inside* /// `trait_ref` here will be `for<'a> T: Iterator`. The `binding` data however is from *inside*
/// the binder (e.g., `&'a u32`) and hence may reference bound regions. /// the binder (e.g., `&'a u32`) and hence may reference bound regions.
#[instrument(level = "debug", skip(self, bounds, speculative, dup_bindings, path_span))] #[instrument(level = "debug", skip(self, bounds, dup_bindings, path_span))]
pub(super) fn add_predicates_for_ast_type_binding( pub(super) fn add_predicates_for_ast_type_binding(
&self, &self,
hir_ref_id: hir::HirId, hir_ref_id: hir::HirId,
trait_ref: ty::PolyTraitRef<'tcx>, trait_ref: ty::PolyTraitRef<'tcx>,
binding: &hir::TypeBinding<'tcx>, binding: &hir::TypeBinding<'tcx>,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
speculative: bool,
dup_bindings: &mut FxIndexMap<DefId, Span>, dup_bindings: &mut FxIndexMap<DefId, Span>,
path_span: Span, path_span: Span,
only_self_bounds: OnlySelfBounds, only_self_bounds: OnlySelfBounds,
@ -317,7 +315,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
} }
tcx.check_stability(assoc_item.def_id, Some(hir_ref_id), binding.span, None); tcx.check_stability(assoc_item.def_id, Some(hir_ref_id), binding.span, None);
if !speculative {
dup_bindings dup_bindings
.entry(assoc_item.def_id) .entry(assoc_item.def_id)
.and_modify(|prev_span| { .and_modify(|prev_span| {
@ -329,7 +326,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
}); });
}) })
.or_insert(binding.span); .or_insert(binding.span);
}
let projection_ty = if let ty::AssocKind::Fn = assoc_kind { let projection_ty = if let ty::AssocKind::Fn = assoc_kind {
let mut emitted_bad_param_err = None; let mut emitted_bad_param_err = None;
@ -433,8 +429,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
}); });
// Provide the resolved type of the associated constant to `type_of(AnonConst)`. // Provide the resolved type of the associated constant to `type_of(AnonConst)`.
if !speculative if let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } =
&& let hir::TypeBindingKind::Equality { term: hir::Term::Const(anon_const) } =
binding.kind binding.kind
{ {
let ty = alias_ty.map_bound(|ty| tcx.type_of(ty.def_id).instantiate(tcx, ty.args)); let ty = alias_ty.map_bound(|ty| tcx.type_of(ty.def_id).instantiate(tcx, ty.args));
@ -463,7 +458,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
hir::Term::Const(ct) => ty::Const::from_anon_const(tcx, ct.def_id).into(), hir::Term::Const(ct) => ty::Const::from_anon_const(tcx, ct.def_id).into(),
}; };
if !speculative {
// Find any late-bound regions declared in `ty` that are not // Find any late-bound regions declared in `ty` that are not
// declared in the trait-ref or assoc_item. These are not well-formed. // declared in the trait-ref or assoc_item. These are not well-formed.
// //
@ -498,7 +492,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
) )
}, },
); );
}
// "Desugar" a constraint like `T: Iterator<Item = u32>` this to // "Desugar" a constraint like `T: Iterator<Item = u32>` this to
// the "projection predicate" for: // the "projection predicate" for:

View file

@ -639,7 +639,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
/// where `'a` is a bound region at depth 0. Similarly, the `poly_trait_ref` would be /// where `'a` is a bound region at depth 0. Similarly, the `poly_trait_ref` would be
/// `Bar<'a>`. The returned poly-trait-ref will have this binder instantiated explicitly, /// `Bar<'a>`. The returned poly-trait-ref will have this binder instantiated explicitly,
/// however. /// however.
#[instrument(level = "debug", skip(self, span, constness, bounds, speculative))] #[instrument(level = "debug", skip(self, span, constness, bounds))]
pub(crate) fn instantiate_poly_trait_ref( pub(crate) fn instantiate_poly_trait_ref(
&self, &self,
trait_ref: &hir::TraitRef<'tcx>, trait_ref: &hir::TraitRef<'tcx>,
@ -648,7 +648,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
polarity: ty::ImplPolarity, polarity: ty::ImplPolarity,
self_ty: Ty<'tcx>, self_ty: Ty<'tcx>,
bounds: &mut Bounds<'tcx>, bounds: &mut Bounds<'tcx>,
speculative: bool,
only_self_bounds: OnlySelfBounds, only_self_bounds: OnlySelfBounds,
) -> GenericArgCountResult { ) -> GenericArgCountResult {
let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise()); let trait_def_id = trait_ref.trait_def_id().unwrap_or_else(|| FatalError.raise());
@ -697,7 +696,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
poly_trait_ref, poly_trait_ref,
binding, binding,
bounds, bounds,
speculative,
&mut dup_bindings, &mut dup_bindings,
binding.span, binding.span,
only_self_bounds, only_self_bounds,

View file

@ -44,7 +44,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
ty::ImplPolarity::Positive, ty::ImplPolarity::Positive,
dummy_self, dummy_self,
&mut bounds, &mut bounds,
false,
// True so we don't populate `bounds` with associated type bounds, even // True so we don't populate `bounds` with associated type bounds, even
// though they're disallowed from object types. // though they're disallowed from object types.
OnlySelfBounds(true), OnlySelfBounds(true),