Rename TraitTyParamBound to ParamBound::Trait
This commit is contained in:
parent
8bc3a35576
commit
7de6ed06a5
17 changed files with 57 additions and 64 deletions
|
@ -733,10 +733,10 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
|
|||
|
||||
pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v ParamBound) {
|
||||
match *bound {
|
||||
TraitTyParamBound(ref typ, modifier) => {
|
||||
ParamBound::Trait(ref typ, modifier) => {
|
||||
visitor.visit_poly_trait_ref(typ, modifier);
|
||||
}
|
||||
Outlives(ref lifetime) => visitor.visit_lifetime(lifetime),
|
||||
ParamBound::Outlives(ref lifetime) => visitor.visit_lifetime(lifetime),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1108,10 +1108,10 @@ impl<'a> LoweringContext<'a> {
|
|||
let bounds = bounds
|
||||
.iter()
|
||||
.filter_map(|bound| match *bound {
|
||||
TraitTyParamBound(ref ty, TraitBoundModifier::None) => {
|
||||
Trait(ref ty, TraitBoundModifier::None) => {
|
||||
Some(self.lower_poly_trait_ref(ty, itctx))
|
||||
}
|
||||
TraitTyParamBound(_, TraitBoundModifier::Maybe) => None,
|
||||
Trait(_, TraitBoundModifier::Maybe) => None,
|
||||
Outlives(ref lifetime) => {
|
||||
if lifetime_bound.is_none() {
|
||||
lifetime_bound = Some(self.lower_lifetime(lifetime));
|
||||
|
@ -1875,12 +1875,12 @@ impl<'a> LoweringContext<'a> {
|
|||
itctx: ImplTraitContext,
|
||||
) -> hir::ParamBound {
|
||||
match *tpb {
|
||||
TraitTyParamBound(ref ty, modifier) => hir::TraitTyParamBound(
|
||||
ParamBound::Trait(ref ty, modifier) => hir::ParamBound::Trait(
|
||||
self.lower_poly_trait_ref(ty, itctx),
|
||||
self.lower_trait_bound_modifier(modifier),
|
||||
),
|
||||
Outlives(ref lifetime) => {
|
||||
hir::Outlives(self.lower_lifetime(lifetime))
|
||||
ParamBound::Outlives(ref lifetime) => {
|
||||
hir::ParamBound::Outlives(self.lower_lifetime(lifetime))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2010,7 +2010,7 @@ impl<'a> LoweringContext<'a> {
|
|||
for pred in &generics.where_clause.predicates {
|
||||
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
|
||||
'next_bound: for bound in &bound_pred.bounds {
|
||||
if let TraitTyParamBound(_, TraitBoundModifier::Maybe) = *bound {
|
||||
if let ParamBound::Trait(_, TraitBoundModifier::Maybe) = *bound {
|
||||
let report_error = |this: &mut Self| {
|
||||
this.diagnostic().span_err(
|
||||
bound_pred.bounded_ty.span,
|
||||
|
@ -2095,7 +2095,7 @@ impl<'a> LoweringContext<'a> {
|
|||
.filter_map(|bound| match *bound {
|
||||
// Ignore `?Trait` bounds.
|
||||
// Tthey were copied into type parameters already.
|
||||
TraitTyParamBound(_, TraitBoundModifier::Maybe) => None,
|
||||
ParamBound::Trait(_, TraitBoundModifier::Maybe) => None,
|
||||
_ => Some(this.lower_param_bound(
|
||||
bound,
|
||||
ImplTraitContext::Disallowed,
|
||||
|
|
|
@ -22,7 +22,6 @@ pub use self::Mutability::*;
|
|||
pub use self::PrimTy::*;
|
||||
pub use self::Stmt_::*;
|
||||
pub use self::Ty_::*;
|
||||
pub use self::ParamBound::*;
|
||||
pub use self::UnOp::*;
|
||||
pub use self::UnsafeSource::*;
|
||||
pub use self::Visibility::{Public, Inherited};
|
||||
|
@ -445,15 +444,15 @@ 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,
|
||||
&Outlives(ref l) => l.span,
|
||||
&ParamBound::Trait(ref t, ..) => t.span,
|
||||
&ParamBound::Outlives(ref l) => l.span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ use syntax::util::parser::{self, AssocOp, Fixity};
|
|||
use syntax_pos::{self, BytePos, FileName};
|
||||
|
||||
use hir;
|
||||
use hir::{PatKind, Outlives, TraitTyParamBound, TraitBoundModifier, RangeEnd};
|
||||
use hir::{PatKind, ParamBound, TraitBoundModifier, RangeEnd};
|
||||
use hir::{GenericParam, GenericParamKind, GenericArg};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
@ -740,7 +740,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, hir::TraitBoundModifier::Maybe) = *b {
|
||||
if let ParamBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
|
||||
self.s.space()?;
|
||||
self.word_space("for ?")?;
|
||||
self.print_trait_ref(&ptr.trait_ref)?;
|
||||
|
@ -766,7 +766,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, hir::TraitBoundModifier::Maybe) = *b {
|
||||
if let ParamBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
|
||||
self.s.space()?;
|
||||
self.word_space("for ?")?;
|
||||
self.print_trait_ref(&ptr.trait_ref)?;
|
||||
|
@ -2086,13 +2086,13 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
match bound {
|
||||
TraitTyParamBound(tref, modifier) => {
|
||||
ParamBound::Trait(tref, modifier) => {
|
||||
if modifier == &TraitBoundModifier::Maybe {
|
||||
self.s.word("?")?;
|
||||
}
|
||||
self.print_poly_trait_ref(tref)?;
|
||||
}
|
||||
Outlives(lt) => {
|
||||
ParamBound::Outlives(lt) => {
|
||||
self.print_lifetime(lt)?;
|
||||
}
|
||||
}
|
||||
|
@ -2121,7 +2121,7 @@ impl<'a> State<'a> {
|
|||
let mut sep = ":";
|
||||
for bound in ¶m.bounds {
|
||||
match bound {
|
||||
hir::ParamBound::Outlives(lt) => {
|
||||
ParamBound::Outlives(lt) => {
|
||||
self.s.word(sep)?;
|
||||
self.print_lifetime(lt)?;
|
||||
sep = "+";
|
||||
|
@ -2181,7 +2181,7 @@ impl<'a> State<'a> {
|
|||
|
||||
for (i, bound) in bounds.iter().enumerate() {
|
||||
match bound {
|
||||
hir::ParamBound::Outlives(lt) => {
|
||||
ParamBound::Outlives(lt) => {
|
||||
self.print_lifetime(lt)?;
|
||||
}
|
||||
_ => bug!(),
|
||||
|
|
|
@ -189,7 +189,7 @@ impl_stable_hash_for!(struct hir::GenericArgs {
|
|||
});
|
||||
|
||||
impl_stable_hash_for!(enum hir::ParamBound {
|
||||
TraitTyParamBound(poly_trait_ref, trait_bound_modifier),
|
||||
Trait(poly_trait_ref, trait_bound_modifier),
|
||||
Outlives(lifetime)
|
||||
});
|
||||
|
||||
|
|
|
@ -1256,7 +1256,7 @@ fn object_lifetime_defaults_for_item(
|
|||
) -> Vec<ObjectLifetimeDefault> {
|
||||
fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::ParamBound]) {
|
||||
for bound in bounds {
|
||||
if let hir::Outlives(ref lifetime) = *bound {
|
||||
if let hir::ParamBound::Outlives(ref lifetime) = *bound {
|
||||
set.insert(lifetime.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ impl<'a> AstValidator<'a> {
|
|||
|
||||
fn no_questions_in_bounds(&self, bounds: &ParamBounds, where_: &str, is_trait: bool) {
|
||||
for bound in bounds {
|
||||
if let TraitTyParamBound(ref poly, TraitBoundModifier::Maybe) = *bound {
|
||||
if let Trait(ref poly, TraitBoundModifier::Maybe) = *bound {
|
||||
let mut err = self.err_handler().struct_span_err(poly.span,
|
||||
&format!("`?Trait` is not permitted in {}", where_));
|
||||
if is_trait {
|
||||
|
@ -203,7 +203,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
TyKind::ImplTrait(ref bounds) => {
|
||||
if !bounds.iter()
|
||||
.any(|b| if let TraitTyParamBound(..) = *b { true } else { false }) {
|
||||
.any(|b| if let Trait(..) = *b { true } else { false }) {
|
||||
self.err_handler().span_err(ty.span, "at least one trait must be specified");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1039,7 +1039,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
|||
|
||||
fn check_ty_param_bound(&mut self,
|
||||
ty_param_bound: &hir::ParamBound) {
|
||||
if let hir::TraitTyParamBound(ref trait_ref, _) = *ty_param_bound {
|
||||
if let hir::ParamBound::Trait(ref trait_ref, _) = *ty_param_bound {
|
||||
if self.path_is_private_type(&trait_ref.trait_ref.path) {
|
||||
self.old_error_set.insert(trait_ref.trait_ref.ref_id);
|
||||
}
|
||||
|
|
|
@ -761,7 +761,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
|
|||
// super-traits
|
||||
for super_bound in trait_refs.iter() {
|
||||
let trait_ref = match *super_bound {
|
||||
ast::TraitTyParamBound(ref trait_ref, _) => trait_ref,
|
||||
ast::Trait(ref trait_ref, _) => trait_ref,
|
||||
ast::Outlives(..) => {
|
||||
continue;
|
||||
}
|
||||
|
@ -1489,7 +1489,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
|
|||
ast::GenericParamKind::Lifetime { .. } => {}
|
||||
ast::GenericParamKind::Type { ref default, .. } => {
|
||||
for bound in ¶m.bounds {
|
||||
if let ast::TraitTyParamBound(ref trait_ref, _) = *bound {
|
||||
if let ast::Trait(ref trait_ref, _) = *bound {
|
||||
self.process_path(trait_ref.trait_ref.ref_id, &trait_ref.trait_ref.path)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1257,7 +1257,7 @@ fn is_unsized<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>,
|
|||
// Try to find an unbound in bounds.
|
||||
let mut unbound = None;
|
||||
for ab in ast_bounds {
|
||||
if let &hir::TraitTyParamBound(ref ptr, hir::TraitBoundModifier::Maybe) = ab {
|
||||
if let &hir::ParamBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = ab {
|
||||
if unbound.is_none() {
|
||||
unbound = Some(ptr.trait_ref.clone());
|
||||
} else {
|
||||
|
@ -1482,7 +1482,7 @@ pub fn explicit_predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
for bound in bound_pred.bounds.iter() {
|
||||
match bound {
|
||||
&hir::ParamBound::TraitTyParamBound(ref poly_trait_ref, _) => {
|
||||
&hir::ParamBound::Trait(ref poly_trait_ref, _) => {
|
||||
let mut projections = Vec::new();
|
||||
|
||||
let trait_ref =
|
||||
|
@ -1591,22 +1591,16 @@ pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>,
|
|||
let mut trait_bounds = vec![];
|
||||
for ast_bound in ast_bounds {
|
||||
match *ast_bound {
|
||||
hir::TraitTyParamBound(ref b, hir::TraitBoundModifier::None) => {
|
||||
trait_bounds.push(b);
|
||||
}
|
||||
hir::TraitTyParamBound(_, hir::TraitBoundModifier::Maybe) => {}
|
||||
hir::Outlives(ref l) => {
|
||||
region_bounds.push(l);
|
||||
}
|
||||
hir::ParamBound::Trait(ref b, hir::TraitBoundModifier::None) => trait_bounds.push(b),
|
||||
hir::ParamBound::Trait(_, hir::TraitBoundModifier::Maybe) => {}
|
||||
hir::ParamBound::Outlives(ref l) => region_bounds.push(l),
|
||||
}
|
||||
}
|
||||
|
||||
let mut projection_bounds = vec![];
|
||||
|
||||
let mut trait_bounds: Vec<_> = trait_bounds.iter().map(|&bound| {
|
||||
astconv.instantiate_poly_trait_ref(bound,
|
||||
param_ty,
|
||||
&mut projection_bounds)
|
||||
astconv.instantiate_poly_trait_ref(bound, param_ty, &mut projection_bounds)
|
||||
}).collect();
|
||||
|
||||
let region_bounds = region_bounds.into_iter().map(|r| {
|
||||
|
@ -1640,7 +1634,7 @@ fn predicates_from_bound<'tcx>(astconv: &AstConv<'tcx, 'tcx>,
|
|||
-> Vec<ty::Predicate<'tcx>>
|
||||
{
|
||||
match *bound {
|
||||
hir::TraitTyParamBound(ref tr, hir::TraitBoundModifier::None) => {
|
||||
hir::ParamBound::Trait(ref tr, hir::TraitBoundModifier::None) => {
|
||||
let mut projections = Vec::new();
|
||||
let pred = astconv.instantiate_poly_trait_ref(tr,
|
||||
param_ty,
|
||||
|
@ -1650,14 +1644,12 @@ fn predicates_from_bound<'tcx>(astconv: &AstConv<'tcx, 'tcx>,
|
|||
.chain(Some(pred.to_predicate()))
|
||||
.collect()
|
||||
}
|
||||
hir::Outlives(ref lifetime) => {
|
||||
hir::ParamBound::Outlives(ref lifetime) => {
|
||||
let region = astconv.ast_region_to_region(lifetime, None);
|
||||
let pred = ty::Binder::bind(ty::OutlivesPredicate(param_ty, region));
|
||||
vec![ty::Predicate::TypeOutlives(pred)]
|
||||
}
|
||||
hir::TraitTyParamBound(_, hir::TraitBoundModifier::Maybe) => {
|
||||
Vec::new()
|
||||
}
|
||||
hir::ParamBound::Trait(_, hir::TraitBoundModifier::Maybe) => vec![],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1510,8 +1510,8 @@ impl ParamBound {
|
|||
impl Clean<ParamBound> for hir::ParamBound {
|
||||
fn clean(&self, cx: &DocContext) -> ParamBound {
|
||||
match *self {
|
||||
hir::Outlives(lt) => Outlives(lt.clean(cx)),
|
||||
hir::TraitTyParamBound(ref t, modifier) => TraitBound(t.clean(cx), modifier),
|
||||
hir::ParamBound::Outlives(lt) => Outlives(lt.clean(cx)),
|
||||
hir::ParamBound::Trait(ref t, modifier) => TraitBound(t.clean(cx), modifier),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1624,7 +1624,7 @@ impl<'tcx> Clean<Option<Vec<ParamBound>>> for Substs<'tcx> {
|
|||
fn clean(&self, cx: &DocContext) -> Option<Vec<ParamBound>> {
|
||||
let mut v = Vec::new();
|
||||
v.extend(self.regions().filter_map(|r| r.clean(cx))
|
||||
.map(Outlives));
|
||||
.map(ParamBound::Outlives));
|
||||
v.extend(self.types().map(|t| TraitBound(PolyTrait {
|
||||
trait_: t.clean(cx),
|
||||
generic_params: Vec::new(),
|
||||
|
@ -3080,7 +3080,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
|||
inline::record_extern_fqn(cx, did, TypeKind::Trait);
|
||||
|
||||
let mut typarams = vec![];
|
||||
reg.clean(cx).map(|b| typarams.push(Outlives(b)));
|
||||
reg.clean(cx).map(|b| typarams.push(ParamBound::Outlives(b)));
|
||||
for did in obj.auto_traits() {
|
||||
let empty = cx.tcx.intern_substs(&[]);
|
||||
let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
|
||||
|
@ -3137,7 +3137,9 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
|||
tr
|
||||
} else if let ty::Predicate::TypeOutlives(pred) = *predicate {
|
||||
// these should turn up at the end
|
||||
pred.skip_binder().1.clean(cx).map(|r| regions.push(Outlives(r)));
|
||||
pred.skip_binder().1.clean(cx).map(|r| {
|
||||
regions.push(ParamBound::Outlives(r))
|
||||
});
|
||||
return None;
|
||||
} else {
|
||||
return None;
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue