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
|
@ -2113,7 +2113,7 @@ impl<'a> Parser<'a> {
|
|||
&& let Some(poly) = bounds
|
||||
.iter()
|
||||
.filter_map(|bound| match bound {
|
||||
ast::GenericBound::Trait(poly, _) => Some(poly),
|
||||
ast::GenericBound::Trait(poly) => Some(poly),
|
||||
_ => None,
|
||||
})
|
||||
.last()
|
||||
|
|
|
@ -948,8 +948,8 @@ impl<'a> Parser<'a> {
|
|||
{
|
||||
return Ok((false, seg.ident, seg.args.as_deref().cloned()));
|
||||
} else if let ast::TyKind::TraitObject(bounds, ast::TraitObjectSyntax::None) = &ty.kind
|
||||
&& let [ast::GenericBound::Trait(trait_ref, ast::TraitBoundModifiers::NONE)] =
|
||||
bounds.as_slice()
|
||||
&& let [ast::GenericBound::Trait(trait_ref)] = bounds.as_slice()
|
||||
&& trait_ref.modifiers == ast::TraitBoundModifiers::NONE
|
||||
&& let [seg] = trait_ref.trait_ref.path.segments.as_slice()
|
||||
{
|
||||
return Ok((true, seg.ident, seg.args.as_deref().cloned()));
|
||||
|
|
|
@ -419,8 +419,13 @@ impl<'a> Parser<'a> {
|
|||
lo: Span,
|
||||
parse_plus: bool,
|
||||
) -> PResult<'a, TyKind> {
|
||||
let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_token.span));
|
||||
let bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifiers::NONE)];
|
||||
let poly_trait_ref = PolyTraitRef::new(
|
||||
generic_params,
|
||||
path,
|
||||
TraitBoundModifiers::NONE,
|
||||
lo.to(self.prev_token.span),
|
||||
);
|
||||
let bounds = vec![GenericBound::Trait(poly_trait_ref)];
|
||||
self.parse_remaining_bounds(bounds, parse_plus)
|
||||
}
|
||||
|
||||
|
@ -1085,8 +1090,9 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
let poly_trait = PolyTraitRef::new(lifetime_defs, path, lo.to(self.prev_token.span));
|
||||
Ok(GenericBound::Trait(poly_trait, modifiers))
|
||||
let poly_trait =
|
||||
PolyTraitRef::new(lifetime_defs, path, modifiers, lo.to(self.prev_token.span));
|
||||
Ok(GenericBound::Trait(poly_trait))
|
||||
}
|
||||
|
||||
// recovers a `Fn(..)` parenthesized-style path from `fn(..)`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue