Skip to content

Commit 6aeb185

Browse files
committed
---
yaml --- r: 47597 b: refs/heads/incoming c: e58c812 h: refs/heads/master i: 47595: 7129700 v: v3
1 parent 61de106 commit 6aeb185

File tree

15 files changed

+43
-145
lines changed

15 files changed

+43
-145
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 2a8fb58d79e685d5ca07b039badcf2ae3ef077ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: e07623d70b5f1841a3e958195a0f8df4606d264c
9+
refs/heads/incoming: e58c812f7761228281aaf3140e53cc2e9945760a
1010
refs/heads/dist-snap: 8b98e5a296d95c5e832db0756828e5bec31c6f50
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/librustc/metadata/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,5 @@ pub const tag_lang_items_item: uint = 0x73;
153153
pub const tag_lang_items_item_id: uint = 0x74;
154154
pub const tag_lang_items_item_node_id: uint = 0x75;
155155

156-
pub const tag_item_unnamed_field: uint = 0x76;
157-
pub const tag_items_data_item_struct_ctor: uint = 0x77;
158-
159156
pub type link_meta = {name: @str, vers: @str, extras_hash: @str};
160157

branches/incoming/src/librustc/metadata/csearch.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ pub fn get_item_attrs(cstore: @mut cstore::CStore,
166166
decoder::get_item_attrs(cdata, def_id.node, f)
167167
}
168168

169-
pub fn get_struct_fields(cstore: @mut cstore::CStore,
170-
def: ast::def_id)
171-
-> ~[ty::field_ty] {
169+
pub fn get_struct_fields(tcx: ty::ctxt, def: ast::def_id) -> ~[ty::field_ty] {
170+
let cstore = tcx.cstore;
172171
let cdata = cstore::get_crate_data(cstore, def.crate);
173172
decoder::get_struct_fields(cstore.intr, cdata, def.node)
174173
}

branches/incoming/src/librustc/metadata/decoder.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use std::serialize::Decodable;
4242
use syntax::ast_map;
4343
use syntax::attr;
4444
use syntax::diagnostic::span_handler;
45-
use syntax::parse::token::{ident_interner, special_idents};
45+
use syntax::parse::token::ident_interner;
4646
use syntax::print::pprust;
4747
use syntax::{ast, ast_util};
4848
use syntax::codemap;
@@ -231,9 +231,7 @@ pub fn item_type(item_id: ast::def_id, item: ebml::Doc,
231231
let t = doc_type(item, tcx, cdata);
232232
if family_names_type(item_family(item)) {
233233
ty::mk_with_id(tcx, t, item_id)
234-
} else {
235-
t
236-
}
234+
} else { t }
237235
}
238236

239237
fn item_impl_traits(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ~[ty::t] {
@@ -663,12 +661,11 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
663661
rslt
664662
}
665663

666-
pub fn get_impls_for_mod(intr: @ident_interner,
667-
cdata: cmd,
668-
m_id: ast::node_id,
669-
name: Option<ast::ident>,
670-
get_cdata: &fn(ast::crate_num) -> cmd)
664+
pub fn get_impls_for_mod(intr: @ident_interner, cdata: cmd,
665+
m_id: ast::node_id, name: Option<ast::ident>,
666+
get_cdata: fn(ast::crate_num) -> cmd)
671667
-> @~[@_impl] {
668+
672669
let data = cdata.data;
673670
let mod_item = lookup_item(m_id, data);
674671
let mut result = ~[];
@@ -890,15 +887,6 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::node_id)
890887
});
891888
}
892889
}
893-
for reader::tagged_docs(item, tag_item_unnamed_field) |an_item| {
894-
let did = item_def_id(an_item, cdata);
895-
result.push(ty::field_ty {
896-
ident: special_idents::unnamed_field,
897-
id: did,
898-
vis: ast::inherited,
899-
mutability: ast::struct_immutable,
900-
});
901-
}
902890
result
903891
}
904892

branches/incoming/src/librustc/metadata/encoder.rs

