Move trait bound modifiers into ast::PolyTraitRef
This commit is contained in:
parent
7500e09b8b
commit
95dba280b9
17 changed files with 118 additions and 103 deletions
|
@ -1219,11 +1219,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
let bound = this.lower_poly_trait_ref(
|
||||
&PolyTraitRef {
|
||||
bound_generic_params: ThinVec::new(),
|
||||
modifiers: TraitBoundModifiers::NONE,
|
||||
trait_ref: TraitRef { path: path.clone(), ref_id: t.id },
|
||||
span: t.span,
|
||||
},
|
||||
itctx,
|
||||
TraitBoundModifiers::NONE,
|
||||
);
|
||||
let bounds = this.arena.alloc_from_iter([bound]);
|
||||
let lifetime_bound = this.elided_dyn_bound(t.span);
|
||||
|
@ -1325,8 +1325,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
// We can safely ignore constness here since AST validation
|
||||
// takes care of rejecting invalid modifier combinations and
|
||||
// const trait bounds in trait object types.
|
||||
GenericBound::Trait(ty, modifiers) => {
|
||||
let trait_ref = this.lower_poly_trait_ref(ty, itctx, *modifiers);
|
||||
GenericBound::Trait(ty) => {
|
||||
let trait_ref = this.lower_poly_trait_ref(ty, itctx);
|
||||
Some(trait_ref)
|
||||
}
|
||||
GenericBound::Outlives(lifetime) => {
|
||||
|
@ -1974,9 +1974,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
itctx: ImplTraitContext,
|
||||
) -> hir::GenericBound<'hir> {
|
||||
match tpb {
|
||||
GenericBound::Trait(p, modifiers) => {
|
||||
hir::GenericBound::Trait(self.lower_poly_trait_ref(p, itctx, *modifiers))
|
||||
}
|
||||
GenericBound::Trait(p) => hir::GenericBound::Trait(self.lower_poly_trait_ref(p, itctx)),
|
||||
GenericBound::Outlives(lifetime) => {
|
||||
hir::GenericBound::Outlives(self.lower_lifetime(lifetime))
|
||||
}
|
||||
|
@ -2180,12 +2178,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
&mut self,
|
||||
p: &PolyTraitRef,
|
||||
itctx: ImplTraitContext,
|
||||
modifiers: ast::TraitBoundModifiers,
|
||||
) -> hir::PolyTraitRef<'hir> {
|
||||
let bound_generic_params =
|
||||
self.lower_lifetime_binder(p.trait_ref.ref_id, &p.bound_generic_params);
|
||||
let trait_ref = self.lower_trait_ref(modifiers, &p.trait_ref, itctx);
|
||||
let modifiers = self.lower_trait_bound_modifiers(modifiers);
|
||||
let trait_ref = self.lower_trait_ref(p.modifiers, &p.trait_ref, itctx);
|
||||
let modifiers = self.lower_trait_bound_modifiers(p.modifiers);
|
||||
hir::PolyTraitRef {
|
||||
bound_generic_params,
|
||||
modifiers,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue