Skip to content

Commit 5b7e7f4

Browse files
committed
---
yaml --- r: 147823 b: refs/heads/try2 c: c34ef5d h: refs/heads/master i: 147821: 24e2b8e 147819: 622c311 147815: 3c209e5 147807: 5f093a2 v: v3
1 parent e16502b commit 5b7e7f4

File tree

8 files changed

+79
-29
lines changed

8 files changed

+79
-29
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: 9cdad685a39fd826174a6cbcd283ad2dee41e175
8+
refs/heads/try2: c34ef5d7e4f44f8e65600a2c3866f5861c401ea1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/driver/driver.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@ extern mod this = "rustdoc";
1919
#[cfg(rustc)]
2020
extern mod this = "rustc";
2121

22-
#[cfg(rustdoc_ng)]
23-
extern mod this = "rustdoc_ng";
24-
2522
fn main() { this::main() }

branches/try2/src/etc/emacs/rust-mode.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
;; We don't want to indent out to the open bracket if the
5555
;; open bracket ends the line
5656
(when (not (looking-at "[[:blank:]]*\\(?://.*\\)?$"))
57-
(when (looking-at "[[:space:]]") (forward-to-word 1))
57+
(when (looking-at "[[:space:]]")
58+
(forward-word 1)
59+
(backward-word 1))
5860
(current-column))))
5961

6062
(defun rust-mode-indent-line ()

branches/try2/src/librustc/back/link.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use std::run;
3434
use std::str;
3535
use std::io;
3636
use std::io::fs;
37+
use extra::hex::ToHex;
3738
use extra::tempfile::TempDir;
3839
use syntax::abi;
3940
use syntax::ast;
@@ -490,8 +491,10 @@ pub fn build_link_meta(sess: Session,
490491
}
491492
}
492493

493-
pub fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
494-
symbol_hasher.result_str()
494+
fn truncated_hash_result(symbol_hasher: &mut Sha256) -> ~str {
495+
let output = symbol_hasher.result_bytes();
496+
// 64 bits should be enough to avoid collisions.
497+
output.slice_to(8).to_hex()
495498
}
496499

497500

