Skip to content

Commit 5ed00c9

Browse files
committed
---
yaml --- r: 152016 b: refs/heads/try2 c: 6ee9109 h: refs/heads/master v: v3
1 parent 514a461 commit 5ed00c9

File tree

6 files changed

+55
-5
lines changed

6 files changed

+55
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ec4f79ff6c997b4144a59fbfb145933c1e3ff593
8+
refs/heads/try2: 6ee9109c8b1eb170b7fb6fac6d248801dcd42817
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ pub static tag_crate_triple: uint = 0x66;
206206

207207
pub static tag_dylib_dependency_formats: uint = 0x67;
208208

209+
pub static tag_method_argument_names: uint = 0x8e;
210+
pub static tag_method_argument_name: uint = 0x8f;
211+
209212
#[deriving(Clone, Show)]
210213
pub struct LinkMeta {
211214
pub crateid: CrateId,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,3 +306,10 @@ pub fn get_missing_lang_items(cstore: &cstore::CStore, cnum: ast::CrateNum)
306306
let cdata = cstore.get_crate_data(cnum);
307307
decoder::get_missing_lang_items(&*cdata)
308308
}
309+
310+
pub fn get_method_arg_names(cstore: &cstore::CStore, did: ast::DefId)
311+
-> Vec<StrBuf>
312+
{
313+
let cdata = cstore.get_crate_data(did.krate);
314+
decoder::get_method_arg_names(&*cdata, did.node)
315+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,3 +1309,18 @@ pub fn get_missing_lang_items(cdata: Cmd)
13091309
});
13101310
return result;
13111311
}
1312+
1313+
pub fn get_method_arg_names(cdata: Cmd, id: ast::NodeId) -> Vec<StrBuf> {
1314+
let mut ret = Vec::new();
1315+
let method_doc = lookup_item(id, cdata.data());
1316+
match reader::maybe_get_doc(method_doc, tag_method_argument_names) {
1317+
Some(args_doc) => {
1318+
reader::tagged_docs(args_doc, tag_method_argument_name, |name_doc| {
1319+
ret.push(name_doc.as_str_slice().to_strbuf());
1320+
true
1321+
});
1322+
}
1323+
None => {}
1324+
}
1325+
return ret;
1326+
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,21 @@ fn encode_info_for_method(ecx: &EncodeContext,
774774
} else {
775775
encode_symbol(ecx, ebml_w, m.def_id.node);
776776
}
777+
778+
ebml_w.start_tag(tag_method_argument_names);
779+
for arg in ast_method.decl.inputs.iter() {
780+
ebml_w.start_tag(tag_method_argument_name);
781+
match arg.pat.node {
782+
ast::PatIdent(_, ref name, _) => {
783+
let name = name.segments.last().unwrap().identifier;
784+
let name = token::get_ident(name);
785+
ebml_w.writer.write(name.get().as_bytes());
786+
}
787+
_ => {}
788+
}
789+
ebml_w.end_tag();
790+
}
791+
ebml_w.end_tag();
777792
}
778793

779794
ebml_w.end_tag();

branches/try2/src/librustdoc/clean.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ impl Clean<Option<Vec<TyParamBound>>> for ty::substs {
488488
}
489489
}
490490

491-
#[deriving(Clone, Encodable, Decodable)]
491+
#[deriving(Clone, Encodable, Decodable, Eq)]
492492
pub struct Lifetime(String);
493493

494494
impl Lifetime {
@@ -629,7 +629,7 @@ impl Clean<Item> for ast::TypeMethod {
629629
}
630630
}
631631

632-
#[deriving(Clone, Encodable, Decodable)]
632+
#[deriving(Clone, Encodable, Decodable, Eq)]
633633
pub enum SelfTy {
634634
SelfStatic,
635635
SelfValue,
@@ -868,6 +868,16 @@ impl Clean<TraitMethod> for ty::Method {
868868
(s, sig)
869869
}
870870
};
871+
let mut names = csearch::get_method_arg_names(&tcx.sess.cstore,
872+
self.def_id).move_iter();
873+
if self_ != SelfStatic {
874+
names.next();
875+
}
876+
let mut decl = sig.clean();
877+
for (name, slot) in names.zip(decl.inputs.values.mut_iter()) {
878+
slot.name = name;
879+
}
880+
871881
m(Item {
872882
name: Some(self.ident.clean()),
873883
visibility: Some(ast::Inherited),
@@ -878,7 +888,7 @@ impl Clean<TraitMethod> for ty::Method {
878888
fn_style: self.fty.fn_style,
879889
generics: self.generics.clean(),
880890
self_: self_,
881-
decl: sig.clean(),
891+
decl: decl,
882892
})
883893
})
884894
}
@@ -1437,7 +1447,7 @@ impl Clean<Item> for doctree::Static {
14371447
}
14381448
}
14391449

1440-
#[deriving(Show, Clone, Encodable, Decodable)]
1450+
#[deriving(Show, Clone, Encodable, Decodable, Eq)]
14411451
pub enum Mutability {
14421452
Mutable,
14431453
Immutable,

0 commit comments

Comments
 (0)