Lines changed: 21 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ use syntax::ast_map;
4646
use syntax::ast_util::*;
4747
use syntax::attr;
4848
use syntax::diagnostic::span_handler;
49-
use syntax::parse::token::special_idents;
5049
use syntax::print::pprust;
5150
use syntax::{ast_util, visit};
5251
use syntax;
@@ -329,7 +328,7 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: writer::Encoder,
329328
// Encode info about all the module children.
330329
for md.items.each |item| {
331330
match item.node {
332-
item_impl(*) => {
331+
item_impl(*) | item_struct(*) => {
333332
let (ident, did) = (item.ident, item.id);
334333
debug!("(encoding info for module) ... encoding impl %s \
335334
(%?/%?)",
@@ -433,28 +432,25 @@ fn encode_info_for_struct(ecx: @encode_ctxt, ebml_w: writer::Encoder,
433432
/* We encode both private and public fields -- need to include
434433
private fields to get the offsets right */
435434
for fields.each |field| {
436-
let (nm, mt, vis) = match field.node.kind {
437-
named_field(nm, mt, vis) => (nm, mt, vis),
438-
unnamed_field => (
439-
special_idents::unnamed_field,
440-
struct_immutable,
441-
inherited
442-
)
443-
};
444-
445-
let id = field.node.id;
446-
index.push({val: id, pos: ebml_w.writer.tell()});
447-
global_index.push({val: id, pos: ebml_w.writer.tell()});
448-
ebml_w.start_tag(tag_items_data_item);
449-
debug!("encode_info_for_struct: doing %s %d",
450-
tcx.sess.str_of(nm), id);
451-
encode_visibility(ebml_w, vis);
452-
encode_name(ecx, ebml_w, nm);
453-
encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
454-
encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
455-
encode_mutability(ebml_w, mt);
456-
encode_def_id(ebml_w, local_def(id));
457-
ebml_w.end_tag();
435+
match field.node.kind {
436+
named_field(nm, mt, vis) => {
437+
let id = field.node.id;
438+
index.push({val: id, pos: ebml_w.writer.tell()});
439+
global_index.push({val: id,
440+
pos: ebml_w.writer.tell()});
441+
ebml_w.start_tag(tag_items_data_item);
442+
debug!("encode_info_for_struct: doing %s %d",
443+
tcx.sess.str_of(nm), id);
444+
encode_visibility(ebml_w, vis);
445+
encode_name(ecx, ebml_w, nm);
446+
encode_path(ecx, ebml_w, path, ast_map::path_name(nm));
447+
encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
448+
encode_mutability(ebml_w, mt);
449+
encode_def_id(ebml_w, local_def(id));
450+
ebml_w.end_tag();
451+
}
452+
unnamed_field => {}
453+
}
458454
}
459455
/*bad*/copy *index
460456
}
@@ -485,28 +481,6 @@ fn encode_info_for_ctor(ecx: @encode_ctxt, ebml_w: writer::Encoder,
485481
ebml_w.end_tag();
486482
}
487483

488-
fn encode_info_for_struct_ctor(ecx: @encode_ctxt,
489-
ebml_w: writer::Encoder,
490-
path: &[ast_map::path_elt],
491-
name: ast::ident,
492-
ctor_id: node_id,
493-
index: @mut ~[entry<int>]) {
494-
index.push({ val: ctor_id, pos: ebml_w.writer.tell() });
495-
496-
ebml_w.start_tag(tag_items_data_item);
497-
encode_def_id(ebml_w, local_def(ctor_id));
498-
encode_family(ebml_w, 'f');
499-
encode_name(ecx, ebml_w, name);
500-
encode_type(ecx, ebml_w, node_id_to_type(ecx.tcx, ctor_id));
501-
encode_path(ecx, ebml_w, path, ast_map::path_name(name));
502-
503-
if ecx.item_symbols.contains_key(&ctor_id) {
504-
encode_symbol(ecx, ebml_w, ctor_id);
505-
}
506-
507-
ebml_w.end_tag();
508-
}
509-
510484
fn encode_info_for_method(ecx: @encode_ctxt,
511485
ebml_w: writer::Encoder,
512486
impl_path: &[ast_map::path_elt],
@@ -700,24 +674,6 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Encoder,
700674
encode_family(ebml_w, 'S');
701675
encode_type_param_bounds(ebml_w, ecx, tps);
702676
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
703-
704-
// If this is a tuple- or enum-like struct, encode the type of the
705-
// constructor.
706-
if struct_def.fields.len() > 0 &&
707-
struct_def.fields[0].node.kind == ast::unnamed_field {
708-
let ctor_id = match struct_def.ctor_id {
709-
Some(ctor_id) => ctor_id,
710-
None => ecx.tcx.sess.bug(~"struct def didn't have ctor id"),
711-
};
712-
713-
encode_info_for_struct_ctor(ecx,
714-
ebml_w,
715-
path,
716-
item.ident,
717-
ctor_id,
718-
index);
719-
}
720-
721677
encode_name(ecx, ebml_w, item.ident);
722678
encode_path(ecx, ebml_w, path, ast_map::path_name(item.ident));
723679
encode_region_param(ecx, ebml_w, item);
@@ -741,11 +697,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: writer::Encoder,
741697
encode_def_id(ebml_w, local_def(f.node.id));
742698
ebml_w.end_tag();
743699
}
744-
unnamed_field => {
745-
ebml_w.start_tag(tag_item_unnamed_field);
746-
encode_def_id(ebml_w, local_def(f.node.id));
747-
ebml_w.end_tag();
748-
}
700+
unnamed_field => {}
749701
}
750702
}
751703

branches/incoming/src/librustc/middle/resolve.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use core::prelude::*;
1313
use driver::session;
1414
use driver::session::Session;
1515
use metadata::csearch::{each_path, get_method_names_if_trait};
16-
use metadata::csearch::{get_static_methods_if_impl, get_struct_fields};
17-
use metadata::csearch::{get_type_name_if_impl};
16+
use metadata::csearch::{get_static_methods_if_impl, get_type_name_if_impl};
1817
use metadata::cstore::find_use_stmt_cnum;
1918
use metadata::decoder::{def_like, dl_def, dl_field, dl_impl};
2019
use middle::lang_items::LanguageItems;
@@ -1746,12 +1745,10 @@ pub impl Resolver {
17461745
OverwriteDuplicates,
17471746
dummy_sp());
17481747

1749-
self.handle_external_def(def,
1750-
modules,
1748+
self.handle_external_def(def, modules,
17511749
child_name_bindings,
17521750
self.session.str_of(final_ident),
1753-
final_ident,
1754-
new_parent);
1751+
final_ident, new_parent);
17551752
}
17561753
dl_impl(def) => {
17571754
// We only process static methods of impls here.

branches/incoming/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,13 +1905,8 @@ pub fn trans_tuple_struct(ccx: @crate_ctxt,
19051905
}
19061906
};
19071907
1908-
let fcx = new_fn_ctxt_w_id(ccx,
1909-
~[],
1910-
llfndecl,
1911-
ctor_id,
1912-
None,
1913-
param_substs,
1914-
None);
1908+
let fcx = new_fn_ctxt_w_id(ccx, ~[], llfndecl, ctor_id, None,
1909+
param_substs, None);
19151910
19161911
// XXX: Bad copy.
19171912
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, copy fn_args);

branches/incoming/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
127127
}
128128
}
129129
130-
fn all_mem(cls: &[mut x86_64_reg_class]) {
130+
fn all_mem(cls: &mut [x86_64_reg_class]) {
131131
for uint::range(0, cls.len()) |i| {
132132
cls[i] = memory_class;
133133
}
134134
}
135135
136-
fn unify(cls: &[mut x86_64_reg_class],
136+
fn unify(cls: &mut [x86_64_reg_class],
137137
i: uint,
138138
newv: x86_64_reg_class) {
139139
if cls[i] == newv {
@@ -159,7 +159,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
159159
}
160160
161161
fn classify_struct(tys: &[TypeRef],
162-
cls: &[mut x86_64_reg_class], i: uint,
162+
cls: &mut [x86_64_reg_class], i: uint,
163163
off: uint) {
164164
let mut field_off = off;
165165
for vec::each(tys) |ty| {
@@ -170,7 +170,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
170170
}
171171
172172
fn classify(ty: TypeRef,
173-
cls: &[mut x86_64_reg_class], ix: uint,
173+
cls: &mut [x86_64_reg_class], ix: uint,
174174
off: uint) {
175175
unsafe {
176176
let t_align = ty_align(ty);
@@ -220,7 +220,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
220220
}
221221
}
222222
223-
fn fixup(ty: TypeRef, cls: &[mut x86_64_reg_class]) {
223+
fn fixup(ty: TypeRef, cls: &mut [x86_64_reg_class]) {
224224
unsafe {
225225
let mut i = 0u;
226226
let llty = llvm::LLVMGetTypeKind(ty) as int;

branches/incoming/src/librustc/middle/trans/reachable.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,6 @@ fn traverse_public_item(cx: ctx, item: @item) {
122122
}
123123
}
124124
item_struct(struct_def, tps) => {
125-
for struct_def.ctor_id.each |&ctor_id| {
126-
cx.rmap.insert(ctor_id, ());
127-
}
128125
do option::iter(&struct_def.dtor) |dtor| {
129126
cx.rmap.insert(dtor.node.id, ());
130127
if tps.len() > 0u || attr::find_inline_attr(dtor.node.attrs)

branches/incoming/src/librustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4012,7 +4012,7 @@ pub fn lookup_struct_fields(cx: ctxt, did: ast::def_id) -> ~[field_ty] {
40124012
}
40134013
}
40144014
else {
4015-
return csearch::get_struct_fields(cx.sess.cstore, did);
4015+
return csearch::get_struct_fields(cx, did);
40164016
}
40174017
}
40184018

branches/incoming/src/librustc/middle/typeck/check/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ pub impl LookupContext {
779779
/*!
780780
*
781781
* In the event that we are invoking a method with a receiver
782-
* of a linear borrowed type like `&mut T` or `&[mut T]`,
782+
* of a linear borrowed type like `&mut T` or `&mut [T]`,
783783
* we will "reborrow" the receiver implicitly. For example, if
784784
* you have a call `r.inc()` and where `r` has type `&mut T`,
785785
* then we treat that like `(&mut *r).inc()`. This avoids

branches/incoming/src/librustc/middle/typeck/coherence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ pub impl CoherenceChecker {
828828
let implementations = get_impls_for_mod(crate_store,
829829
module_def_id,
830830
None);
831-
for implementations.each |implementation| {
831+
for (*implementations).each |implementation| {
832832
debug!("coherence: adding impl from external crate: %s",
833833
ty::item_path_str(self.crate_context.tcx,
834834
implementation.did));

branches/incoming/src/test/auxiliary/newtype_struct_xc.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

branches/incoming/src/test/run-pass/newtype-struct-xc-2.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/incoming/src/test/run-pass/newtype-struct-xc.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)