Rename TraitTyParamBound to ParamBound::Trait
This commit is contained in:
@@ -283,14 +283,14 @@ pub enum TraitBoundModifier {
|
||||
/// detects Copy, Send and Sync.
|
||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
||||
pub enum ParamBound {
|
||||
TraitTyParamBound(PolyTraitRef, TraitBoundModifier),
|
||||
Trait(PolyTraitRef, TraitBoundModifier),
|
||||
Outlives(Lifetime)
|
||||
}
|
||||
|
||||
impl ParamBound {
|
||||
pub fn span(&self) -> Span {
|
||||
match self {
|
||||
&TraitTyParamBound(ref t, ..) => t.span,
|
||||
&Trait(ref t, ..) => t.span,
|
||||
&Outlives(ref l) => l.ident.span,
|
||||
}
|
||||
}
|
||||
@@ -930,7 +930,7 @@ impl Expr {
|
||||
fn to_bound(&self) -> Option<ParamBound> {
|
||||
match &self.node {
|
||||
ExprKind::Path(None, path) =>
|
||||
Some(TraitTyParamBound(PolyTraitRef::new(Vec::new(), path.clone(), self.span),
|
||||
Some(Trait(PolyTraitRef::new(Vec::new(), path.clone(), self.span),
|
||||
TraitBoundModifier::None)),
|
||||
_ => None,
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
}
|
||||
|
||||
fn ty_param_bound(&self, path: ast::Path) -> ast::ParamBound {
|
||||
ast::TraitTyParamBound(self.poly_trait_ref(path.span, path), ast::TraitBoundModifier::None)
|
||||
ast::Trait(self.poly_trait_ref(path.span, path), ast::TraitBoundModifier::None)
|
||||
}
|
||||
|
||||
fn lifetime(&self, span: Span, ident: ast::Ident) -> ast::Lifetime {
|
||||
|
||||
@@ -678,8 +678,8 @@ pub fn noop_fold_fn_decl<T: Folder>(decl: P<FnDecl>, fld: &mut T) -> P<FnDecl> {
|
||||
|
||||
pub fn noop_fold_param_bound<T>(pb: ParamBound, fld: &mut T) -> ParamBound where T: Folder {
|
||||
match pb {
|
||||
TraitTyParamBound(ty, modifier) => {
|
||||
TraitTyParamBound(fld.fold_poly_trait_ref(ty), modifier)
|
||||
Trait(ty, modifier) => {
|
||||
Trait(fld.fold_poly_trait_ref(ty), modifier)
|
||||
}
|
||||
Outlives(lifetime) => Outlives(noop_fold_lifetime(lifetime, fld)),
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
use rustc_target::spec::abi::{self, Abi};
|
||||
use ast::{AngleBracketedArgs, ParenthesizedArgData, AttrStyle, BareFnTy};
|
||||
use ast::{Outlives, TraitTyParamBound, TraitBoundModifier};
|
||||
use ast::{Outlives, Trait, TraitBoundModifier};
|
||||
use ast::Unsafety;
|
||||
use ast::{Mod, AnonConst, Arg, Arm, Attribute, BindingMode, TraitItemKind};
|
||||
use ast::Block;
|
||||
@@ -1444,7 +1444,7 @@ impl<'a> Parser<'a> {
|
||||
TyKind::TraitObject(ref bounds, TraitObjectSyntax::None)
|
||||
if maybe_bounds && bounds.len() == 1 && !trailing_plus => {
|
||||
let path = match bounds[0] {
|
||||
TraitTyParamBound(ref pt, ..) => pt.trait_ref.path.clone(),
|
||||
Trait(ref pt, ..) => pt.trait_ref.path.clone(),
|
||||
_ => self.bug("unexpected lifetime bound"),
|
||||
};
|
||||
self.parse_remaining_bounds(Vec::new(), path, lo, true)?
|
||||
@@ -1566,7 +1566,7 @@ impl<'a> Parser<'a> {
|
||||
fn parse_remaining_bounds(&mut self, generic_params: Vec<GenericParam>, path: ast::Path,
|
||||
lo: Span, parse_plus: bool) -> PResult<'a, TyKind> {
|
||||
let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span));
|
||||
let mut bounds = vec![TraitTyParamBound(poly_trait_ref, TraitBoundModifier::None)];
|
||||
let mut bounds = vec![Trait(poly_trait_ref, TraitBoundModifier::None)];
|
||||
if parse_plus {
|
||||
self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded
|
||||
bounds.append(&mut self.parse_ty_param_bounds()?);
|
||||
@@ -4770,7 +4770,7 @@ impl<'a> Parser<'a> {
|
||||
} else {
|
||||
TraitBoundModifier::None
|
||||
};
|
||||
bounds.push(TraitTyParamBound(poly_trait, modifier));
|
||||
bounds.push(Trait(poly_trait, modifier));
|
||||
}
|
||||
} else {
|
||||
break
|
||||
|
||||
@@ -12,7 +12,7 @@ pub use self::AnnNode::*;
|
||||
|
||||
use rustc_target::spec::abi::{self, Abi};
|
||||
use ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax};
|
||||
use ast::{SelfKind, Outlives, TraitTyParamBound, TraitBoundModifier};
|
||||
use ast::{SelfKind, Outlives, Trait, TraitBoundModifier};
|
||||
use ast::{Attribute, MacDelimiter, GenericArg};
|
||||
use util::parser::{self, AssocOp, Fixity};
|
||||
use attr;
|
||||
@@ -1364,7 +1364,7 @@ impl<'a> State<'a> {
|
||||
self.print_generic_params(&generics.params)?;
|
||||
let mut real_bounds = Vec::with_capacity(bounds.len());
|
||||
for b in bounds.iter() {
|
||||
if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
|
||||
if let Trait(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
|
||||
self.s.space()?;
|
||||
self.word_space("for ?")?;
|
||||
self.print_trait_ref(&ptr.trait_ref)?;
|
||||
@@ -1390,7 +1390,7 @@ impl<'a> State<'a> {
|
||||
let mut real_bounds = Vec::with_capacity(bounds.len());
|
||||
// FIXME(durka) this seems to be some quite outdated syntax
|
||||
for b in bounds.iter() {
|
||||
if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
|
||||
if let Trait(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
|
||||
self.s.space()?;
|
||||
self.word_space("for ?")?;
|
||||
self.print_trait_ref(&ptr.trait_ref)?;
|
||||
@@ -2826,7 +2826,7 @@ impl<'a> State<'a> {
|
||||
}
|
||||
|
||||
match bound {
|
||||
TraitTyParamBound(tref, modifier) => {
|
||||
Trait(tref, modifier) => {
|
||||
if modifier == &TraitBoundModifier::Maybe {
|
||||
self.s.word("?")?;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,7 @@ pub fn walk_global_asm<'a, V: Visitor<'a>>(_: &mut V, _: &'a GlobalAsm) {
|
||||
|
||||
pub fn walk_param_bound<'a, V: Visitor<'a>>(visitor: &mut V, bound: &'a ParamBound) {
|
||||
match *bound {
|
||||
TraitTyParamBound(ref typ, ref modifier) => {
|
||||
Trait(ref typ, ref modifier) => {
|
||||
visitor.visit_poly_trait_ref(typ, modifier);
|
||||
}
|
||||
Outlives(ref lifetime) => {
|
||||
|
||||
Reference in New Issue
Block a user