auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton

This commit is contained in:
bors 2013-12-01 05:42:06 -08:00
commit df41115213
13 changed files with 31 additions and 31 deletions

View File

@ -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

View File

@ -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);

View File

@ -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) {

View File

@ -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 }
}

View File

@ -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) => {

View File

@ -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);

View File

@ -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,
}

View File

@ -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
}
}

View File

@ -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>

View File

@ -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)
}

View File

@ -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),

View File

@ -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());
}

View File

@ -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())
}
}