diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 269054c6fd21f..f9f7ff24dd754 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -730,7 +730,7 @@ fn encode_provided_source(ebml_w: &mut writer::Encoder, fn encode_info_for_struct(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, path: &[ast_map::path_elt], - fields: &[@struct_field], + fields: &[struct_field], global_index: @mut ~[entry]) -> ~[entry] { /* Each class has its own index, since different classes diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 1b2ae78c627bc..7eb41a3a6ee2d 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1310,7 +1310,7 @@ impl<'self> Visitor<()> for Context<'self> { self.cur_struct_def_id = old_id; } - fn visit_struct_field(&mut self, s: @ast::struct_field, _: ()) { + fn visit_struct_field(&mut self, s: &ast::struct_field, _: ()) { self.with_lint_attrs(s.node.attrs, |cx| { check_missing_doc_struct_field(cx, s); check_attrs_usage(cx, s.node.attrs); diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 0d4c23d3dfb0d..97d5541ea1850 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -3876,9 +3876,9 @@ impl Resolver { fn resolve_struct(&mut self, id: NodeId, generics: &Generics, - fields: &[@struct_field]) { - let mut ident_map: HashMap = HashMap::new(); - for &field in fields.iter() { + fields: &[struct_field]) { + let mut ident_map: HashMap = HashMap::new(); + for field in fields.iter() { match field.node.kind { named_field(ident, _) => { match ident_map.find(&ident) { diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index deb4f00d7a02f..09e1f9b497b11 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -2037,7 +2037,7 @@ pub fn trans_enum_variant(ccx: @mut CrateContext, } pub fn trans_tuple_struct(ccx: @mut CrateContext, - fields: &[@ast::struct_field], + fields: &[ast::struct_field], ctor_id: ast::NodeId, param_substs: Option<@param_substs>, llfndecl: ValueRef) { @@ -2062,7 +2062,7 @@ impl IdAndTy for ast::variant_arg { fn ty<'a>(&'a self) -> &'a ast::Ty { &self.ty } } -impl IdAndTy for @ast::struct_field { +impl IdAndTy for ast::struct_field { fn id(&self) -> ast::NodeId { self.node.id } fn ty<'a>(&'a self) -> &'a ast::Ty { &self.node.ty } } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index cabe65b097bb6..52f6192c2b3f1 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -3693,7 +3693,7 @@ impl VariantInfo { }, ast::struct_variant_kind(ref struct_def) => { - let fields: &[@struct_field] = struct_def.fields; + let fields: &[struct_field] = struct_def.fields; assert!(fields.len() > 0); @@ -4082,7 +4082,7 @@ pub fn lookup_struct_field(cx: ctxt, } } -fn struct_field_tys(fields: &[@struct_field]) -> ~[field_ty] { +fn struct_field_tys(fields: &[struct_field]) -> ~[field_ty] { fields.map(|field| { match field.node.kind { named_field(ident, visibility) => { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 11cbcd4cbdda2..3de9eca6fe28d 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -620,7 +620,7 @@ pub fn convert_struct(ccx: &CrateCtxt, // Write the type of each of the members for f in struct_def.fields.iter() { - convert_field(ccx, &tpt.generics, *f); + convert_field(ccx, &tpt.generics, f); } let substs = mk_item_substs(ccx, &tpt.generics, None); let selfty = ty::mk_struct(tcx, local_def(id), substs); diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 835781907f3d1..60623d1842970 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -80,7 +80,7 @@ pub struct Struct { name: Ident, generics: ast::Generics, attrs: ~[ast::Attribute], - fields: ~[@ast::struct_field], + fields: ~[ast::struct_field], where: Span, } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 79ab752f295a8..737ce22180065 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -46,7 +46,7 @@ impl RustdocVisitor { vis: item.vis, attrs: item.attrs.clone(), generics: generics.clone(), - fields: sd.fields.iter().map(|x| (*x).clone()).to_owned_vec(), + fields: sd.fields.clone(), where: item.span } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 7bde8083b50f3..8f2bb3affa768 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1098,7 +1098,7 @@ impl visibility { } } -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] pub struct struct_field_ { kind: struct_field_kind, id: NodeId, @@ -1108,7 +1108,7 @@ pub struct struct_field_ { pub type struct_field = Spanned; -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] pub enum struct_field_kind { named_field(Ident, visibility), unnamed_field // element of a tuple-like struct @@ -1116,7 +1116,7 @@ pub enum struct_field_kind { #[deriving(Eq, Encodable, Decodable,IterBytes)] pub struct struct_def { - fields: ~[@struct_field], /* fields, not including ctor */ + fields: ~[struct_field], /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like * structs. */ ctor_id: Option diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index dcb15ad85df53..d667479bca91a 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -576,7 +576,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> { } } - fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) { + fn visit_struct_field(&mut self, struct_field: &struct_field, env: ()) { self.operation.visit_id(struct_field.node.id); visit::walk_struct_field(self, struct_field, env) } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 887d3d2014ab0..35343771e8696 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -118,10 +118,10 @@ pub trait ast_fold { noop_fold_item(i, self) } - fn fold_struct_field(&self, sf: @struct_field) -> @struct_field { + fn fold_struct_field(&self, sf: &struct_field) -> struct_field { let fold_attribute = |x| fold_attribute_(x, self); - @Spanned { + Spanned { node: ast::struct_field_ { kind: sf.node.kind, id: self.new_id(sf.node.id), @@ -312,7 +312,7 @@ pub trait ast_fold { struct_variant_kind(ref struct_def) => { kind = struct_variant_kind(@ast::struct_def { fields: struct_def.fields.iter() - .map(|f| self.fold_struct_field(*f)).collect(), + .map(|f| self.fold_struct_field(f)).collect(), ctor_id: struct_def.ctor_id.map(|c| self.new_id(c)) }) } @@ -536,7 +536,7 @@ pub fn fold_generics(generics: &Generics, fld: &T) -> Generics { fn fold_struct_def(struct_def: @ast::struct_def, fld: &T) -> @ast::struct_def { @ast::struct_def { - fields: struct_def.fields.map(|f| fold_struct_field(*f, fld)), + fields: struct_def.fields.map(|f| fold_struct_field(f, fld)), ctor_id: struct_def.ctor_id.map(|cid| fld.new_id(cid)), } } @@ -562,8 +562,8 @@ fn fold_trait_ref(p: &trait_ref, fld: &T) -> trait_ref { } } -fn fold_struct_field(f: @struct_field, fld: &T) -> @struct_field { - @Spanned { +fn fold_struct_field(f: &struct_field, fld: &T) -> struct_field { + Spanned { node: ast::struct_field_ { kind: f.node.kind, id: fld.new_id(f.node.id), diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8263906d92526..dba47386bba1c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3162,7 +3162,7 @@ impl Parser { // parse a structure field fn parse_name_and_ty(&self, pr: visibility, - attrs: ~[Attribute]) -> @struct_field { + attrs: ~[Attribute]) -> struct_field { let lo = self.span.lo; if !is_plain_ident(&*self.token) { self.fatal("expected ident"); @@ -3170,7 +3170,7 @@ impl Parser { let name = self.parse_ident(); self.expect(&token::COLON); let ty = self.parse_ty(false); - @spanned(lo, self.last_span.hi, ast::struct_field_ { + spanned(lo, self.last_span.hi, ast::struct_field_ { kind: named_field(name, pr), id: ast::DUMMY_NODE_ID, ty: ty, @@ -4006,7 +4006,7 @@ impl Parser { let class_name = self.parse_ident(); let generics = self.parse_generics(); - let mut fields: ~[@struct_field]; + let mut fields: ~[struct_field]; let is_tuple_like; if self.eat(&token::LBRACE) { @@ -4037,7 +4037,7 @@ impl Parser { ty: p.parse_ty(false), attrs: attrs, }; - @spanned(lo, p.span.hi, struct_field_) + spanned(lo, p.span.hi, struct_field_) }); self.expect(&token::SEMI); } else if self.eat(&token::SEMI) { @@ -4075,7 +4075,7 @@ impl Parser { pub fn parse_single_struct_field(&self, vis: visibility, attrs: ~[Attribute]) - -> @struct_field { + -> struct_field { let a_var = self.parse_name_and_ty(vis, attrs); match *self.token { token::COMMA => { @@ -4092,7 +4092,7 @@ impl Parser { } // parse an element of a struct definition - fn parse_struct_decl_field(&self) -> @struct_field { + fn parse_struct_decl_field(&self) -> struct_field { let attrs = self.parse_outer_attributes(); @@ -4454,7 +4454,7 @@ impl Parser { // parse a structure-like enum variant definition // this should probably be renamed or refactored... fn parse_struct_def(&self) -> @struct_def { - let mut fields: ~[@struct_field] = ~[]; + let mut fields: ~[struct_field] = ~[]; while *self.token != token::RBRACE { fields.push(self.parse_struct_decl_field()); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 4100104dd61e1..1950400705168 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -92,7 +92,7 @@ pub trait Visitor { fn visit_struct_def(&mut self, s:@struct_def, i:Ident, g:&Generics, n:NodeId, e:E) { walk_struct_def(self, s, i, g, n, e) } - fn visit_struct_field(&mut self, s:@struct_field, e:E) { walk_struct_field(self, s, e) } + fn visit_struct_field(&mut self, s:&struct_field, e:E) { walk_struct_field(self, s, e) } fn visit_variant(&mut self, v:&variant, g:&Generics, e:E) { walk_variant(self, v, g, e) } fn visit_opt_lifetime_ref(&mut self, _span: Span, @@ -538,7 +538,7 @@ pub fn walk_struct_def>(visitor: &mut V, _: NodeId, env: E) { for field in struct_definition.fields.iter() { - visitor.visit_struct_field(*field, env.clone()) + visitor.visit_struct_field(field, env.clone()) } }