diff options
| author | bors <bors@rust-lang.org> | 2013-12-01 05:42:06 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-12-01 05:42:06 -0800 |
| commit | df41115213e851b9f23dfea3d6782dea5243a5d4 (patch) | |
| tree | ea05c3021e5c6b2e5440bcea47c90f7a91b0e847 | |
| parent | 83084e9c7793d24008b88b93d698639d0e85164a (diff) | |
| parent | 47ce9819033d235715474f8ea0420a5610855f7f (diff) | |
| download | rust-df41115213e851b9f23dfea3d6782dea5243a5d4.tar.gz rust-df41115213e851b9f23dfea3d6782dea5243a5d4.zip | |
auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton
| -rw-r--r-- | src/librustc/metadata/encoder.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/lint.rs | 2 | ||||
| -rw-r--r-- | src/librustc/middle/resolve.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/trans/base.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/ty.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/collect.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/doctree.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/visit_ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 4 |
13 files changed, 31 insertions, 31 deletions
diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index b517d890c59..e4e504e58d9 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<i64>]) -> ~[entry<i64>] { /* Each class has its own index, since different classes diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index ad753227c20..b01ea851a1e 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 74e7a2d9219..d8fcdac2b1e 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -3873,9 +3873,9 @@ impl Resolver { fn resolve_struct(&mut self, id: NodeId, generics: &Generics, - fields: &[@struct_field]) { - let mut ident_map: HashMap<ast::Ident,@struct_field> = HashMap::new(); - for &field in fields.iter() { + fields: &[struct_field]) { + let mut ident_map: HashMap<ast::Ident, &struct_field> = 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 1dba8169da8..f992411a548 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(&self) -> ast::P<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(&self) -> ast::P<ast::Ty> { self.node.ty } } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index a557332c8de..f8d5506bd07 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 bb0e1d42ac6..967da143810 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 93d1db447e7..399e73b008f 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 1a4a9a0aee8..15dbc68b2ea 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 aebb5303cd4..52613ba01a1 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1105,7 +1105,7 @@ impl visibility { } } -#[deriving(Eq, Encodable, Decodable,IterBytes)] +#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)] pub struct struct_field_ { kind: struct_field_kind, id: NodeId, @@ -1115,7 +1115,7 @@ pub struct struct_field_ { pub type struct_field = Spanned<struct_field_>; -#[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 @@ -1123,7 +1123,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<NodeId> diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 094ad7afea6..11a55a4adbc 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -565,7 +565,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 945d22a0f5a..4f5b0f69a24 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<T:ast_fold>(generics: &Generics, fld: &T) -> Generics { fn fold_struct_def<T:ast_fold>(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<T:ast_fold>(p: &trait_ref, fld: &T) -> trait_ref { } } -fn fold_struct_field<T:ast_fold>(f: @struct_field, fld: &T) -> @struct_field { - @Spanned { +fn fold_struct_field<T:ast_fold>(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 5807098c91e..5bf8c60cdc8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3178,7 +3178,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"); @@ -3186,7 +3186,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, @@ -4022,7 +4022,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) { @@ -4053,7 +4053,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) { @@ -4091,7 +4091,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 => { @@ -4108,7 +4108,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(); @@ -4470,7 +4470,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 e5a06c46d06..f19a99ffcee 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -92,7 +92,7 @@ pub trait Visitor<E:Clone> { 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<E:Clone, V:Visitor<E>>(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()) } } |