@@ -879,8 +882,11 @@ fn link_rlib(sess: Session,
879882
match trans {
880883
Some(trans) => {
881884
// Instead of putting the metadata in an object file section, rlibs
882-
// contain the metadata in a separate file.
883-
let metadata = obj_filename.with_filename(METADATA_FILENAME);
885+
// contain the metadata in a separate file. We use a temp directory
886+
// here so concurrent builds in the same directory don't try to use
887+
// the same filename for metadata (stomping over one another)
888+
let tmpdir = TempDir::new("rustc").expect("needs a temp dir");
889+
let metadata = tmpdir.path().join(METADATA_FILENAME);
884890
fs::File::create(&metadata).write(trans.metadata);
885891
a.add_file(&metadata, false);
886892
fs::unlink(&metadata);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
11401140
let impl_vtables = ty::lookup_impl_vtables(tcx, def_id);
11411141
encode_impl_vtables(ebml_w, ecx, &impl_vtables);
11421142
}
1143-
let elt = ast_map::impl_pretty_name(opt_trait, ty, item.ident);
1143+
let elt = ast_map::impl_pretty_name(opt_trait, ty);
11441144
encode_path(ecx, ebml_w, path, elt);
11451145
ebml_w.end_tag();
11461146

branches/try2/src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
242242
}
243243

244244
// Load all plugins/passes into a PluginManager
245-
let path = matches.opt_str("plugin-path").unwrap_or(~"/tmp/rustdoc_ng/plugins");
245+
let path = matches.opt_str("plugin-path").unwrap_or(~"/tmp/rustdoc/plugins");
246246
let mut pm = plugins::PluginManager::new(Path::new(path));
247247
for pass in passes.iter() {
248248
let plugin = match PASSES.iter().position(|&(p, _, _)| p == *pass) {

branches/try2/src/libsyntax/ast_map.rs

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,71 @@ pub fn path_elt_to_str(pe: path_elt, itr: @ident_interner) -> ~str {
8282
}
8383
}
8484

85-
pub fn impl_pretty_name(trait_ref: &Option<trait_ref>,
86-
ty: &Ty, default: Ident) -> path_elt {
87-
let itr = get_ident_interner();
88-
let ty_ident = match ty.node {
89-
ty_path(ref path, _, _) => path.segments.last().identifier,
90-
_ => default
85+
/// write a "pretty" version of `ty` to `out`. This is designed so
86+
/// that symbols of `impl`'d methods give some hint of where they came
87+
/// from, even if it's hard to read (previously they would all just be
88+
/// listed as `__extensions__::method_name::hash`, with no indication
89+
/// of the type).
90+
// XXX: these dollar signs and the names in general are actually a
91+
// relic of $ being one of the very few valid symbol names on
92+
// unix. These kinds of details shouldn't be exposed way up here
93+
// in the ast.
94+
fn pretty_ty(ty: &Ty, itr: @ident_interner, out: &mut ~str) {
95+
let (prefix, subty) = match ty.node {
96+
ty_uniq(ty) => ("$UP$", &*ty),
97+
ty_box(mt { ty, .. }) => ("$SP$", &*ty),
98+
ty_ptr(mt { ty, mutbl }) => (if mutbl == MutMutable {"$RPmut$"} else {"$RP$"},
99+
&*ty),
100+
ty_rptr(_, mt { ty, mutbl }) => (if mutbl == MutMutable {"$BPmut$"} else {"$BP$"},
101+
&*ty),
102+
103+
ty_vec(ty) => ("$VEC$", &*ty),
104+
ty_fixed_length_vec(ty, _) => ("$FIXEDVEC$", &*ty),
105+
106+
// these can't be represented as <prefix><contained ty>, so
107+
// need custom handling.
108+
ty_nil => { out.push_str("$NIL$"); return }
109+
ty_path(ref path, _, _) => {
110+
out.push_str(itr.get(path.segments.last().identifier.name));
111+
return
112+
}
113+
ty_tup(ref tys) => {
114+
out.push_str(format!("$TUP_{}$", tys.len()));
115+
for subty in tys.iter() {
116+
pretty_ty(*subty, itr, out);
117+
out.push_char('$');
118+
}
119+
return
120+
}
121+
122+
// meh, better than nothing.
123+
ty_bot => { out.push_str("$BOT$"); return }
124+
ty_closure(..) => { out.push_str("$CLOSURE$"); return }
125+
ty_bare_fn(..) => { out.push_str("$FN$"); return }
126+
ty_typeof(..) => { out.push_str("$TYPEOF$"); return }
127+
ty_infer(..) => { out.push_str("$INFER$"); return }
128+
91129
};
130+
131+
out.push_str(prefix);
132+
pretty_ty(subty, itr, out);
133+
}
134+
135+
pub fn impl_pretty_name(trait_ref: &Option<trait_ref>, ty: &Ty) -> path_elt {
136+
let itr = get_ident_interner();
137+
92138
let hash = (trait_ref, ty).hash();
139+
let mut pretty;
93140
match *trait_ref {
94-
None => path_pretty_name(ty_ident, hash),
141+
None => pretty = ~"",
95142
Some(ref trait_ref) => {
96-
// XXX: this dollar sign is actually a relic of being one of the
97-
// very few valid symbol names on unix. These kinds of
98-
// details shouldn't be exposed way up here in the ast.
99-
let s = format!("{}${}",
100-
itr.get(trait_ref.path.segments.last().identifier.name),
101-
itr.get(ty_ident.name));
102-
path_pretty_name(Ident::new(itr.gensym(s)), hash)
143+
pretty = itr.get(trait_ref.path.segments.last().identifier.name).to_owned();
144+
pretty.push_char('$');
103145
}
104-
}
146+
};
147+
pretty_ty(ty, itr, &mut pretty);
148+
149+
path_pretty_name(Ident::new(itr.gensym(pretty)), hash)
105150
}
106151

107152
#[deriving(Clone)]
@@ -265,7 +310,7 @@ impl Visitor<()> for Ctx {
265310
// Right now the ident on impls is __extensions__ which isn't
266311
// very pretty when debugging, so attempt to select a better
267312
// name to use.
268-
let elt = impl_pretty_name(maybe_trait, ty, i.ident);
313+
let elt = impl_pretty_name(maybe_trait, ty);
269314

270315
let impl_did = ast_util::local_def(i.id);
271316
for m in ms.iter() {

branches/try2/src/test/compile-fail/ambig_impl_unify.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ trait foo {
1313
}
1414

1515
impl foo for ~[uint] {
16-
fn foo(&self) -> int {1} //~ NOTE candidate #1 is `foo$__extensions__::foo`
16+
fn foo(&self) -> int {1} //~ NOTE candidate #1 is `foo$$UP$$VEC$uint::foo`
1717
}
1818

1919
impl foo for ~[int] {
20-
fn foo(&self) -> int {2} //~ NOTE candidate #2 is `foo$__extensions__::foo`
20+
fn foo(&self) -> int {2} //~ NOTE candidate #2 is `foo$$UP$$VEC$int::foo`
2121
}
2222

2323
fn main() {

0 commit comments

Comments
 (0)