Skip to content

Commit b08f2d9

Browse files
committed
---
yaml --- r: 79402 b: refs/heads/snap-stage3 c: c7352e6 h: refs/heads/master v: v3
1 parent bee114d commit b08f2d9

Some content is hidden

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

45 files changed

+346
-745
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 124eb2119c78651cfaaa7a046a101fa2e20f83ca
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 3c3ae1d0e26c9ae0906dc57daa14bb9e4627e3c8
4+
refs/heads/snap-stage3: c7352e6403331b0464d1b1e1ccfc9a0f7b67e50b
55
refs/heads/try: ac820906c0e53eab79a98ee64f7231f57c3887b4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ RUNTIME_CXXS_$(1)_$(2) := \
7676
rt/rust_upcall.cpp \
7777
rt/rust_uv.cpp \
7878
rt/rust_crate_map.cpp \
79+
rt/rust_log.cpp \
7980
rt/isaac/randport.cpp \
8081
rt/miniz.cpp \
8182
rt/memory_region.cpp \

branches/snap-stage3/src/compiletest/compiletest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,8 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
307307
// Try to elide redundant long paths
308308
fn shorten(path: &Path) -> ~str {
309309
let filename = path.filename();
310-
let p = path.pop();
311-
let dir = p.filename();
312-
fmt!("%s/%s", dir.unwrap_or_default(""), filename.unwrap_or_default(""))
310+
let dir = path.pop().filename();
311+
fmt!("%s/%s", dir.unwrap_or_default(~""), filename.unwrap_or_default(~""))
313312
}
314313

