Skip to content

Commit 47ce981

Browse files
committed
ast: Remove one @ and fix the fallout
1 parent c470184 commit 47ce981

File tree

13 files changed

+31
-31
lines changed

13 files changed

+31
-31
lines changed

src/librustc/metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ fn encode_provided_source(ebml_w: &mut writer::Encoder,
730730
fn encode_info_for_struct(ecx: &EncodeContext,
731731
ebml_w: &mut writer::Encoder,
732732
path: &[ast_map::path_elt],
733-
fields: &[@struct_field],
733+
fields: &[struct_field],
734734
global_index: @mut ~[entry<i64>])
735735
-> ~[entry<i64>] {
736736
/* Each class has its own index, since different classes

src/librustc/middle/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ impl<'self> Visitor<()> for Context<'self> {
13101310
self.cur_struct_def_id = old_id;
13111311
}
13121312

1313-
fn visit_struct_field(&mut self, s: @ast::struct_field, _: ()) {
1313+
fn visit_struct_field(&mut self, s: &ast::struct_field, _: ()) {
13141314
self.with_lint_attrs(s.node.attrs, |cx| {
13151315
check_missing_doc_struct_field(cx, s);
13161316
check_attrs_usage(cx, s.node.attrs);

src/librustc/middle/resolve.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3876,9 +3876,9 @@ impl Resolver {
38763876
fn resolve_struct(&mut self,
38773877
id: NodeId,
38783878
generics: &Generics,
3879-
fields: &[@struct_field]) {
3880-
let mut ident_map: HashMap<ast::Ident,@struct_field> = HashMap::new();
3881-
for &field in fields.iter() {
3879+
fields: &[struct_field]) {
3880+
let mut ident_map: HashMap<ast::Ident, &struct_field> = HashMap::new();
3881+
for field in fields.iter() {
38823882
match field.node.kind {
38833883
named_field(ident, _) => {
38843884
match ident_map.find(&ident) {

src/librustc/middle/trans/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,7 @@ pub fn trans_enum_variant(ccx: @mut CrateContext,
20372037
}
20382038

20392039
pub fn trans_tuple_struct(ccx: @mut CrateContext,
2040-
fields: &[@ast::struct_field],
2040+
fields: &[ast::struct_field],
20412041
ctor_id: ast::NodeId,
20422042
param_substs: Option<@param_substs>,
20432043
llfndecl: ValueRef) {
@@ -2062,7 +2062,7 @@ impl IdAndTy for ast::variant_arg {
20622062
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.ty }
20632063
}
20642064

2065-
impl IdAndTy for @ast::struct_field {
2065+
impl IdAndTy for ast::struct_field {
20662066
fn id(&self) -> ast::NodeId { self.node.id }
20672067
fn ty<'a>(&'a self) -> &'a ast::Ty { &self.node.ty }
20682068
}

src/librustc/middle/ty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3693,7 +3693,7 @@ impl VariantInfo {
36933693
},
36943694
ast::struct_variant_kind(ref struct_def) => {
36953695

3696-
let fields: &[@struct_field] = struct_def.fields;
3696+
let fields: &[struct_field] = struct_def.fields;
36973697

36983698
assert!(fields.len() > 0);
36993699

@@ -4082,7 +4082,7 @@ pub fn lookup_struct_field(cx: ctxt,
40824082
}
40834083
}
40844084

4085-
fn struct_field_tys(fields: &[@struct_field]) -> ~[field_ty] {
4085+
fn struct_field_tys(fields: &[struct_field]) -> ~[field_ty] {
40864086
fields.map(|field| {
40874087
match field.node.kind {
40884088
named_field(ident, visibility) => {

src/librustc/middle/typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ pub fn convert_struct(ccx: &CrateCtxt,
620620

621621
// Write the type of each of the members
622622
for f in struct_def.fields.iter() {
623-
convert_field(ccx, &tpt.generics, *f);
623+
convert_field(ccx, &tpt.generics, f);
624624
}
625625
let substs = mk_item_substs(ccx, &tpt.generics, None);
626626
let selfty = ty::mk_struct(tcx, local_def(id), substs);

src/librustdoc/doctree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub struct Struct {
8080
name: Ident,
8181
generics: ast::Generics,
8282
attrs: ~[ast::Attribute],
83-
fields: ~[@ast::struct_field],
83+
fields: ~[ast::struct_field],
8484
where: Span,
8585
}
8686

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl RustdocVisitor {
4646
vis: item.vis,
4747
attrs: item.attrs.clone(),
4848
generics: generics.clone(),
49-
fields: sd.fields.iter().map(|x| (*x).clone()).to_owned_vec(),
49+
fields: sd.fields.clone(),
5050
where: item.span
5151
}
5252
}

src/libsyntax/ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ impl visibility {
10981098
}
10991099
}
11001100

1101-
#[deriving(Eq, Encodable, Decodable,IterBytes)]
1101+
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
11021102
pub struct struct_field_ {
11031103
kind: struct_field_kind,
11041104
id: NodeId,
@@ -1108,15 +1108,15 @@ pub struct struct_field_ {
11081108

11091109
pub type struct_field = Spanned<struct_field_>;
11101110

1111-
#[deriving(Eq, Encodable, Decodable,IterBytes)]
1111+
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
11121112
pub enum struct_field_kind {
11131113
named_field(Ident, visibility),
11141114
unnamed_field // element of a tuple-like struct
11151115
}
11161116

11171117
#[deriving(Eq, Encodable, Decodable,IterBytes)]
11181118
pub struct struct_def {
1119-
fields: ~[@struct_field], /* fields, not including ctor */
1119+
fields: ~[struct_field], /* fields, not including ctor */
11201120
/* ID of the constructor. This is only used for tuple- or enum-like
11211121
* structs. */
11221122
ctor_id: Option<NodeId>

src/libsyntax/ast_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> {
576576
}
577577
}
578578

579-
fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) {
579+
fn visit_struct_field(&mut self, struct_field: &struct_field, env: ()) {
580580
self.operation.visit_id(struct_field.node.id);
581581
visit::walk_struct_field(self, struct_field, env)
582582
}

src/libsyntax/fold.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ pub trait ast_fold {
118118
noop_fold_item(i, self)
119119
}
120120

121-
fn fold_struct_field(&self, sf: @struct_field) -> @struct_field {
121+
fn fold_struct_field(&self, sf: &struct_field) -> struct_field {
122122
let fold_attribute = |x| fold_attribute_(x, self);
123123

124-
@Spanned {
124+
Spanned {
125125
node: ast::struct_field_ {
126126
kind: sf.node.kind,
127127
id: self.new_id(sf.node.id),
@@ -312,7 +312,7 @@ pub trait ast_fold {
312312
struct_variant_kind(ref struct_def) => {
313313
kind = struct_variant_kind(@ast::struct_def {
314314
fields: struct_def.fields.iter()
315-
.map(|f| self.fold_struct_field(*f)).collect(),
315+
.map(|f| self.fold_struct_field(f)).collect(),
316316
ctor_id: struct_def.ctor_id.map(|c| self.new_id(c))
317317
})
318318
}
@@ -536,7 +536,7 @@ pub fn fold_generics<T:ast_fold>(generics: &Generics, fld: &T) -> Generics {
536536
fn fold_struct_def<T:ast_fold>(struct_def: @ast::struct_def, fld: &T)
537537
-> @ast::struct_def {
538538
@ast::struct_def {
539-
fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)),
539+
fields: struct_def.fields.map(|f| fold_struct_field(f, fld)),
540540
ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(cid)),
541541
}
542542
}
@@ -562,8 +562,8 @@ fn fold_trait_ref<T:ast_fold>(p: &trait_ref, fld: &T) -> trait_ref {
562562
}
563563
}
564564

565-
fn fold_struct_field<T:ast_fold>(f: @struct_field, fld: &T) -> @struct_field {
566-
@Spanned {
565+
fn fold_struct_field<T:ast_fold>(f: &struct_field, fld: &T) -> struct_field {
566+
Spanned {
567567
node: ast::struct_field_ {
568568
kind: f.node.kind,
569569
id: fld.new_id(f.node.id),

src/libsyntax/parse/parser.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -3162,15 +3162,15 @@ impl Parser {
31623162
// parse a structure field
31633163
fn parse_name_and_ty(&self,
31643164
pr: visibility,
3165-
attrs: ~[Attribute]) -> @struct_field {
3165+
attrs: ~[Attribute]) -> struct_field {
31663166
let lo = self.span.lo;
31673167
if !is_plain_ident(&*self.token) {
31683168
self.fatal("expected ident");
31693169
}
31703170
let name = self.parse_ident();
31713171
self.expect(&token::COLON);
31723172
let ty = self.parse_ty(false);
3173-
@spanned(lo, self.last_span.hi, ast::struct_field_ {
3173+
spanned(lo, self.last_span.hi, ast::struct_field_ {
31743174
kind: named_field(name, pr),
31753175
id: ast::DUMMY_NODE_ID,
31763176
ty: ty,
@@ -4006,7 +4006,7 @@ impl Parser {
40064006
let class_name = self.parse_ident();
40074007
let generics = self.parse_generics();
40084008

4009-
let mut fields: ~[@struct_field];
4009+
let mut fields: ~[struct_field];
40104010
let is_tuple_like;
40114011

40124012
if self.eat(&token::LBRACE) {
@@ -4037,7 +4037,7 @@ impl Parser {
40374037
ty: p.parse_ty(false),
40384038
attrs: attrs,
40394039
};
4040-
@spanned(lo, p.span.hi, struct_field_)
4040+
spanned(lo, p.span.hi, struct_field_)
40414041
});
40424042
self.expect(&token::SEMI);
40434043
} else if self.eat(&token::SEMI) {
@@ -4075,7 +4075,7 @@ impl Parser {
40754075
pub fn parse_single_struct_field(&self,
40764076
vis: visibility,
40774077
attrs: ~[Attribute])
4078-
-> @struct_field {
4078+
-> struct_field {
40794079
let a_var = self.parse_name_and_ty(vis, attrs);
40804080
match *self.token {
40814081
token::COMMA => {
@@ -4092,7 +4092,7 @@ impl Parser {
40924092
}
40934093

40944094
// parse an element of a struct definition
4095-
fn parse_struct_decl_field(&self) -> @struct_field {
4095+
fn parse_struct_decl_field(&self) -> struct_field {
40964096

40974097
let attrs = self.parse_outer_attributes();
40984098

@@ -4454,7 +4454,7 @@ impl Parser {
44544454
// parse a structure-like enum variant definition
44554455
// this should probably be renamed or refactored...
44564456
fn parse_struct_def(&self) -> @struct_def {
4457-
let mut fields: ~[@struct_field] = ~[];
4457+
let mut fields: ~[struct_field] = ~[];
44584458
while *self.token != token::RBRACE {
44594459
fields.push(self.parse_struct_decl_field());
44604460
}

src/libsyntax/visit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub trait Visitor<E:Clone> {
9292
fn visit_struct_def(&mut self, s:@struct_def, i:Ident, g:&Generics, n:NodeId, e:E) {
9393
walk_struct_def(self, s, i, g, n, e)
9494
}
95-
fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) }
95+
fn visit_struct_field(&mut self, s:&struct_field, e:E) { walk_struct_field(self, s, e) }
9696
fn visit_variant(&mut self, v:&variant, g:&Generics, e:E) { walk_variant(self, v, g, e) }
9797
fn visit_opt_lifetime_ref(&mut self,
9898
_span: Span,
@@ -538,7 +538,7 @@ pub fn walk_struct_def<E:Clone, V:Visitor<E>>(visitor: &mut V,
538538
_: NodeId,
539539
env: E) {
540540
for field in struct_definition.fields.iter() {
541-
visitor.visit_struct_field(*field, env.clone())
541+
visitor.visit_struct_field(field, env.clone())
542542
}
543543
}
544544

0 commit comments

Comments
 (0)