Skip to content

Commit df41115

Browse files
committed
auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton
2 parents 83084e9 + 47ce981 commit df41115

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
@@ -3873,9 +3873,9 @@ impl Resolver {
38733873
fn resolve_struct(&mut self,
38743874
id: NodeId,
38753875
generics: &Generics,
3876-
fields: &[@struct_field]) {
3877-
let mut ident_map: HashMap<ast::Ident,@struct_field> = HashMap::new();
3878-
for &field in fields.iter() {
3876+
fields: &[struct_field]) {
3877+
let mut ident_map: HashMap<ast::Ident, &struct_field> = HashMap::new();
3878+
for field in fields.iter() {
38793879
match field.node.kind {
38803880
named_field(ident, _) => {
38813881
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(&self) -> ast::P<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(&self) -> ast::P<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
@@ -1105,7 +1105,7 @@ impl visibility {
11051105
}
11061106
}
11071107

1108-
#[deriving(Eq, Encodable, Decodable,IterBytes)]
1108+
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
11091109
pub struct struct_field_ {
11101110
kind: struct_field_kind,
11111111
id: NodeId,
@@ -1115,15 +1115,15 @@ pub struct struct_field_ {
11151115

11161116
pub type struct_field = Spanned<struct_field_>;
11171117

1118-
#[deriving(Eq, Encodable, Decodable,IterBytes)]
1118+
#[deriving(Clone, Eq, Encodable, Decodable,IterBytes)]
11191119
pub enum struct_field_kind {
11201120
named_field(Ident, visibility),
11211121
unnamed_field // element of a tuple-like struct
11221122
}
11231123

11241124
#[deriving(Eq, Encodable, Decodable,IterBytes)]
11251125
pub struct struct_def {
1126-
fields: ~[@struct_field], /* fields, not including ctor */
1126+
fields: ~[struct_field], /* fields, not including ctor */
11271127
/* ID of the constructor. This is only used for tuple- or enum-like
11281128
* structs. */
11291129
ctor_id: Option<NodeId>

src/libsyntax/ast_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ impl<'self, O: IdVisitingOperation> Visitor<()> for IdVisitor<'self, O> {
565565
}
566566
}
567567

568-
fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) {
568+
fn visit_struct_field(&mut self, struct_field: &struct_field, env: ()) {
569569
self.operation.visit_id(struct_field.node.id);
570570
visit::walk_struct_field(self, struct_field, env)
571571
}

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
@@ -3178,15 +3178,15 @@ impl Parser {
31783178
// parse a structure field
31793179
fn parse_name_and_ty(&self,
31803180
pr: visibility,
3181-
attrs: ~[Attribute]) -> @struct_field {
3181+
attrs: ~[Attribute]) -> struct_field {
31823182
let lo = self.span.lo;
31833183
if !is_plain_ident(&*self.token) {
31843184
self.fatal("expected ident");
31853185
}
31863186
let name = self.parse_ident();
31873187
self.expect(&token::COLON);
31883188
let ty = self.parse_ty(false);
3189-
@spanned(lo, self.last_span.hi, ast::struct_field_ {
3189+
spanned(lo, self.last_span.hi, ast::struct_field_ {
31903190
kind: named_field(name, pr),
31913191
id: ast::DUMMY_NODE_ID,
31923192
ty: ty,
@@ -4022,7 +4022,7 @@ impl Parser {
40224022
let class_name = self.parse_ident();
40234023
let generics = self.parse_generics();
40244024

4025-
let mut fields: ~[@struct_field];
4025+
let mut fields: ~[struct_field];
40264026
let is_tuple_like;
40274027

40284028
if self.eat(&token::LBRACE) {
@@ -4053,7 +4053,7 @@ impl Parser {
40534053
ty: p.parse_ty(false),
40544054
attrs: attrs,
40554055
};
4056-
@spanned(lo, p.span.hi, struct_field_)
4056+
spanned(lo, p.span.hi, struct_field_)
40574057
});
40584058
self.expect(&token::SEMI);
40594059
} else if self.eat(&token::SEMI) {
@@ -4091,7 +4091,7 @@ impl Parser {
40914091
pub fn parse_single_struct_field(&self,
40924092
vis: visibility,
40934093
attrs: ~[Attribute])
4094-
-> @struct_field {
4094+
-> struct_field {
40954095
let a_var = self.parse_name_and_ty(vis, attrs);
40964096
match *self.token {
40974097
token::COMMA => {
@@ -4108,7 +4108,7 @@ impl Parser {
41084108
}
41094109

41104110
// parse an element of a struct definition
4111-
fn parse_struct_decl_field(&self) -> @struct_field {
4111+
fn parse_struct_decl_field(&self) -> struct_field {
41124112

41134113
let attrs = self.parse_outer_attributes();
41144114

@@ -4470,7 +4470,7 @@ impl Parser {
44704470
// parse a structure-like enum variant definition
44714471
// this should probably be renamed or refactored...
44724472
fn parse_struct_def(&self) -> @struct_def {
4473-
let mut fields: ~[@struct_field] = ~[];
4473+
let mut fields: ~[struct_field] = ~[];
44744474
while *self.token != token::RBRACE {
44754475
fields.push(self.parse_struct_decl_field());
44764476
}

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)