315314
test::DynTestName(fmt!("[%s] %s",

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
880880
let dirs = os::list_dir_path(&Path(tstr));
881881
for file in dirs.iter() {
882882

883-
if (file.filetype() == Some(".so")) {
883+
if (file.filetype() == Some(~".so")) {
884884

885885
let copy_result = procsrv::run("", config.adb_path,
886886
[~"push", file.to_str(), config.adb_test_dir.clone()],

branches/snap-stage3/src/libextra/ebml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ pub mod reader {
410410
}
411411

412412
fn read_bool(&mut self) -> bool {
413-
doc_as_u8(self.next_doc(EsBool)) != 0
413+
doc_as_u8(self.next_doc(EsBool)) as bool
414414
}
415415

416416
fn read_f64(&mut self) -> f64 {

branches/snap-stage3/src/librust/rust.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
162162
fn cmd_test(args: &[~str]) -> ValidUsage {
163163
match args {
164164
[ref filename] => {
165-
let p = Path(*filename);
166-
let test_exec = p.filestem().unwrap() + "test~";
165+
let test_exec = Path(*filename).filestem().unwrap() + "test~";
167166
invoke("rustc", &[~"--test", filename.to_owned(),
168167
~"-o", test_exec.to_owned()], rustc::main_args);
169168
let exit_code = run::process_status(~"./" + test_exec, []);
@@ -176,8 +175,7 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
176175
fn cmd_run(args: &[~str]) -> ValidUsage {
177176
match args {
178177
[ref filename, ..prog_args] => {
179-
let p = Path(*filename);
180-
let exec = p.filestem().unwrap() + "~";
178+
let exec = Path(*filename).filestem().unwrap() + "~";
181179
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
182180
rustc::main_args);
183181
let exit_code = run::process_status(~"./"+exec, prog_args);

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 26 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::run;
3535
use std::str;
3636
use std::vec;
3737
use syntax::ast;
38-
use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
38+
use syntax::ast_map::{path, path_mod, path_name};
3939
use syntax::attr;
4040
use syntax::attr::{AttrMetaMethods};
4141
use syntax::print::pprust;
@@ -667,7 +667,8 @@ pub fn truncated_hash_result(symbol_hasher: &mut hash::State) -> ~str {
667667
pub fn symbol_hash(tcx: ty::ctxt,
668668
symbol_hasher: &mut hash::State,
669669
t: ty::t,
670-
link_meta: LinkMeta) -> @str {
670+
link_meta: LinkMeta)
671+
-> @str {
671672
// NB: do *not* use abbrevs here as we want the symbol names
672673
// to be independent of one another in the crate.
673674

@@ -722,7 +723,7 @@ pub fn sanitize(s: &str) -> ~str {
722723
'a' .. 'z'
723724
| 'A' .. 'Z'
724725
| '0' .. '9'
725-
| '_' | '.' => result.push_char(c),
726+
| '_' => result.push_char(c),
726727

727728
_ => {
728729
let mut tstr = ~"";
@@ -743,65 +744,19 @@ pub fn sanitize(s: &str) -> ~str {
743744
return result;
744745
}
745746

746-
pub fn mangle(sess: Session, ss: path,
747-
hash: Option<&str>, vers: Option<&str>) -> ~str {
748-
// Follow C++ namespace-mangling style, see
749-
// http://en.wikipedia.org/wiki/Name_mangling for more info.
750-
//
751-
// It turns out that on OSX you can actually have arbitrary symbols in
752-
// function names (at least when given to LLVM), but this is not possible
753-
// when using unix's linker. Perhaps one day when we just a linker from LLVM
754-
// we won't need to do this name mangling. The problem with name mangling is
755-
// that it seriously limits the available characters. For example we can't
756-
// have things like @T or ~[T] in symbol names when one would theoretically
757-
// want them for things like impls of traits on that type.
758-
//
759-
// To be able to work on all platforms and get *some* reasonable output, we
760-
// use C++ name-mangling.
761-
762-
let mut n = ~"_ZN"; // _Z == Begin name-sequence, N == nested
763-
764-
let push = |s: &str| {
765-
let sani = sanitize(s);
766-
n.push_str(fmt!("%u%s", sani.len(), sani));
767-
};
747+
pub fn mangle(sess: Session, ss: path) -> ~str {
748+
// Follow C++ namespace-mangling style
768749

769-
// First, connect each component with <len, name> pairs.
770-
for s in ss.iter() {
771-
match *s {
772-
path_name(s) | path_mod(s) | path_pretty_name(s, _) => {
773-
push(sess.str_of(s))
774-
}
775-
}
776-
}
750+
let mut n = ~"_ZN"; // Begin name-sequence.
777751

778-
// next, if any identifiers are "pretty" and need extra information tacked
779-
// on, then use the hash to generate two unique characters. For now
780-
// hopefully 2 characters is enough to avoid collisions.
781-
static EXTRA_CHARS: &'static str =
782-
"abcdefghijklmnopqrstuvwxyz\
783-
ABCDEFGHIJKLMNOPQRSTUVWXYZ\
784-
0123456789";
785-
let mut hash = match hash { Some(s) => s.to_owned(), None => ~"" };
786752
for s in ss.iter() {
787753
match *s {
788-
path_pretty_name(_, extra) => {
789-
let hi = (extra >> 32) as u32 as uint;
790-
let lo = extra as u32 as uint;
791-
hash.push_char(EXTRA_CHARS[hi % EXTRA_CHARS.len()] as char);
792-
hash.push_char(EXTRA_CHARS[lo % EXTRA_CHARS.len()] as char);
754+
path_name(s) | path_mod(s) => {
755+
let sani = sanitize(sess.str_of(s));
756+
n.push_str(fmt!("%u%s", sani.len(), sani));
793757
}
794-
_ => {}
795758
}
796759
}
797-
if hash.len() > 0 {
798-
push(hash);
799-
}
800-
match vers {
801-
Some(s) => push(s),
802-
None => {}
803-
}
804-
805760
n.push_char('E'); // End name-sequence.
806761
n
807762
}
@@ -810,15 +765,10 @@ pub fn exported_name(sess: Session,
810765
path: path,
811766
hash: &str,
812767
vers: &str) -> ~str {
813-
// The version will get mangled to have a leading '_', but it makes more
814-
// sense to lead with a 'v' b/c this is a version...
815-
let vers = if vers.len() > 0 && !char::is_XID_start(vers.char_at(0)) {
816-
"v" + vers
817-
} else {
818-
vers.to_owned()
819-
};
820-
821-
mangle(sess, path, Some(hash), Some(vers.as_slice()))
768+
mangle(sess,
769+
vec::append_one(
770+
vec::append_one(path, path_name(sess.ident_of(hash))),
771+
path_name(sess.ident_of(vers))))
822772
}
823773

824774
pub fn mangle_exported_name(ccx: &mut CrateContext,
@@ -836,33 +786,31 @@ pub fn mangle_internal_name_by_type_only(ccx: &mut CrateContext,
836786
let s = ppaux::ty_to_short_str(ccx.tcx, t);
837787
let hash = get_symbol_hash(ccx, t);
838788
return mangle(ccx.sess,
839-
~[path_name(ccx.sess.ident_of(name)),
840-
path_name(ccx.sess.ident_of(s))],
841-
Some(hash.as_slice()),
842-
None);
789+
~[path_name(ccx.sess.ident_of(name)),
790+
path_name(ccx.sess.ident_of(s)),
791+
path_name(ccx.sess.ident_of(hash))]);
843792
}
844793

845794
pub fn mangle_internal_name_by_type_and_seq(ccx: &mut CrateContext,
846-
t: ty::t,
847-
name: &str) -> ~str {
795+
t: ty::t,
796+
name: &str) -> ~str {
848797
let s = ppaux::ty_to_str(ccx.tcx, t);
849798
let hash = get_symbol_hash(ccx, t);
850799
return mangle(ccx.sess,
851-
~[path_name(ccx.sess.ident_of(s)),
852-
path_name(gensym_name(name))],
853-
Some(hash.as_slice()),
854-
None);
800+
~[path_name(ccx.sess.ident_of(s)),
801+
path_name(ccx.sess.ident_of(hash)),
802+
path_name(gensym_name(name))]);
855803
}
856804

857805
pub fn mangle_internal_name_by_path_and_seq(ccx: &mut CrateContext,
858806
mut path: path,
859807
flav: &str) -> ~str {
860808
path.push(path_name(gensym_name(flav)));
861-
mangle(ccx.sess, path, None, None)
809+
mangle(ccx.sess, path)
862810
}
863811

864812
pub fn mangle_internal_name_by_path(ccx: &mut CrateContext, path: path) -> ~str {
865-
mangle(ccx.sess, path, None, None)
813+
mangle(ccx.sess, path)
866814
}
867815

868816
pub fn mangle_internal_name_by_seq(_ccx: &mut CrateContext, flav: &str) -> ~str {
@@ -1004,13 +952,13 @@ pub fn link_args(sess: Session,
1004952
let cstore = sess.cstore;
1005953
let r = cstore::get_used_crate_files(cstore);
1006954
for cratepath in r.iter() {
1007-
if cratepath.filetype() == Some(".rlib") {
955+
if cratepath.filetype() == Some(~".rlib") {
1008956
args.push(cratepath.to_str());
1009957
loop;
1010958
}
1011959
let dir = cratepath.dirname();
1012960
if dir != ~"" { args.push(~"-L" + dir); }
1013-
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap().to_owned());
961+
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap());
1014962
args.push(~"-l" + libarg);
1015963
}
1016964

branches/snap-stage3/src/librustc/metadata/common.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,6 @@ pub static tag_impls_impl: uint = 0x84;
188188
pub static tag_items_data_item_inherent_impl: uint = 0x85;
189189
pub static tag_items_data_item_extension_impl: uint = 0x86;
190190

191-
pub static tag_path_elt_pretty_name: uint = 0x87;
192-
pub static tag_path_elt_pretty_name_ident: uint = 0x88;
193-
pub static tag_path_elt_pretty_name_extra: uint = 0x89;
194-
195191
pub struct LinkMeta {
196192
name: @str,
197193
vers: @str,

branches/snap-stage3/src/librustc/metadata/decoder.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,6 @@ fn item_path(item_doc: ebml::Doc) -> ast_map::path {
303303
} else if tag == tag_path_elt_name {
304304
let str = elt_doc.as_str_slice();
305305
result.push(ast_map::path_name(token::str_to_ident(str)));
306-
} else if tag == tag_path_elt_pretty_name {
307-
let name_doc = reader::get_doc(elt_doc,
308-
tag_path_elt_pretty_name_ident);
309-
let extra_doc = reader::get_doc(elt_doc,
310-
tag_path_elt_pretty_name_extra);
311-
let str = name_doc.as_str_slice();
312-
let extra = reader::doc_as_u64(extra_doc);
313-
result.push(ast_map::path_pretty_name(token::str_to_ident(str),
314-
extra));
315306
} else {
316307
// ignore tag_path_len element
317308
}

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -359,21 +359,12 @@ fn encode_path(ecx: &EncodeContext,
359359
fn encode_path_elt(ecx: &EncodeContext,
360360
ebml_w: &mut writer::Encoder,
361361
elt: ast_map::path_elt) {
362-
match elt {
363-
ast_map::path_mod(n) => {
364-
ebml_w.wr_tagged_str(tag_path_elt_mod, ecx.tcx.sess.str_of(n));
365-
}
366-
ast_map::path_name(n) => {
367-
ebml_w.wr_tagged_str(tag_path_elt_name, ecx.tcx.sess.str_of(n));
368-
}
369-
ast_map::path_pretty_name(n, extra) => {
370-
ebml_w.start_tag(tag_path_elt_pretty_name);
371-
ebml_w.wr_tagged_str(tag_path_elt_pretty_name_ident,
372-
ecx.tcx.sess.str_of(n));
373-
ebml_w.wr_tagged_u64(tag_path_elt_pretty_name_extra, extra);
374-
ebml_w.end_tag();
375-
}
376-
}
362+
let (tag, name) = match elt {
363+
ast_map::path_mod(name) => (tag_path_elt_mod, name),
364+
ast_map::path_name(name) => (tag_path_elt_name, name)
365+
};
366+
367+
ebml_w.wr_tagged_str(tag, ecx.tcx.sess.str_of(name));
377368
}
378369

379370
ebml_w.start_tag(tag_path);

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ impl visit::Visitor<@mut GatherLoanCtxt> for GatherLoanVisitor {
9595
fn visit_local(&mut self, l:@Local, e:@mut GatherLoanCtxt) {
9696
gather_loans_in_local(self, l, e);
9797
}
98+
99+
// #7740: Do not visit items here, not even fn items nor methods
100+
// of impl items; the outer loop in borrowck/mod will visit them
101+
// for us in turn. Thus override visit_item's walk with a no-op.
102+
fn visit_item(&mut self, _:@ast::item, _:@mut GatherLoanCtxt) { }
98103
}
99104

100105
pub fn gather_loans(bccx: @BorrowckCtxt,
@@ -135,10 +140,8 @@ fn gather_loans_in_fn(v: &mut GatherLoanVisitor,
135140
id: ast::NodeId,
136141
this: @mut GatherLoanCtxt) {
137142
match fk {
138-
// Do not visit items here, the outer loop in borrowck/mod
139-
// will visit them for us in turn.
140143
&visit::fk_item_fn(*) | &visit::fk_method(*) => {
141-
return;
144+
fail!("cannot occur, due to visit_item override");
142145
}
143146

144147
// Visit closures as part of the containing item.

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use std::local_data;
7777
use extra::time;
7878
use extra::sort;
7979
use syntax::ast::Ident;
80-
use syntax::ast_map::{path, path_elt_to_str, path_name, path_pretty_name};
80+
use syntax::ast_map::{path, path_elt_to_str, path_name};
8181
use syntax::ast_util::{local_def};
8282
use syntax::attr;
8383
use syntax::attr::AttrMetaMethods;
@@ -2219,7 +2219,7 @@ pub fn trans_item(ccx: @mut CrateContext, item: &ast::item) {
22192219
}
22202220
let v = ccx.const_values.get_copy(&item.id);
22212221
unsafe {
2222-
if !(llvm::LLVMConstIntGetZExtValue(v) != 0) {
2222+
if !(llvm::LLVMConstIntGetZExtValue(v) as bool) {
22232223
ccx.sess.span_fatal(expr.span, "static assertion failed");
22242224
}
22252225
}
@@ -2627,7 +2627,8 @@ pub fn register_method(ccx: @mut CrateContext,
26272627
let mty = ty::node_id_to_type(ccx.tcx, id);
26282628

26292629
let mut path = (*path).clone();
2630-
path.push(path_pretty_name(m.ident, token::gensym("meth") as u64));
2630+
path.push(path_name(gensym_name("meth")));
2631+
path.push(path_name(m.ident));
26312632

26322633
let sym = exported_name(ccx, path, mty, m.attrs);
26332634

branches/snap-stage3/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,7 @@ pub fn path_str(sess: session::Session, p: &[path_elt]) -> ~str {
948948
let mut first = true;
949949
for e in p.iter() {
950950
match *e {
951-
ast_map::path_name(s) | ast_map::path_mod(s) |
952-
ast_map::path_pretty_name(s, _) => {
951+
ast_map::path_name(s) | ast_map::path_mod(s) => {
953952
if first {
954953
first = false
955954
} else {

branches/snap-stage3/src/librustc/middle/trans/meth.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use middle::trans::type_::Type;
3434

3535
use std::c_str::ToCStr;
3636
use std::vec;
37-
use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
37+
use syntax::ast_map::{path, path_mod, path_name};
3838
use syntax::ast_util;
3939
use syntax::{ast, ast_map};
4040
use syntax::visit;
@@ -254,7 +254,7 @@ pub fn trans_static_method_callee(bcx: @mut Block,
254254
} else {
255255
let path = csearch::get_item_path(bcx.tcx(), method_id);
256256
match path[path.len()-1] {
257-
path_pretty_name(s, _) | path_name(s) => { s }
257+
path_name(s) => { s }
258258
path_mod(_) => { fail!("path doesn't have a name?") }
259259
}
260260
};

branches/snap-stage3/src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,6 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
26962696
}, t_e, None);
26972697
}
26982698

2699-
let t1 = structurally_resolved_type(fcx, e.span, t_1);
27002699
let te = structurally_resolved_type(fcx, e.span, t_e);
27012700
let t_1_is_char = type_is_char(fcx, expr.span, t_1);
27022701

@@ -2711,9 +2710,6 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
27112710
fmt!("only `u8` can be cast as `char`, not `%s`", actual)
27122711
}, t_e, None);
27132712
}
2714-
} else if ty::get(t1).sty == ty::ty_bool {
2715-
fcx.tcx().sess.span_err(expr.span,
2716-
"cannot cast as `bool`, compare with zero instead");
27172713
} else if type_is_region_ptr(fcx, expr.span, t_e) &&
27182714
type_is_unsafe_ptr(fcx, expr.span, t_1) {
27192715

0 commit comments

Comments
 (0)