Skip to content

Commit 1709cbf

Browse files
committed
---
yaml --- r: 60351 b: refs/heads/master c: 109bb7c h: refs/heads/master i: 60349: 2f68d93 60347: df05faf 60343: 9c9eede 60335: b25ae8c 60319: 71a2d74 60287: fd0036d v: v3
1 parent 10f146f commit 1709cbf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+720
-733
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 217f96339a168db3e25ba4b09c0fbc226a613b16
2+
refs/heads/master: 109bb7c78ba64462a02c6a2653243e063113dcb6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/src/libcore/hashmap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,10 @@ pub impl <T:Hash + Eq> HashSet<T> {
825825
fn consume(&mut self, f: &fn(T)) {
826826
self.map.consume(|k, _| f(k))
827827
}
828+
829+
fn contains_equiv<Q:Hash + Equiv<T>>(&self, value: &Q) -> bool {
830+
self.map.contains_key_equiv(value)
831+
}
828832
}
829833

830834
#[cfg(test)]

trunk/src/librustc/metadata/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub static tag_mod_impl_trait: uint = 0x47u;
100100
different tags.
101101
*/
102102
pub static tag_item_impl_method: uint = 0x48u;
103-
pub static tag_item_trait_method_explicit_self: uint = 0x4b;
103+
pub static tag_item_trait_method_self_ty: uint = 0x4b;
104104
pub static tag_item_trait_method_self_ty_region: uint = 0x4c;
105105

106106

trunk/src/librustc/metadata/csearch.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use syntax::ast_map;
2222
use syntax::diagnostic::expect;
2323

2424
pub struct ProvidedTraitMethodInfo {
25-
ty: ty::Method,
25+
ty: ty::method,
2626
def_id: ast::def_id
2727
}
2828

@@ -129,18 +129,17 @@ pub fn get_impls_for_mod(cstore: @mut cstore::CStore, def: ast::def_id,
129129
}
130130

131131
pub fn get_method(tcx: ty::ctxt,
132-
def: ast::def_id) -> ty::Method
132+
def: ast::def_id) -> ty::method
133133
{
134134
let cdata = cstore::get_crate_data(tcx.cstore, def.crate);
135135
decoder::get_method(tcx.cstore.intr, cdata, def.node, tcx)
136136
}
137137

138-
pub fn get_method_name_and_explicit_self(cstore: @mut cstore::CStore,
139-
def: ast::def_id)
140-
-> (ast::ident, ast::explicit_self_)
138+
pub fn get_method_name_and_self_ty(cstore: @mut cstore::CStore,
139+
def: ast::def_id) -> (ast::ident, ast::self_ty_)
141140
{
142141
let cdata = cstore::get_crate_data(cstore, def.crate);
143-
decoder::get_method_name_and_explicit_self(cstore.intr, cdata, def.node)
142+
decoder::get_method_name_and_self_ty(cstore.intr, cdata, def.node)
144143
}
145144

146145
pub fn get_trait_method_def_ids(cstore: @mut cstore::CStore,

trunk/src/librustc/metadata/decoder.rs

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
653653
item, tcx, cdata);
654654
let name = item_name(intr, item);
655655
let arg_tys = match ty::get(ctor_ty).sty {
656-
ty::ty_bare_fn(ref f) => copy f.sig.inputs,
656+
ty::ty_bare_fn(ref f) => f.sig.inputs.map(|a| a.ty),
657657
_ => ~[], // Nullary enum variant.
658658
};
659659
match variant_disr_val(item) {
@@ -670,7 +670,7 @@ pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::node_id,
670670
return infos;
671671
}
672672

