mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Allow iterators instead of requiring slices that will get turned into iterators
This commit is contained in:
parent
bd40c10751
commit
ec8d01fdcc
@ -550,7 +550,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Copy, Some(self.last_span)),
|
||||
place_ty.ty,
|
||||
&[],
|
||||
[],
|
||||
);
|
||||
|
||||
// To have a `Copy` operand, the type `T` of the
|
||||
@ -1277,7 +1277,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
|
||||
place_ty,
|
||||
&[],
|
||||
[],
|
||||
);
|
||||
self.prove_trait_ref(
|
||||
trait_ref,
|
||||
@ -1870,7 +1870,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Copy, Some(span)),
|
||||
ty,
|
||||
&[],
|
||||
[],
|
||||
);
|
||||
|
||||
self.prove_trait_ref(
|
||||
@ -1887,7 +1887,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
|
||||
ty,
|
||||
&[],
|
||||
[],
|
||||
);
|
||||
|
||||
self.prove_trait_ref(
|
||||
@ -1903,7 +1903,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
|
||||
*ty,
|
||||
&[],
|
||||
[],
|
||||
);
|
||||
|
||||
self.prove_trait_ref(
|
||||
@ -2004,7 +2004,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::CoerceUnsized, Some(self.last_span)),
|
||||
op.ty(body, tcx),
|
||||
&[ty.into()],
|
||||
[ty.into()],
|
||||
);
|
||||
|
||||
self.prove_trait_ref(
|
||||
|
@ -160,7 +160,7 @@ impl Qualif for NeedsNonConstDrop {
|
||||
ObligationCause::dummy(),
|
||||
cx.param_env,
|
||||
ty::Binder::dummy(ty::TraitPredicate {
|
||||
trait_ref: cx.tcx.mk_trait_ref(destruct, ty, &[]),
|
||||
trait_ref: cx.tcx.mk_trait_ref(destruct, ty, []),
|
||||
constness: ty::BoundConstness::ConstIfConst,
|
||||
polarity: ty::ImplPolarity::Positive,
|
||||
}),
|
||||
|
@ -61,7 +61,7 @@ impl<'tcx> Bounds<'tcx> {
|
||||
// If it could be sized, and is, add the `Sized` predicate.
|
||||
let sized_predicate = self.implicitly_sized.and_then(|span| {
|
||||
tcx.lang_items().sized_trait().map(move |sized| {
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, &[]));
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, []));
|
||||
(trait_ref.without_const().to_predicate(tcx), span)
|
||||
})
|
||||
});
|
||||
|
@ -1782,7 +1782,7 @@ fn receiver_is_implemented<'tcx>(
|
||||
receiver_ty: Ty<'tcx>,
|
||||
) -> bool {
|
||||
let tcx = wfcx.tcx();
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(receiver_trait_def_id, receiver_ty, &[]));
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(receiver_trait_def_id, receiver_ty, []));
|
||||
|
||||
let obligation = traits::Obligation::new(tcx, cause, wfcx.param_env, trait_ref.without_const());
|
||||
|
||||
|
@ -545,9 +545,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
ty::PredicateKind::Projection(mut proj_pred) => {
|
||||
assert_eq!(proj_pred.projection_ty.self_ty(), opaque_ty);
|
||||
proj_pred.projection_ty.substs = self
|
||||
.tcx
|
||||
.mk_substs_trait(ty, &proj_pred.projection_ty.substs[1..]);
|
||||
proj_pred.projection_ty.substs = self.tcx.mk_substs_trait(
|
||||
ty,
|
||||
proj_pred.projection_ty.substs.iter().skip(1),
|
||||
);
|
||||
ty::PredicateKind::Projection(proj_pred)
|
||||
}
|
||||
_ => continue,
|
||||
|
@ -807,7 +807,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
|
||||
self.param_env,
|
||||
ty::Binder::dummy(ty::TraitRef::new(
|
||||
self.tcx.require_lang_item(hir::LangItem::PointerSized, Some(self.cause.span)),
|
||||
self.tcx.mk_substs_trait(a, &[]),
|
||||
self.tcx.mk_substs_trait(a, []),
|
||||
))
|
||||
.to_poly_trait_predicate(),
|
||||
));
|
||||
|
@ -1095,7 +1095,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
self.param_env,
|
||||
ty::Binder::dummy(self.tcx.mk_trait_ref(
|
||||
into_def_id,
|
||||
expr_ty, &[expected_ty.into()]
|
||||
expr_ty, [expected_ty.into()]
|
||||
))
|
||||
.to_poly_trait_predicate(),
|
||||
))
|
||||
|
@ -71,7 +71,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(
|
||||
fn_once,
|
||||
ty,
|
||||
&[self
|
||||
[self
|
||||
.next_ty_var(TypeVariableOrigin {
|
||||
kind: TypeVariableOriginKind::MiscVariable,
|
||||
span,
|
||||
|
@ -27,7 +27,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||
def_id: DefId,
|
||||
cause: ObligationCause<'tcx>,
|
||||
) {
|
||||
let trait_ref = infcx.tcx.mk_trait_ref(def_id, ty, &[]);
|
||||
let trait_ref = infcx.tcx.mk_trait_ref(def_id, ty, []);
|
||||
self.register_predicate_obligation(
|
||||
infcx,
|
||||
Obligation {
|
||||
|
@ -131,7 +131,7 @@ impl<'tcx> OverloadedDeref<'tcx> {
|
||||
.find(|m| m.kind == ty::AssocKind::Fn)
|
||||
.unwrap()
|
||||
.def_id;
|
||||
tcx.mk_fn_def(method_def_id, tcx.mk_substs_trait(source, &[]))
|
||||
tcx.mk_fn_def(method_def_id, tcx.mk_substs_trait(source, []))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2809,20 +2809,26 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
iter.intern_with(|xs| self.intern_place_elems(xs))
|
||||
}
|
||||
|
||||
pub fn mk_substs_trait(self, self_ty: Ty<'tcx>, rest: &[GenericArg<'tcx>]) -> SubstsRef<'tcx> {
|
||||
self.mk_substs(iter::once(self_ty.into()).chain(rest.iter().cloned()))
|
||||
pub fn mk_substs_trait(
|
||||
self,
|
||||
self_ty: Ty<'tcx>,
|
||||
rest: impl IntoIterator<Item = GenericArg<'tcx>>,
|
||||
) -> SubstsRef<'tcx> {
|
||||
self.mk_substs(iter::once(self_ty.into()).chain(rest))
|
||||
}
|
||||
|
||||
pub fn mk_trait_ref(
|
||||
self,
|
||||
trait_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
rest: &[GenericArg<'tcx>],
|
||||
rest: impl IntoIterator<Item = GenericArg<'tcx>, IntoIter: ExactSizeIterator>,
|
||||
) -> ty::TraitRef<'tcx> {
|
||||
let rest = rest.into_iter();
|
||||
debug_assert_eq!(
|
||||
self.generics_of(trait_def_id).count() - 1,
|
||||
rest.len(),
|
||||
"wrong number of generic parameters for {trait_def_id:?} on self type {self_ty:?}: {rest:?} \nDid you accidentally include the self-type in the params list?"
|
||||
"wrong number of generic parameters for {trait_def_id:?} on self type {self_ty:?}: {:?} \nDid you accidentally include the self-type in the params list?",
|
||||
rest.collect::<Vec<_>>(),
|
||||
);
|
||||
let substs = self.mk_substs_trait(self_ty, rest);
|
||||
ty::TraitRef::new(trait_def_id, substs)
|
||||
|
@ -551,7 +551,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
let sig =
|
||||
tcx.try_normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), sig).ok()?;
|
||||
assert_eq!(sig.inputs().len(), 1);
|
||||
let substs = tcx.mk_substs_trait(self_ty, &[sig.inputs()[0].into()]);
|
||||
let substs = tcx.mk_substs_trait(self_ty, [sig.inputs()[0].into()]);
|
||||
|
||||
debug!(?self_ty, ?sig);
|
||||
Some(Instance { def, substs })
|
||||
|
@ -719,7 +719,7 @@ impl<'tcx> PolyExistentialPredicate<'tcx> {
|
||||
self.rebind(p.with_self_ty(tcx, self_ty)).to_predicate(tcx)
|
||||
}
|
||||
ExistentialPredicate::AutoTrait(did) => {
|
||||
let trait_ref = self.rebind(tcx.mk_trait_ref(did, self_ty, &[]));
|
||||
let trait_ref = self.rebind(tcx.mk_trait_ref(did, self_ty, []));
|
||||
trait_ref.without_const().to_predicate(tcx)
|
||||
}
|
||||
}
|
||||
@ -812,7 +812,7 @@ impl<'tcx> TraitRef<'tcx> {
|
||||
}
|
||||
|
||||
pub fn with_self_type(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self {
|
||||
tcx.mk_trait_ref(self.def_id, self_ty, &self.substs[1..])
|
||||
tcx.mk_trait_ref(self.def_id, self_ty, self.substs.iter().skip(1))
|
||||
}
|
||||
|
||||
/// Returns a `TraitRef` of the form `P0: Foo<P1..Pn>` where `Pi`
|
||||
@ -910,7 +910,7 @@ impl<'tcx> ExistentialTraitRef<'tcx> {
|
||||
// otherwise the escaping vars would be captured by the binder
|
||||
// debug_assert!(!self_ty.has_escaping_bound_vars());
|
||||
|
||||
tcx.mk_trait_ref(self.def_id, self_ty, self.substs)
|
||||
tcx.mk_trait_ref(self.def_id, self_ty, self.substs.iter())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -840,7 +840,7 @@ fn trait_method<'tcx>(
|
||||
self_ty: Ty<'tcx>,
|
||||
params: &[GenericArg<'tcx>],
|
||||
) -> ConstantKind<'tcx> {
|
||||
let substs = tcx.mk_substs_trait(self_ty, params);
|
||||
let substs = tcx.mk_substs_trait(self_ty, params.iter().copied());
|
||||
|
||||
// The unhygienic comparison here is acceptable because this is only
|
||||
// used on known traits.
|
||||
|
@ -615,7 +615,7 @@ where
|
||||
let drop_trait = tcx.require_lang_item(LangItem::Drop, None);
|
||||
let drop_fn = tcx.associated_item_def_ids(drop_trait)[0];
|
||||
let ty = self.place_ty(self.place);
|
||||
let substs = tcx.mk_substs_trait(ty, &[]);
|
||||
let substs = tcx.mk_substs_trait(ty, []);
|
||||
|
||||
let ref_ty =
|
||||
tcx.mk_ref(tcx.lifetimes.re_erased, ty::TypeAndMut { ty, mutbl: hir::Mutability::Mut });
|
||||
|
@ -346,7 +346,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
|
||||
// we must subst the self_ty because it's
|
||||
// otherwise going to be TySelf and we can't index
|
||||
// or access fields of a Place of type TySelf.
|
||||
let substs = tcx.mk_substs_trait(self_ty, &[]);
|
||||
let substs = tcx.mk_substs_trait(self_ty, []);
|
||||
let sig = tcx.bound_fn_sig(def_id).subst(tcx, substs);
|
||||
let sig = tcx.erase_late_bound_regions(sig);
|
||||
let span = tcx.def_span(def_id);
|
||||
@ -427,7 +427,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
|
||||
) {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let substs = tcx.mk_substs_trait(ty, &[]);
|
||||
let substs = tcx.mk_substs_trait(ty, []);
|
||||
|
||||
// `func == Clone::clone(&ty) -> ty`
|
||||
let func_ty = tcx.mk_fn_def(self.def_id, substs);
|
||||
@ -586,7 +586,7 @@ fn build_call_shim<'tcx>(
|
||||
|
||||
// Create substitutions for the `Self` and `Args` generic parameters of the shim body.
|
||||
let arg_tup = tcx.mk_tup(untuple_args.iter());
|
||||
let sig_substs = tcx.mk_substs_trait(ty, &[ty::subst::GenericArg::from(arg_tup)]);
|
||||
let sig_substs = tcx.mk_substs_trait(ty, [ty::subst::GenericArg::from(arg_tup)]);
|
||||
|
||||
(Some(sig_substs), Some(untuple_args))
|
||||
} else {
|
||||
|
@ -29,7 +29,7 @@ fn custom_coerce_unsize_info<'tcx>(
|
||||
) -> CustomCoerceUnsized {
|
||||
let def_id = tcx.require_lang_item(LangItem::CoerceUnsized, None);
|
||||
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(def_id, source_ty, &[target_ty.into()]));
|
||||
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(def_id, source_ty, [target_ty.into()]));
|
||||
|
||||
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), trait_ref)) {
|
||||
Ok(traits::ImplSource::UserDefined(traits::ImplSourceUserDefinedData {
|
||||
|
@ -122,7 +122,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
||||
let tcx = self.infcx.tcx;
|
||||
|
||||
// <ty as Deref>
|
||||
let trait_ref = tcx.mk_trait_ref(tcx.lang_items().deref_trait()?, ty, &[]);
|
||||
let trait_ref = tcx.mk_trait_ref(tcx.lang_items().deref_trait()?, ty, []);
|
||||
|
||||
let cause = traits::ObligationCause::misc(self.span, self.body_id);
|
||||
|
||||
|
@ -86,7 +86,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
) -> AutoTraitResult<A> {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let trait_ref = tcx.mk_trait_ref(trait_did, ty, &[]);
|
||||
let trait_ref = tcx.mk_trait_ref(trait_did, ty, []);
|
||||
|
||||
let trait_pred = ty::Binder::dummy(trait_ref);
|
||||
|
||||
@ -260,7 +260,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
||||
let mut already_visited = FxHashSet::default();
|
||||
let mut predicates = VecDeque::new();
|
||||
predicates.push_back(ty::Binder::dummy(ty::TraitPredicate {
|
||||
trait_ref: infcx.tcx.mk_trait_ref(trait_did, ty, &[]),
|
||||
trait_ref: infcx.tcx.mk_trait_ref(trait_did, ty, []),
|
||||
|
||||
constness: ty::BoundConstness::NotConst,
|
||||
// Auto traits are positive
|
||||
|
@ -93,7 +93,7 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
||||
def_id: DefId,
|
||||
) {
|
||||
let tcx = self.infcx.tcx;
|
||||
let trait_ref = tcx.mk_trait_ref(def_id, ty, &[]);
|
||||
let trait_ref = tcx.mk_trait_ref(def_id, ty, []);
|
||||
self.register_obligation(Obligation {
|
||||
cause,
|
||||
recursion_depth: 0,
|
||||
|
@ -347,8 +347,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
||||
span: DUMMY_SP,
|
||||
kind: TypeVariableOriginKind::MiscVariable,
|
||||
});
|
||||
let trait_ref =
|
||||
self.tcx.mk_trait_ref(trait_def_id, ty.skip_binder(), &[var.into()]);
|
||||
let trait_ref = self.tcx.mk_trait_ref(trait_def_id, ty.skip_binder(), [var.into()]);
|
||||
let obligation = Obligation::new(
|
||||
self.tcx,
|
||||
ObligationCause::dummy(),
|
||||
|
@ -2985,7 +2985,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
self.tcx.mk_projection(
|
||||
item_def_id,
|
||||
// Future::Output has no substs
|
||||
self.tcx.mk_substs_trait(trait_pred.self_ty(), &[]),
|
||||
self.tcx.mk_substs_trait(trait_pred.self_ty(), []),
|
||||
)
|
||||
});
|
||||
let projection_ty = normalize_to(
|
||||
@ -3068,13 +3068,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
// Ensure all fields impl the trait.
|
||||
adt.all_fields().all(|field| {
|
||||
let field_ty = field.ty(self.tcx, substs);
|
||||
let trait_substs;
|
||||
let trait_substs: &[_] = match diagnostic_name {
|
||||
let trait_substs = match diagnostic_name {
|
||||
sym::PartialEq | sym::PartialOrd => {
|
||||
trait_substs = [field_ty.into()];
|
||||
&trait_substs
|
||||
Some(field_ty.into())
|
||||
}
|
||||
_ => &[],
|
||||
_ => None,
|
||||
};
|
||||
let trait_pred = trait_pred.map_bound_ref(|tr| ty::TraitPredicate {
|
||||
trait_ref: self.tcx.mk_trait_ref(
|
||||
|
@ -143,7 +143,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
|
||||
def_id: DefId,
|
||||
span: Span,
|
||||
) -> bool {
|
||||
let trait_ref = ty::Binder::dummy(infcx.tcx.mk_trait_ref(def_id, ty, &[]));
|
||||
let trait_ref = ty::Binder::dummy(infcx.tcx.mk_trait_ref(def_id, ty, []));
|
||||
pred_known_to_hold_modulo_regions(infcx, param_env, trait_ref.without_const(), span)
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@ pub fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
|
||||
// this has been typecked-before, so diagnostics is not really needed.
|
||||
let unsize_trait_did = tcx.require_lang_item(LangItem::Unsize, None);
|
||||
|
||||
let trait_ref = tcx.mk_trait_ref(unsize_trait_did, source, &[target.into()]);
|
||||
let trait_ref = tcx.mk_trait_ref(unsize_trait_did, source, [target.into()]);
|
||||
|
||||
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), ty::Binder::dummy(trait_ref))) {
|
||||
Ok(ImplSource::TraitUpcasting(implsrc_traitcasting)) => {
|
||||
|
@ -688,7 +688,7 @@ fn receiver_is_dispatchable<'tcx>(
|
||||
let unsize_predicate = ty::Binder::dummy(tcx.mk_trait_ref(
|
||||
unsize_did,
|
||||
tcx.types.self_param,
|
||||
&[unsized_self_ty.into()],
|
||||
[unsized_self_ty.into()],
|
||||
))
|
||||
.without_const()
|
||||
.to_predicate(tcx);
|
||||
@ -724,7 +724,7 @@ fn receiver_is_dispatchable<'tcx>(
|
||||
let predicate = ty::Binder::dummy(tcx.mk_trait_ref(
|
||||
dispatch_from_dyn_did,
|
||||
receiver_ty,
|
||||
&[unsized_receiver_ty.into()],
|
||||
[unsized_receiver_ty.into()],
|
||||
))
|
||||
.without_const();
|
||||
|
||||
|
@ -1712,7 +1712,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
|
||||
selcx.tcx(),
|
||||
ty::Binder::dummy(selcx.tcx().mk_trait_ref(
|
||||
selcx.tcx().require_lang_item(LangItem::Sized, None),
|
||||
self_ty, &[],
|
||||
self_ty, [],
|
||||
))
|
||||
.without_const(),
|
||||
),
|
||||
@ -1969,7 +1969,7 @@ fn confirm_pointee_candidate<'cx, 'tcx>(
|
||||
let sized_predicate = ty::Binder::dummy(tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Sized, None),
|
||||
self_ty,
|
||||
&[],
|
||||
[],
|
||||
))
|
||||
.without_const();
|
||||
obligations.push(obligation.with(tcx, sized_predicate));
|
||||
|
@ -714,7 +714,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
// <ty as Deref>
|
||||
let trait_ref = tcx.mk_trait_ref(tcx.lang_items().deref_trait()?, ty, &[]);
|
||||
let trait_ref = tcx.mk_trait_ref(tcx.lang_items().deref_trait()?, ty, []);
|
||||
|
||||
let obligation = traits::Obligation::new(
|
||||
tcx,
|
||||
|
@ -635,7 +635,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let tr = ty::Binder::dummy(self.tcx().mk_trait_ref(
|
||||
self.tcx().require_lang_item(LangItem::Sized, None),
|
||||
output_ty,
|
||||
&[],
|
||||
[],
|
||||
));
|
||||
nested.push(Obligation::new(
|
||||
self.infcx.tcx,
|
||||
@ -1000,7 +1000,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let tr = ty::Binder::dummy(tcx.mk_trait_ref(
|
||||
tcx.require_lang_item(LangItem::Sized, None),
|
||||
source,
|
||||
&[],
|
||||
[],
|
||||
));
|
||||
nested.push(predicate_to_obligation(tr.without_const().to_predicate(tcx)));
|
||||
|
||||
@ -1258,7 +1258,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
trait_ref: self.tcx().mk_trait_ref(
|
||||
self.tcx().require_lang_item(LangItem::Destruct, None),
|
||||
nested_ty,
|
||||
&[],
|
||||
[],
|
||||
),
|
||||
constness: ty::BoundConstness::ConstIfConst,
|
||||
polarity: ty::ImplPolarity::Positive,
|
||||
@ -1283,7 +1283,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
trait_ref: self.tcx().mk_trait_ref(
|
||||
self.tcx().require_lang_item(LangItem::Destruct, None),
|
||||
nested_ty,
|
||||
&[],
|
||||
[],
|
||||
),
|
||||
constness: ty::BoundConstness::ConstIfConst,
|
||||
polarity: ty::ImplPolarity::Positive,
|
||||
|
@ -241,7 +241,7 @@ pub fn predicate_for_trait_def<'tcx>(
|
||||
self_ty: Ty<'tcx>,
|
||||
params: &[GenericArg<'tcx>],
|
||||
) -> PredicateObligation<'tcx> {
|
||||
let trait_ref = tcx.mk_trait_ref(trait_def_id, self_ty, params);
|
||||
let trait_ref = tcx.mk_trait_ref(trait_def_id, self_ty, params.iter().copied());
|
||||
predicate_for_trait_ref(tcx, cause, param_env, trait_ref, recursion_depth)
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ pub fn closure_trait_ref_and_return_type<'tcx>(
|
||||
TupleArgumentsFlag::Yes => tcx.intern_tup(sig.skip_binder().inputs()),
|
||||
};
|
||||
debug_assert!(!self_ty.has_escaping_bound_vars());
|
||||
let trait_ref = tcx.mk_trait_ref(fn_trait_def_id, self_ty, &[arguments_tuple.into()]);
|
||||
let trait_ref = tcx.mk_trait_ref(fn_trait_def_id, self_ty, [arguments_tuple.into()]);
|
||||
sig.map_bound(|sig| (trait_ref, sig.output()))
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ pub fn generator_trait_ref_and_outputs<'tcx>(
|
||||
) -> ty::Binder<'tcx, (ty::TraitRef<'tcx>, Ty<'tcx>, Ty<'tcx>)> {
|
||||
debug_assert!(!self_ty.has_escaping_bound_vars());
|
||||
let trait_ref =
|
||||
tcx.mk_trait_ref(fn_trait_def_id, self_ty, &[sig.skip_binder().resume_ty.into()]);
|
||||
tcx.mk_trait_ref(fn_trait_def_id, self_ty, [sig.skip_binder().resume_ty.into()]);
|
||||
sig.map_bound(|sig| (trait_ref, sig.yield_ty, sig.return_ty))
|
||||
}
|
||||
|
||||
|
@ -421,11 +421,8 @@ impl<'tcx> WfPredicates<'tcx> {
|
||||
fn require_sized(&mut self, subty: Ty<'tcx>, cause: traits::ObligationCauseCode<'tcx>) {
|
||||
if !subty.has_escaping_bound_vars() {
|
||||
let cause = self.cause(cause);
|
||||
let trait_ref = self.tcx.mk_trait_ref(
|
||||
self.tcx.require_lang_item(LangItem::Sized, None),
|
||||
subty,
|
||||
&[],
|
||||
);
|
||||
let trait_ref =
|
||||
self.tcx.mk_trait_ref(self.tcx.require_lang_item(LangItem::Sized, None), subty, []);
|
||||
self.out.push(traits::Obligation::with_depth(
|
||||
self.tcx,
|
||||
cause,
|
||||
|
@ -689,7 +689,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<Ru
|
||||
trait_id: chalk_ir::TraitId(def_id),
|
||||
substitution: interner
|
||||
.tcx
|
||||
.mk_substs_trait(self_ty, &[])
|
||||
.mk_substs_trait(self_ty, [])
|
||||
.lower_into(interner),
|
||||
}),
|
||||
),
|
||||
|
@ -49,7 +49,7 @@ fn sized_constraint_for_ty<'tcx>(
|
||||
// it on the impl.
|
||||
|
||||
let Some(sized_trait) = tcx.lang_items().sized_trait() else { return vec![ty] };
|
||||
let sized_predicate = ty::Binder::dummy(tcx.mk_trait_ref(sized_trait, ty, &[]))
|
||||
let sized_predicate = ty::Binder::dummy(tcx.mk_trait_ref(sized_trait, ty, []))
|
||||
.without_const()
|
||||
.to_predicate(tcx);
|
||||
let predicates = tcx.predicates_of(adtdef.did()).predicates;
|
||||
|
@ -44,7 +44,7 @@ where
|
||||
discard_positive_impl: bool,
|
||||
) -> Option<Item> {
|
||||
let tcx = self.cx.tcx;
|
||||
let trait_ref = tcx.mk_trait_ref(trait_def_id, ty, &[]);
|
||||
let trait_ref = tcx.mk_trait_ref(trait_def_id, ty, []);
|
||||
if !self.cx.generated_synthetics.insert((ty, trait_def_id)) {
|
||||
debug!("get_auto_trait_impl_for({:?}): already generated, aborting", trait_ref);
|
||||
return None;
|
||||
|
@ -59,7 +59,7 @@ fn is_impl_not_trait_with_bool_out(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
|
||||
)
|
||||
})
|
||||
.map_or(false, |assoc_item| {
|
||||
let proj = cx.tcx.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(ty, &[]));
|
||||
let proj = cx.tcx.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(ty, []));
|
||||
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
|
||||
|
||||
nty.is_bool()
|
||||
|
@ -1263,7 +1263,7 @@ fn replace_types<'tcx>(
|
||||
let item_def_id = projection_predicate.projection_ty.item_def_id;
|
||||
let assoc_item = cx.tcx.associated_item(item_def_id);
|
||||
let projection = cx.tcx
|
||||
.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(new_ty, &[]));
|
||||
.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(new_ty, []));
|
||||
|
||||
if let Ok(projected_ty) = cx.tcx.try_normalize_erasing_regions(cx.param_env, projection)
|
||||
&& substs[term_param_ty.index as usize] != ty::GenericArg::from(projected_ty)
|
||||
|
@ -79,7 +79,7 @@ pub fn get_associated_type<'tcx>(
|
||||
.associated_items(trait_id)
|
||||
.find_by_name_and_kind(cx.tcx, Ident::from_str(name), ty::AssocKind::Type, trait_id)
|
||||
.and_then(|assoc| {
|
||||
let proj = cx.tcx.mk_projection(assoc.def_id, cx.tcx.mk_substs_trait(ty, &[]));
|
||||
let proj = cx.tcx.mk_projection(assoc.def_id, cx.tcx.mk_substs_trait(ty, []));
|
||||
cx.tcx.try_normalize_erasing_regions(cx.param_env, proj).ok()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user