Skip to content

Commit c5f16e0

Browse files
committed
Rename ParamBound(s) to GenericBound(s)
1 parent 991efa4 commit c5f16e0

File tree

29 files changed

+181
-181
lines changed

29 files changed

+181
-181
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub trait Visitor<'v> : Sized {
314314
fn visit_trait_ref(&mut self, t: &'v TraitRef) {
315315
walk_trait_ref(self, t)
316316
}
317-
fn visit_param_bound(&mut self, bounds: &'v ParamBound) {
317+
fn visit_param_bound(&mut self, bounds: &'v GenericBound) {
318318
walk_param_bound(self, bounds)
319319
}
320320
fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef, m: TraitBoundModifier) {
@@ -731,12 +731,12 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
731731
walk_list!(visitor, visit_attribute, &foreign_item.attrs);
732732
}
733733

734-
pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v ParamBound) {
734+
pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v GenericBound) {
735735
match *bound {
736-
ParamBound::Trait(ref typ, modifier) => {
736+
GenericBound::Trait(ref typ, modifier) => {
737737
visitor.visit_poly_trait_ref(typ, modifier);
738738
}
739-
ParamBound::Outlives(ref lifetime) => visitor.visit_lifetime(lifetime),
739+
GenericBound::Outlives(ref lifetime) => visitor.visit_lifetime(lifetime),
740740
}
741741
}
742742

src/librustc/hir/lowering.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ impl<'a> LoweringContext<'a> {
12851285
&mut self,
12861286
exist_ty_id: NodeId,
12871287
parent_index: DefIndex,
1288-
bounds: &hir::ParamBounds,
1288+
bounds: &hir::GenericBounds,
12891289
) -> (HirVec<hir::Lifetime>, HirVec<hir::GenericParam>) {
12901290
// This visitor walks over impl trait bounds and creates defs for all lifetimes which
12911291
// appear in the bounds, excluding lifetimes that are created within the bounds.
@@ -1873,16 +1873,16 @@ impl<'a> LoweringContext<'a> {
18731873

18741874
fn lower_param_bound(
18751875
&mut self,
1876-
tpb: &ParamBound,
1876+
tpb: &GenericBound,
18771877
itctx: ImplTraitContext,
1878-
) -> hir::ParamBound {
1878+
) -> hir::GenericBound {
18791879
match *tpb {
1880-
ParamBound::Trait(ref ty, modifier) => hir::ParamBound::Trait(
1880+
GenericBound::Trait(ref ty, modifier) => hir::GenericBound::Trait(
18811881
self.lower_poly_trait_ref(ty, itctx),
18821882
self.lower_trait_bound_modifier(modifier),
18831883
),
1884-
ParamBound::Outlives(ref lifetime) => {
1885-
hir::ParamBound::Outlives(self.lower_lifetime(lifetime))
1884+
GenericBound::Outlives(ref lifetime) => {
1885+
hir::GenericBound::Outlives(self.lower_lifetime(lifetime))
18861886
}
18871887
}
18881888
}
@@ -1925,15 +1925,15 @@ impl<'a> LoweringContext<'a> {
19251925
fn lower_generic_params(
19261926
&mut self,
19271927
params: &Vec<GenericParam>,
1928-
add_bounds: &NodeMap<Vec<ParamBound>>,
1928+
add_bounds: &NodeMap<Vec<GenericBound>>,
19291929
itctx: ImplTraitContext,
19301930
) -> hir::HirVec<hir::GenericParam> {
19311931
params.iter().map(|param| self.lower_generic_param(param, add_bounds, itctx)).collect()
19321932
}
19331933

19341934
fn lower_generic_param(&mut self,
19351935
param: &GenericParam,
1936-
add_bounds: &NodeMap<Vec<ParamBound>>,
1936+
add_bounds: &NodeMap<Vec<GenericBound>>,
19371937
itctx: ImplTraitContext)
19381938
-> hir::GenericParam {
19391939
let mut bounds = self.lower_param_bounds(&param.bounds, itctx);
@@ -2013,7 +2013,7 @@ impl<'a> LoweringContext<'a> {
20132013
for pred in &generics.where_clause.predicates {
20142014
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
20152015
'next_bound: for bound in &bound_pred.bounds {
2016-
if let ParamBound::Trait(_, TraitBoundModifier::Maybe) = *bound {
2016+
if let GenericBound::Trait(_, TraitBoundModifier::Maybe) = *bound {
20172017
let report_error = |this: &mut Self| {
20182018
this.diagnostic().span_err(
20192019
bound_pred.bounded_ty.span,
@@ -2098,7 +2098,7 @@ impl<'a> LoweringContext<'a> {
20982098
.filter_map(|bound| match *bound {
20992099
// Ignore `?Trait` bounds.
21002100
// Tthey were copied into type parameters already.
2101-
ParamBound::Trait(_, TraitBoundModifier::Maybe) => None,
2101+
GenericBound::Trait(_, TraitBoundModifier::Maybe) => None,
21022102
_ => Some(this.lower_param_bound(
21032103
bound,
21042104
ImplTraitContext::Disallowed,
@@ -2217,8 +2217,8 @@ impl<'a> LoweringContext<'a> {
22172217
}
22182218
}
22192219

2220-
fn lower_param_bounds(&mut self, bounds: &[ParamBound], itctx: ImplTraitContext)
2221-
-> hir::ParamBounds {
2220+
fn lower_param_bounds(&mut self, bounds: &[GenericBound], itctx: ImplTraitContext)
2221+
-> hir::GenericBounds {
22222222
bounds.iter().map(|bound| self.lower_param_bound(bound, itctx)).collect()
22232223
}
22242224

src/librustc/hir/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -443,21 +443,21 @@ pub enum TraitBoundModifier {
443443
/// the "special" built-in traits (see middle::lang_items) and
444444
/// detects Copy, Send and Sync.
445445
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
446-
pub enum ParamBound {
446+
pub enum GenericBound {
447447
Trait(PolyTraitRef, TraitBoundModifier),
448448
Outlives(Lifetime),
449449
}
450450

451-
impl ParamBound {
451+
impl GenericBound {
452452
pub fn span(&self) -> Span {
453453
match self {
454-
&ParamBound::Trait(ref t, ..) => t.span,
455-
&ParamBound::Outlives(ref l) => l.span,
454+
&GenericBound::Trait(ref t, ..) => t.span,
455+
&GenericBound::Outlives(ref l) => l.span,
456456
}
457457
}
458458
}
459459

460-
pub type ParamBounds = HirVec<ParamBound>;
460+
pub type GenericBounds = HirVec<GenericBound>;
461461

462462
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
463463
pub enum GenericParamKind {
@@ -479,7 +479,7 @@ pub struct GenericParam {
479479
pub id: NodeId,
480480
pub name: ParamName,
481481
pub attrs: HirVec<Attribute>,
482-
pub bounds: ParamBounds,
482+
pub bounds: GenericBounds,
483483
pub span: Span,
484484
pub pure_wrt_drop: bool,
485485

@@ -588,15 +588,15 @@ pub struct WhereBoundPredicate {
588588
/// The type being bounded
589589
pub bounded_ty: P<Ty>,
590590
/// Trait and lifetime bounds (`Clone+Send+'static`)
591-
pub bounds: ParamBounds,
591+
pub bounds: GenericBounds,
592592
}
593593

594594
/// A lifetime predicate, e.g. `'a: 'b+'c`
595595
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
596596
pub struct WhereRegionPredicate {
597597
pub span: Span,
598598
pub lifetime: Lifetime,
599-
pub bounds: ParamBounds,
599+
pub bounds: GenericBounds,
600600
}
601601

602602
/// An equality predicate (unsupported), e.g. `T=int`
@@ -1555,7 +1555,7 @@ pub enum TraitItemKind {
15551555
Method(MethodSig, TraitMethod),
15561556
/// An associated type with (possibly empty) bounds and optional concrete
15571557
/// type
1558-
Type(ParamBounds, Option<P<Ty>>),
1558+
Type(GenericBounds, Option<P<Ty>>),
15591559
}
15601560

15611561
// The bodies for items are stored "out of line", in a separate
@@ -1640,7 +1640,7 @@ pub struct BareFnTy {
16401640
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
16411641
pub struct ExistTy {
16421642
pub generics: Generics,
1643-
pub bounds: ParamBounds,
1643+
pub bounds: GenericBounds,
16441644
pub impl_trait_fn: Option<DefId>,
16451645
}
16461646

@@ -2049,9 +2049,9 @@ pub enum Item_ {
20492049
/// A union definition, e.g. `union Foo<A, B> {x: A, y: B}`
20502050
ItemUnion(VariantData, Generics),
20512051
/// Represents a Trait Declaration
2052-
ItemTrait(IsAuto, Unsafety, Generics, ParamBounds, HirVec<TraitItemRef>),
2052+
ItemTrait(IsAuto, Unsafety, Generics, GenericBounds, HirVec<TraitItemRef>),
20532053
/// Represents a Trait Alias Declaration
2054-
ItemTraitAlias(Generics, ParamBounds),
2054+
ItemTraitAlias(Generics, GenericBounds),
20552055

20562056
/// An implementation, eg `impl<A> Trait for Foo { .. }`
20572057
ItemImpl(Unsafety,

src/librustc/hir/print.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use syntax::util::parser::{self, AssocOp, Fixity};
2424
use syntax_pos::{self, BytePos, FileName};
2525

2626
use hir;
27-
use hir::{PatKind, ParamBound, TraitBoundModifier, RangeEnd};
27+
use hir::{PatKind, GenericBound, TraitBoundModifier, RangeEnd};
2828
use hir::{GenericParam, GenericParamKind, GenericArg};
2929

3030
use std::cell::Cell;
@@ -514,7 +514,7 @@ impl<'a> State<'a> {
514514

515515
fn print_associated_type(&mut self,
516516
name: ast::Name,
517-
bounds: Option<&hir::ParamBounds>,
517+
bounds: Option<&hir::GenericBounds>,
518518
ty: Option<&hir::Ty>)
519519
-> io::Result<()> {
520520
self.word_space("type")?;
@@ -740,7 +740,7 @@ impl<'a> State<'a> {
740740
self.print_generic_params(&generics.params)?;
741741
let mut real_bounds = Vec::with_capacity(bounds.len());
742742
for b in bounds.iter() {
743-
if let ParamBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
743+
if let GenericBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
744744
self.s.space()?;
745745
self.word_space("for ?")?;
746746
self.print_trait_ref(&ptr.trait_ref)?;
@@ -766,7 +766,7 @@ impl<'a> State<'a> {
766766
let mut real_bounds = Vec::with_capacity(bounds.len());
767767
// FIXME(durka) this seems to be some quite outdated syntax
768768
for b in bounds.iter() {
769-
if let ParamBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
769+
if let GenericBound::Trait(ref ptr, hir::TraitBoundModifier::Maybe) = *b {
770770
self.s.space()?;
771771
self.word_space("for ?")?;
772772
self.print_trait_ref(&ptr.trait_ref)?;
@@ -2071,7 +2071,7 @@ impl<'a> State<'a> {
20712071
}
20722072
}
20732073

2074-
pub fn print_bounds(&mut self, prefix: &str, bounds: &[hir::ParamBound]) -> io::Result<()> {
2074+
pub fn print_bounds(&mut self, prefix: &str, bounds: &[hir::GenericBound]) -> io::Result<()> {
20752075
if !bounds.is_empty() {
20762076
self.s.word(prefix)?;
20772077
let mut first = true;
@@ -2086,13 +2086,13 @@ impl<'a> State<'a> {
20862086
}
20872087

20882088
match bound {
2089-
ParamBound::Trait(tref, modifier) => {
2089+
GenericBound::Trait(tref, modifier) => {
20902090
if modifier == &TraitBoundModifier::Maybe {
20912091
self.s.word("?")?;
20922092
}
20932093
self.print_poly_trait_ref(tref)?;
20942094
}
2095-
ParamBound::Outlives(lt) => {
2095+
GenericBound::Outlives(lt) => {
20962096
self.print_lifetime(lt)?;
20972097
}
20982098
}
@@ -2121,7 +2121,7 @@ impl<'a> State<'a> {
21212121
let mut sep = ":";
21222122
for bound in &param.bounds {
21232123
match bound {
2124-
ParamBound::Outlives(lt) => {
2124+
GenericBound::Outlives(lt) => {
21252125
self.s.word(sep)?;
21262126
self.print_lifetime(lt)?;
21272127
sep = "+";
@@ -2181,7 +2181,7 @@ impl<'a> State<'a> {
21812181

21822182
for (i, bound) in bounds.iter().enumerate() {
21832183
match bound {
2184-
ParamBound::Outlives(lt) => {
2184+
GenericBound::Outlives(lt) => {
21852185
self.print_lifetime(lt)?;
21862186
}
21872187
_ => bug!(),

src/librustc/ich/impls_hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl_stable_hash_for!(struct hir::GenericArgs {
188188
parenthesized
189189
});
190190

191-
impl_stable_hash_for!(enum hir::ParamBound {
191+
impl_stable_hash_for!(enum hir::GenericBound {
192192
Trait(poly_trait_ref, trait_bound_modifier),
193193
Outlives(lifetime)
194194
});

src/librustc/middle/resolve_lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,9 +1250,9 @@ fn object_lifetime_defaults_for_item(
12501250
tcx: TyCtxt<'_, '_, '_>,
12511251
generics: &hir::Generics,
12521252
) -> Vec<ObjectLifetimeDefault> {
1253-
fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::ParamBound]) {
1253+
fn add_bounds(set: &mut Set1<hir::LifetimeName>, bounds: &[hir::GenericBound]) {
12541254
for bound in bounds {
1255-
if let hir::ParamBound::Outlives(ref lifetime) = *bound {
1255+
if let hir::GenericBound::Outlives(ref lifetime) = *bound {
12561256
set.insert(lifetime.name);
12571257
}
12581258
}
@@ -2280,7 +2280,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22802280

22812281
for bound in &lifetime_i.bounds {
22822282
match bound {
2283-
hir::ParamBound::Outlives(lt) => match lt.name {
2283+
hir::GenericBound::Outlives(lt) => match lt.name {
22842284
hir::LifetimeName::Underscore => {
22852285
let mut err = struct_span_err!(
22862286
self.tcx.sess,

src/librustc_passes/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a> AstValidator<'a> {
9999
}
100100
}
101101

102-
fn no_questions_in_bounds(&self, bounds: &ParamBounds, where_: &str, is_trait: bool) {
102+
fn no_questions_in_bounds(&self, bounds: &GenericBounds, where_: &str, is_trait: bool) {
103103
for bound in bounds {
104104
if let Trait(ref poly, TraitBoundModifier::Maybe) = *bound {
105105
let mut err = self.err_handler().struct_span_err(poly.span,

src/librustc_passes/hir_stats.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
203203
hir_visit::walk_impl_item(self, ii)
204204
}
205205

206-
fn visit_param_bound(&mut self, bounds: &'v hir::ParamBound) {
207-
self.record("ParamBound", Id::None, bounds);
206+
fn visit_param_bound(&mut self, bounds: &'v hir::GenericBound) {
207+
self.record("GenericBound", Id::None, bounds);
208208
hir_visit::walk_param_bound(self, bounds)
209209
}
210210

@@ -322,8 +322,8 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
322322
ast_visit::walk_impl_item(self, ii)
323323
}
324324

325-
fn visit_param_bound(&mut self, bounds: &'v ast::ParamBound) {
326-
self.record("ParamBound", Id::None, bounds);
325+
fn visit_param_bound(&mut self, bounds: &'v ast::GenericBound) {
326+
self.record("GenericBound", Id::None, bounds);
327327
ast_visit::walk_param_bound(self, bounds)
328328
}
329329

src/librustc_privacy/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,8 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
10381038
}
10391039

10401040
fn check_ty_param_bound(&mut self,
1041-
ty_param_bound: &hir::ParamBound) {
1042-
if let hir::ParamBound::Trait(ref trait_ref, _) = *ty_param_bound {
1041+
ty_param_bound: &hir::GenericBound) {
1042+
if let hir::GenericBound::Trait(ref trait_ref, _) = *ty_param_bound {
10431043
if self.path_is_private_type(&trait_ref.trait_ref.path) {
10441044
self.old_error_set.insert(trait_ref.trait_ref.ref_id);
10451045
}

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
718718
&mut self,
719719
item: &'l ast::Item,
720720
generics: &'l ast::Generics,
721-
trait_refs: &'l ast::ParamBounds,
721+
trait_refs: &'l ast::GenericBounds,
722722
methods: &'l [ast::TraitItem],
723723
) {
724724
let name = item.ident.to_string();

src/librustc_save_analysis/sig.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub fn assoc_const_signature(
104104
pub fn assoc_type_signature(
105105
id: NodeId,
106106
ident: ast::Ident,
107-
bounds: Option<&ast::ParamBounds>,
107+
bounds: Option<&ast::GenericBounds>,
108108
default: Option<&ast::Ty>,
109109
scx: &SaveContext,
110110
) -> Option<Signature> {
@@ -629,7 +629,7 @@ impl Sig for ast::Generics {
629629
ast::GenericParamKind::Lifetime { .. } => {
630630
let bounds = param.bounds.iter()
631631
.map(|bound| match bound {
632-
ast::ParamBound::Outlives(lt) => lt.ident.to_string(),
632+
ast::GenericBound::Outlives(lt) => lt.ident.to_string(),
633633
_ => panic!(),
634634
})
635635
.collect::<Vec<_>>()
@@ -841,7 +841,7 @@ fn name_and_generics(
841841
fn make_assoc_type_signature(
842842
id: NodeId,
843843
ident: ast::Ident,
844-
bounds: Option<&ast::ParamBounds>,
844+
bounds: Option<&ast::GenericBounds>,
845845
default: Option<&ast::Ty>,
846846
scx: &SaveContext,
847847
) -> Result {

0 commit comments

Comments
 (0)