673-
fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
673+
fn get_self_ty(item: ebml::Doc) -> ast::self_ty_ {
674674
fn get_mutability(ch: u8) -> ast::mutability {
675675
match ch as char {
676676
'i' => { ast::m_imm }
@@ -682,11 +682,11 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
682682
}
683683
}
684684

685-
let explicit_self_doc = reader::get_doc(item, tag_item_trait_method_explicit_self);
686-
let string = reader::doc_as_str(explicit_self_doc);
685+
let self_type_doc = reader::get_doc(item, tag_item_trait_method_self_ty);
686+
let string = reader::doc_as_str(self_type_doc);
687687

688-
let explicit_self_kind = string[0];
689-
match explicit_self_kind as char {
688+
let self_ty_kind = string[0];
689+
match self_ty_kind as char {
690690
's' => { return ast::sty_static; }
691691
'v' => { return ast::sty_value; }
692692
'@' => { return ast::sty_box(get_mutability(string[1])); }
@@ -696,7 +696,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ {
696696
return ast::sty_region(None, get_mutability(string[1]));
697697
}
698698
_ => {
699-
fail!("unknown self type code: `%c`", explicit_self_kind as char);
699+
fail!("unknown self type code: `%c`", self_ty_kind as char);
700700
}
701701
}
702702
}
@@ -707,12 +707,12 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc,
707707
for reader::tagged_docs(item, tag_item_impl_method) |doc| {
708708
let m_did = reader::with_doc_data(doc, |d| parse_def_id(d));
709709
let mth_item = lookup_item(m_did.node, cdata.data);
710-
let explicit_self = get_explicit_self(mth_item);
710+
let self_ty = get_self_ty(mth_item);
711711
rslt.push(@resolve::MethodInfo {
712712
did: translate_def_id(cdata, m_did),
713713
n_tps: item_ty_param_count(mth_item) - base_tps,
714714
ident: item_name(intr, mth_item),
715-
explicit_self: explicit_self});
715+
self_type: self_ty});
716716
}
717717
rslt
718718
}
@@ -748,19 +748,19 @@ pub fn get_impls_for_mod(intr: @ident_interner,
748748
@result
749749
}
750750

751-
pub fn get_method_name_and_explicit_self(
751+
pub fn get_method_name_and_self_ty(
752752
intr: @ident_interner,
753753
cdata: cmd,
754-
id: ast::node_id) -> (ast::ident, ast::explicit_self_)
754+
id: ast::node_id) -> (ast::ident, ast::self_ty_)
755755
{
756756
let method_doc = lookup_item(id, cdata.data);
757757
let name = item_name(intr, method_doc);
758-
let explicit_self = get_explicit_self(method_doc);
759-
(name, explicit_self)
758+
let self_ty = get_self_ty(method_doc);
759+
(name, self_ty)
760760
}
761761

