@@ -98,7 +98,7 @@ pub type SyntaxContext = u32;
98
98
// it should cut down on memory use *a lot*; applying a mark
99
99
// to a tree containing 50 identifiers would otherwise generate
100
100
pub struct SCTable {
101
- table : RefCell < ~ [ SyntaxContext_ ] > ,
101
+ table : RefCell < Vec < SyntaxContext_ > > ,
102
102
mark_memo : RefCell < HashMap < ( SyntaxContext , Mrk ) , SyntaxContext > > ,
103
103
rename_memo : RefCell < HashMap < ( SyntaxContext , Ident , Name ) , SyntaxContext > > ,
104
104
}
@@ -164,7 +164,7 @@ pub struct Path {
164
164
/// module (like paths in an import).
165
165
global : bool ,
166
166
/// The segments in the path: the things separated by `::`.
167
- segments : ~ [ PathSegment ] ,
167
+ segments : Vec < PathSegment > ,
168
168
}
169
169
170
170
/// A segment of a path: an identifier, an optional lifetime, and a set of
@@ -288,12 +288,12 @@ pub enum DefRegion {
288
288
289
289
// The set of MetaItems that define the compilation environment of the crate,
290
290
// used to drive conditional compilation
291
- pub type CrateConfig = ~ [ @MetaItem ] ;
291
+ pub type CrateConfig = Vec < @MetaItem > ;
292
292
293
293
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
294
294
pub struct Crate {
295
295
module : Mod ,
296
- attrs : ~ [ Attribute ] ,
296
+ attrs : Vec < Attribute > ,
297
297
config : CrateConfig ,
298
298
span : Span ,
299
299
}
@@ -303,7 +303,7 @@ pub type MetaItem = Spanned<MetaItem_>;
303
303
#[ deriving( Clone , Encodable , Decodable , Hash ) ]
304
304
pub enum MetaItem_ {
305
305
MetaWord ( InternedString ) ,
306
- MetaList ( InternedString , ~ [ @MetaItem ] ) ,
306
+ MetaList ( InternedString , Vec < @MetaItem > ) ,
307
307
MetaNameValue ( InternedString , Lit ) ,
308
308
}
309
309
@@ -334,8 +334,8 @@ impl Eq for MetaItem_ {
334
334
335
335
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
336
336
pub struct Block {
337
- view_items : ~ [ ViewItem ] ,
338
- stmts : ~ [ @Stmt ] ,
337
+ view_items : Vec < ViewItem > ,
338
+ stmts : Vec < @Stmt > ,
339
339
expr : Option < @Expr > ,
340
340
id : NodeId ,
341
341
rules : BlockCheckMode ,
@@ -373,17 +373,17 @@ pub enum Pat_ {
373
373
// records this pattern's NodeId in an auxiliary
374
374
// set (of "pat_idents that refer to nullary enums")
375
375
PatIdent ( BindingMode , Path , Option < @Pat > ) ,
376
- PatEnum ( Path , Option < ~ [ @Pat ] > ) , /* "none" means a * pattern where
376
+ PatEnum ( Path , Option < Vec < @Pat > > ) , /* "none" means a * pattern where
377
377
* we don't bind the fields to names */
378
- PatStruct ( Path , ~ [ FieldPat ] , bool ) ,
379
- PatTup ( ~ [ @Pat ] ) ,
378
+ PatStruct ( Path , Vec < FieldPat > , bool ) ,
379
+ PatTup ( Vec < @Pat > ) ,
380
380
PatUniq ( @Pat ) ,
381
381
PatRegion ( @Pat ) , // reference pattern
382
382
PatLit ( @Expr ) ,
383
383
PatRange ( @Expr , @Expr ) ,
384
384
// [a, b, ..i, y, z] is represented as
385
385
// PatVec(~[a, b], Some(i), ~[y, z])
386
- PatVec ( ~ [ @Pat ] , Option < @Pat > , ~ [ @Pat ] )
386
+ PatVec ( Vec < @Pat > , Option < @Pat > , Vec < @Pat > )
387
387
}
388
388
389
389
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
@@ -488,7 +488,7 @@ pub enum Decl_ {
488
488
489
489
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
490
490
pub struct Arm {
491
- pats : ~ [ @Pat ] ,
491
+ pats : Vec < @Pat > ,
492
492
guard : Option < @Expr > ,
493
493
body : P < Block > ,
494
494
}
@@ -526,10 +526,10 @@ pub enum Expr_ {
526
526
ExprVstore ( @Expr , ExprVstore ) ,
527
527
// First expr is the place; second expr is the value.
528
528
ExprBox ( @Expr , @Expr ) ,
529
- ExprVec ( ~ [ @Expr ] , Mutability ) ,
530
- ExprCall ( @Expr , ~ [ @Expr ] ) ,
531
- ExprMethodCall ( Ident , ~ [ P < Ty > ] , ~ [ @Expr ] ) ,
532
- ExprTup ( ~ [ @Expr ] ) ,
529
+ ExprVec ( Vec < @Expr > , Mutability ) ,
530
+ ExprCall ( @Expr , Vec < @Expr > ) ,
531
+ ExprMethodCall ( Ident , Vec < P < Ty > > , Vec < @Expr > ) ,
532
+ ExprTup ( Vec < @Expr > ) ,
533
533
ExprBinary ( BinOp , @Expr , @Expr ) ,
534
534
ExprUnary ( UnOp , @Expr ) ,
535
535
ExprLit ( @Lit ) ,
@@ -541,14 +541,14 @@ pub enum Expr_ {
541
541
// Conditionless loop (can be exited with break, cont, or ret)
542
542
// FIXME #6993: change to Option<Name>
543
543
ExprLoop ( P < Block > , Option < Ident > ) ,
544
- ExprMatch ( @Expr , ~ [ Arm ] ) ,
544
+ ExprMatch ( @Expr , Vec < Arm > ) ,
545
545
ExprFnBlock ( P < FnDecl > , P < Block > ) ,
546
546
ExprProc ( P < FnDecl > , P < Block > ) ,
547
547
ExprBlock ( P < Block > ) ,
548
548
549
549
ExprAssign ( @Expr , @Expr ) ,
550
550
ExprAssignOp ( BinOp , @Expr , @Expr ) ,
551
- ExprField ( @Expr , Ident , ~ [ P < Ty > ] ) ,
551
+ ExprField ( @Expr , Ident , Vec < P < Ty > > ) ,
552
552
ExprIndex ( @Expr , @Expr ) ,
553
553
554
554
/// Expression that looks like a "name". For example,
@@ -569,7 +569,7 @@ pub enum Expr_ {
569
569
ExprMac ( Mac ) ,
570
570
571
571
// A struct literal expression.
572
- ExprStruct ( Path , ~ [ Field ] , Option < @Expr > /* base */ ) ,
572
+ ExprStruct ( Path , Vec < Field > , Option < @Expr > /* base */ ) ,
573
573
574
574
// A vector literal constructed from one repeated element.
575
575
ExprRepeat ( @Expr /* element */ , @Expr /* count */ , Mutability ) ,
@@ -600,14 +600,14 @@ pub enum TokenTree {
600
600
TTTok ( Span , :: parse:: token:: Token ) ,
601
601
// a delimited sequence (the delimiters appear as the first
602
602
// and last elements of the vector)
603
- TTDelim ( @~ [ TokenTree ] ) ,
603
+ TTDelim ( @Vec < TokenTree > ) ,
604
604
605
605
// These only make sense for right-hand-sides of MBE macros:
606
606
607
607
// a kleene-style repetition sequence with a span, a TTForest,
608
608
// an optional separator, and a boolean where true indicates
609
609
// zero or more (..), and false indicates one or more (+).
610
- TTSeq ( Span , @~ [ TokenTree ] , Option < :: parse:: token:: Token > , bool ) ,
610
+ TTSeq ( Span , @Vec < TokenTree > , Option < :: parse:: token:: Token > , bool ) ,
611
611
612
612
// a syntactic variable that will be filled in by macro expansion.
613
613
TTNonterminal ( Span , Ident )
@@ -673,7 +673,7 @@ pub enum Matcher_ {
673
673
MatchTok ( :: parse:: token:: Token ) ,
674
674
// match repetitions of a sequence: body, separator, zero ok?,
675
675
// lo, hi position-in-match-array used:
676
- MatchSeq ( ~ [ Matcher ] , Option < :: parse:: token:: Token > , bool , uint , uint ) ,
676
+ MatchSeq ( Vec < Matcher > , Option < :: parse:: token:: Token > , bool , uint , uint ) ,
677
677
// parse a Rust NT: name to bind, name of NT, position in match array:
678
678
MatchNonterminal ( Ident , Ident , uint )
679
679
}
@@ -686,7 +686,7 @@ pub type Mac = Spanned<Mac_>;
686
686
// There's only one flavor, now, so this could presumably be simplified.
687
687
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
688
688
pub enum Mac_ {
689
- MacInvocTT ( Path , ~ [ TokenTree ] , SyntaxContext ) , // new macro-invocation
689
+ MacInvocTT ( Path , Vec < TokenTree > , SyntaxContext ) , // new macro-invocation
690
690
}
691
691
692
692
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
@@ -700,7 +700,7 @@ pub type Lit = Spanned<Lit_>;
700
700
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
701
701
pub enum Lit_ {
702
702
LitStr ( InternedString , StrStyle ) ,
703
- LitBinary ( Rc < ~ [ u8 ] > ) ,
703
+ LitBinary ( Rc < Vec < u8 > > ) ,
704
704
LitChar ( u32 ) ,
705
705
LitInt ( i64 , IntTy ) ,
706
706
LitUint ( u64 , UintTy ) ,
@@ -729,7 +729,7 @@ pub struct TypeField {
729
729
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
730
730
pub struct TypeMethod {
731
731
ident : Ident ,
732
- attrs : ~ [ Attribute ] ,
732
+ attrs : Vec < Attribute > ,
733
733
purity : Purity ,
734
734
decl : P < FnDecl > ,
735
735
generics : Generics ,
@@ -858,7 +858,7 @@ pub enum Ty_ {
858
858
TyRptr ( Option < Lifetime > , MutTy ) ,
859
859
TyClosure ( @ClosureTy ) ,
860
860
TyBareFn ( @BareFnTy ) ,
861
- TyTup ( ~ [ P < Ty > ] ) ,
861
+ TyTup ( Vec < P < Ty > > ) ,
862
862
TyPath ( Path , Option < OptVec < TyParamBound > > , NodeId ) , // for #7264; see above
863
863
TyTypeof ( @Expr ) ,
864
864
// TyInfer means the type should be inferred instead of it having been
@@ -878,8 +878,8 @@ pub struct InlineAsm {
878
878
asm : InternedString ,
879
879
asm_str_style : StrStyle ,
880
880
clobbers : InternedString ,
881
- inputs : ~ [ ( InternedString , @Expr ) ] ,
882
- outputs : ~ [ ( InternedString , @Expr ) ] ,
881
+ inputs : Vec < ( InternedString , @Expr ) > ,
882
+ outputs : Vec < ( InternedString , @Expr ) > ,
883
883
volatile : bool ,
884
884
alignstack : bool ,
885
885
dialect : AsmDialect
@@ -914,7 +914,7 @@ impl Arg {
914
914
915
915
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
916
916
pub struct FnDecl {
917
- inputs : ~ [ Arg ] ,
917
+ inputs : Vec < Arg > ,
918
918
output : P < Ty > ,
919
919
cf : RetStyle ,
920
920
variadic : bool
@@ -957,7 +957,7 @@ pub type ExplicitSelf = Spanned<ExplicitSelf_>;
957
957
#[ deriving( Eq , Encodable , Decodable , Hash ) ]
958
958
pub struct Method {
959
959
ident : Ident ,
960
- attrs : ~ [ Attribute ] ,
960
+ attrs : Vec < Attribute > ,
961
961
generics : Generics ,
962
962
explicit_self : ExplicitSelf ,
963
963
purity : Purity ,
@@ -970,15 +970,15 @@ pub struct Method {
970
970
971
971
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
972
972
pub struct Mod {
973
- view_items : ~ [ ViewItem ] ,
974
- items : ~ [ @Item ] ,
973
+ view_items : Vec < ViewItem > ,
974
+ items : Vec < @Item > ,
975
975
}
976
976
977
977
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
978
978
pub struct ForeignMod {
979
979
abis : AbiSet ,
980
- view_items : ~ [ ViewItem ] ,
981
- items : ~ [ @ForeignItem ] ,
980
+ view_items : Vec < ViewItem > ,
981
+ items : Vec < @ForeignItem > ,
982
982
}
983
983
984
984
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
@@ -989,19 +989,19 @@ pub struct VariantArg {
989
989
990
990
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
991
991
pub enum VariantKind {
992
- TupleVariantKind ( ~ [ VariantArg ] ) ,
992
+ TupleVariantKind ( Vec < VariantArg > ) ,
993
993
StructVariantKind ( @StructDef ) ,
994
994
}
995
995
996
996
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
997
997
pub struct EnumDef {
998
- variants : ~ [ P < Variant > ] ,
998
+ variants : Vec < P < Variant > > ,
999
999
}
1000
1000
1001
1001
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
1002
1002
pub struct Variant_ {
1003
1003
name : Ident ,
1004
- attrs : ~ [ Attribute ] ,
1004
+ attrs : Vec < Attribute > ,
1005
1005
kind : VariantKind ,
1006
1006
id : NodeId ,
1007
1007
disr_expr : Option < @Expr > ,
@@ -1034,13 +1034,13 @@ pub enum ViewPath_ {
1034
1034
ViewPathGlob ( Path , NodeId ) ,
1035
1035
1036
1036
// foo::bar::{a,b,c}
1037
- ViewPathList ( Path , ~ [ PathListIdent ] , NodeId )
1037
+ ViewPathList ( Path , Vec < PathListIdent > , NodeId )
1038
1038
}
1039
1039
1040
1040
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
1041
1041
pub struct ViewItem {
1042
1042
node : ViewItem_ ,
1043
- attrs : ~ [ Attribute ] ,
1043
+ attrs : Vec < Attribute > ,
1044
1044
vis : Visibility ,
1045
1045
span : Span ,
1046
1046
}
@@ -1052,7 +1052,7 @@ pub enum ViewItem_ {
1052
1052
// (containing arbitrary characters) from which to fetch the crate sources
1053
1053
// For example, extern crate whatever = "github.com/mozilla/rust"
1054
1054
ViewItemExternMod ( Ident , Option < ( InternedString , StrStyle ) > , NodeId ) ,
1055
- ViewItemUse ( ~ [ @ViewPath ] ) ,
1055
+ ViewItemUse ( Vec < @ViewPath > ) ,
1056
1056
}
1057
1057
1058
1058
// Meta-data associated with an item
@@ -1109,7 +1109,7 @@ pub struct StructField_ {
1109
1109
kind : StructFieldKind ,
1110
1110
id : NodeId ,
1111
1111
ty : P < Ty > ,
1112
- attrs : ~ [ Attribute ] ,
1112
+ attrs : Vec < Attribute > ,
1113
1113
}
1114
1114
1115
1115
pub type StructField = Spanned < StructField_ > ;
@@ -1122,7 +1122,7 @@ pub enum StructFieldKind {
1122
1122
1123
1123
#[ deriving( Eq , Encodable , Decodable , Hash ) ]
1124
1124
pub struct StructDef {
1125
- fields : ~ [ StructField ] , /* fields, not including ctor */
1125
+ fields : Vec < StructField > , /* fields, not including ctor */
1126
1126
/* ID of the constructor. This is only used for tuple- or enum-like
1127
1127
* structs. */
1128
1128
ctor_id : Option < NodeId >
@@ -1135,7 +1135,7 @@ pub struct StructDef {
1135
1135
#[ deriving( Clone , Eq , Encodable , Decodable , Hash ) ]
1136
1136
pub struct Item {
1137
1137
ident : Ident ,
1138
- attrs : ~ [ Attribute ] ,
1138
+ attrs : Vec < Attribute > ,
1139
1139
id : NodeId ,
1140
1140
node : Item_ ,
1141
1141
vis : Visibility ,
@@ -1151,19 +1151,19 @@ pub enum Item_ {
1151
1151
ItemTy ( P < Ty > , Generics ) ,
1152
1152
ItemEnum ( EnumDef , Generics ) ,
1153
1153
ItemStruct ( @StructDef , Generics ) ,
1154
- ItemTrait ( Generics , ~ [ TraitRef ] , ~ [ TraitMethod ] ) ,
1154
+ ItemTrait ( Generics , Vec < TraitRef > , Vec < TraitMethod > ) ,
1155
1155
ItemImpl ( Generics ,
1156
1156
Option < TraitRef > , // (optional) trait this impl implements
1157
1157
P < Ty > , // self
1158
- ~ [ @Method ] ) ,
1158
+ Vec < @Method > ) ,
1159
1159
// a macro invocation (which includes macro definition)
1160
1160
ItemMac ( Mac ) ,
1161
1161
}
1162
1162
1163
1163
#[ deriving( Eq , Encodable , Decodable , Hash ) ]
1164
1164
pub struct ForeignItem {
1165
1165
ident : Ident ,
1166
- attrs : ~ [ Attribute ] ,
1166
+ attrs : Vec < Attribute > ,
1167
1167
node : ForeignItem_ ,
1168
1168
id : NodeId ,
1169
1169
span : Span ,
@@ -1205,9 +1205,9 @@ mod test {
1205
1205
#[ test]
1206
1206
fn check_asts_encodable ( ) {
1207
1207
let e = Crate {
1208
- module : Mod { view_items : ~ [ ] , items : ~ [ ] } ,
1209
- attrs : ~ [ ] ,
1210
- config : ~ [ ] ,
1208
+ module : Mod { view_items : Vec :: new ( ) , items : Vec :: new ( ) } ,
1209
+ attrs : Vec :: new ( ) ,
1210
+ config : Vec :: new ( ) ,
1211
1211
span : Span {
1212
1212
lo : BytePos ( 10 ) ,
1213
1213
hi : BytePos ( 20 ) ,
0 commit comments