762762
pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
763-
tcx: ty::ctxt) -> ty::Method
763+
tcx: ty::ctxt) -> ty::method
764764
{
765765
let method_doc = lookup_item(id, cdata.data);
766766
let def_id = item_def_id(method_doc, cdata);
@@ -770,20 +770,19 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::node_id,
770770
let transformed_self_ty = doc_transformed_self_ty(method_doc, tcx, cdata);
771771
let fty = doc_method_fty(method_doc, tcx, cdata);
772772
let vis = item_visibility(method_doc);
773-
let explicit_self = get_explicit_self(method_doc);
774-
775-
ty::Method::new(
776-
name,
777-
ty::Generics {
773+
let self_ty = get_self_ty(method_doc);
774+
ty::method {
775+
ident: name,
776+
generics: ty::Generics {
778777
type_param_defs: type_param_defs,
779778
region_param: None
780779
},
781-
transformed_self_ty,
782-
fty,
783-
explicit_self,
784-
vis,
785-
def_id
786-
)
780+
transformed_self_ty: transformed_self_ty,
781+
fty: fty,
782+
self_ty: self_ty,
783+
vis: vis,
784+
def_id: def_id
785+
}
787786
}
788787

789788
pub fn get_trait_method_def_ids(cdata: cmd,
@@ -824,20 +823,19 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd,
824823
};
825824

826825
let transformed_self_ty = doc_transformed_self_ty(mth, tcx, cdata);
827-
let explicit_self = get_explicit_self(mth);
828-
829-
let ty_method = ty::Method::new(
830-
name,
831-
ty::Generics {
826+
let self_ty = get_self_ty(mth);
827+
let ty_method = ty::method {
828+
ident: name,
829+
generics: ty::Generics {
832830
type_param_defs: type_param_defs,
833831
region_param: None
834832
},
835-
transformed_self_ty,
836-
fty,
837-
explicit_self,
838-
ast::public,
839-
did
840-
);
833+
transformed_self_ty: transformed_self_ty,
834+
fty: fty,
835+
self_ty: self_ty,
836+
vis: ast::public,
837+
def_id: did
838+
};
841839
let provided_trait_method_info = ProvidedTraitMethodInfo {
842840
ty: ty_method,
843841
def_id: did

trunk/src/librustc/metadata/encoder.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ fn encode_path(ecx: @EncodeContext,
366366
fn encode_reexported_static_method(ecx: @EncodeContext,
367367
ebml_w: &mut writer::Encoder,
368368
exp: &middle::resolve::Export2,
369-
m: @ty::Method) {
369+
m: @ty::method) {
370370
debug!("(encode static trait method) reexport '%s::%s'",
371371
*exp.name, *ecx.tcx.sess.str_of(m.ident));
372372
ebml_w.start_tag(tag_items_data_item_reexport);
@@ -389,7 +389,7 @@ fn encode_reexported_static_methods(ecx: @EncodeContext,
389389
Some(&ast_map::node_item(_, path)) => {
390390
if mod_path != *path {
391391
for methods.each |&m| {
392-
if m.explicit_self == ast::sty_static {
392+
if m.self_ty == ast::sty_static {
393393
encode_reexported_static_method(ecx,
394394
ebml_w,
395395
exp, m);
@@ -486,11 +486,11 @@ fn encode_visibility(ebml_w: &mut writer::Encoder, visibility: visibility) {
486486
ebml_w.end_tag();
487487
}
488488

489-
fn encode_explicit_self(ebml_w: &mut writer::Encoder, explicit_self: ast::explicit_self_) {
490-
ebml_w.start_tag(tag_item_trait_method_explicit_self);
489+
fn encode_self_type(ebml_w: &mut writer::Encoder, self_type: ast::self_ty_) {
490+
ebml_w.start_tag(tag_item_trait_method_self_ty);
491491

492492
// Encode the base self type.
493-
match explicit_self {
493+
match self_type {
494494
sty_static => {
495495
ebml_w.writer.write(&[ 's' as u8 ]);
496496
}
@@ -625,7 +625,7 @@ fn encode_info_for_struct_ctor(ecx: @EncodeContext,
625625

626626
fn encode_method_ty_fields(ecx: @EncodeContext,
627627
ebml_w: &mut writer::Encoder,
628-
method_ty: &ty::Method) {
628+
method_ty: &ty::method) {
629629
encode_def_id(ebml_w, method_ty.def_id);
630630
encode_name(ecx, ebml_w, method_ty.ident);
631631
encode_ty_type_param_defs(ebml_w, ecx,
@@ -634,7 +634,7 @@ fn encode_method_ty_fields(ecx: @EncodeContext,
634634
encode_transformed_self_ty(ecx, ebml_w, method_ty.transformed_self_ty);
635635
encode_method_fty(ecx, ebml_w, &method_ty.fty);
636636
encode_visibility(ebml_w, method_ty.vis);
637-
encode_explicit_self(ebml_w, method_ty.explicit_self);
637+
encode_self_type(ebml_w, method_ty.self_ty);
638638
}
639639

640640
fn encode_info_for_method(ecx: @EncodeContext,
@@ -652,10 +652,10 @@ fn encode_info_for_method(ecx: @EncodeContext,
652652
ebml_w.start_tag(tag_items_data_item);
653653

654654
let method_def_id = local_def(m.id);
655-
let method_ty = ty::method(ecx.tcx, method_def_id);
655+
let method_ty: @ty::method = ty::method(ecx.tcx, method_def_id);
656656
encode_method_ty_fields(ecx, ebml_w, method_ty);
657657

658-
match m.explicit_self.node {
658+
match m.self_ty.node {
659659
ast::sty_static => {
660660
encode_family(ebml_w, purity_static_method_family(m.purity));
661661
}
@@ -948,7 +948,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
948948
for ty::trait_method_def_ids(tcx, local_def(item.id)).eachi |i, &method_def_id| {
949949
assert!(method_def_id.crate == ast::local_crate);
950950

951-
let method_ty = ty::method(tcx, method_def_id);
951+
let method_ty: @ty::method = ty::method(tcx, method_def_id);
952952

953953
index.push(entry {val: method_def_id.node, pos: ebml_w.writer.tell()});
954954

@@ -962,7 +962,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
962962
trait_path.push(ast_map::path_name(item.ident));
963963
encode_path(ecx, ebml_w, trait_path, ast_map::path_name(method_ty.ident));
964964

965-
match method_ty.explicit_self {
965+
match method_ty.self_ty {
966966
sty_static => {
967967
encode_family(ebml_w,
968968
purity_static_method_family(
@@ -991,7 +991,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
991991
// This is obviously a bogus assert but I don't think this
992992
// ever worked before anyhow...near as I can tell, before
993993
// we would emit two items.
994-
if method_ty.explicit_self == sty_static {
994+
if method_ty.self_ty == sty_static {
995995
tcx.sess.span_unimpl(
996996
item.span,
997997
fmt!("Method %s is both provided and static",

trunk/src/librustc/metadata/tydecode.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ pub fn parse_trait_ref_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ct
126126
parse_trait_ref(st, conv)
127127
}
128128

129+
pub fn parse_arg_data(data: @~[u8], crate_num: int, pos: uint, tcx: ty::ctxt,
130+
conv: conv_did) -> ty::arg {
131+
let st = parse_state_from_data(data, crate_num, pos, tcx);
132+
parse_arg(st, conv)
133+
}
134+
129135
fn parse_path(st: @mut PState) -> @ast::Path {
130136
let mut idents: ~[ast::ident] = ~[];
131137
fn is_last(c: char) -> bool { return c == '(' || c == ':'; }
@@ -465,6 +471,12 @@ fn parse_onceness(c: char) -> ast::Onceness {
465471
}
466472
}
467473

474+
fn parse_arg(st: @mut PState, conv: conv_did) -> ty::arg {
475+
ty::arg {
476+
ty: parse_ty(st, conv)
477+
}
478+
}
479+
468480
fn parse_closure_ty(st: @mut PState, conv: conv_did) -> ty::ClosureTy {
469481
let sigil = parse_sigil(st);
470482
let purity = parse_purity(next(st));
@@ -493,9 +505,9 @@ fn parse_bare_fn_ty(st: @mut PState, conv: conv_did) -> ty::BareFnTy {
493505

494506
fn parse_sig(st: @mut PState, conv: conv_did) -> ty::FnSig {
495507
assert!((next(st) == '['));
496-
let mut inputs = ~[];
508+
let mut inputs: ~[ty::arg] = ~[];
497509
while peek(st) != ']' {
498-
inputs.push(parse_ty(st, conv));
510+
inputs.push(ty::arg { ty: parse_ty(st, conv) });
499511
}
500512
st.pos += 1u; // eat the ']'
501513
let ret_ty = parse_ty(st, conv);

trunk/src/librustc/metadata/tyencode.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ fn enc_sigil(w: @io::Writer, sigil: Sigil) {
344344
}
345345
}
346346

347+
pub fn enc_arg(w: @io::Writer, cx: @ctxt, arg: ty::arg) {
348+
enc_ty(w, cx, arg.ty);
349+
}
350+
347351
fn enc_purity(w: @io::Writer, p: purity) {
348352
match p {
349353
pure_fn => w.write_char('p'),
@@ -385,8 +389,8 @@ fn enc_closure_ty(w: @io::Writer, cx: @ctxt, ft: &ty::ClosureTy) {
385389

386390
fn enc_fn_sig(w: @io::Writer, cx: @ctxt, fsig: &ty::FnSig) {
387391
w.write_char('[');
388-
for fsig.inputs.each |ty| {
389-
enc_ty(w, cx, *ty);
392+
for fsig.inputs.each |arg| {
393+
enc_arg(w, cx, *arg);
390394
}
391395
w.write_char(']');
392396
enc_ty(w, cx, fsig.output);

0 commit comments

Comments
 (0)