Skip to content

Commit c37a15f

Browse files
committed
---
yaml --- r: 63025 b: refs/heads/snap-stage3 c: 1ebb62f h: refs/heads/master i: 63023: b508e88 v: v3
1 parent aa271b7 commit c37a15f

Some content is hidden

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

53 files changed

+714
-904
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: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f5ef0766da03b15262c410953316541ff9f931d4
4+
refs/heads/snap-stage3: 1ebb62f591c078294762e1124357d74d21a66974
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ ifneq ($(wildcard $(CFG_GIT)),)
146146
ifneq ($(wildcard $(CFG_GIT_DIR)),)
147147
CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
148148
--pretty=format:'(%h %ci)')
149-
CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) rev-parse HEAD)
149+
CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
150+
--pretty=format:'%H')
150151
endif
151152
endif
152153

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

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -633,37 +633,26 @@ pub fn get_symbol_hash(ccx: @CrateContext, t: ty::t) -> @str {
633633

634634
// Name sanitation. LLVM will happily accept identifiers with weird names, but
635635
// gas doesn't!
636-
// gas accepts the following characters in symbols: a-z, A-Z, 0-9, ., _, $
637636
pub fn sanitize(s: &str) -> ~str {
638637
let mut result = ~"";
639638
for str::each_char(s) |c| {
640639
match c {
641-
// Escape these with $ sequences
642-
'@' => result += "$SP$",
643-
'~' => result += "$UP$",
644-
'*' => result += "$RP$",
645-
'&' => result += "$BP$",
646-
'<' => result += "$LT$",
647-
'>' => result += "$GT$",
648-
'(' => result += "$LP$",
649-
')' => result += "$RP$",
650-
',' => result += "$C$",
651-
652-
// '.' doesn't occur in types and functions, so reuse it
653-
// for ':'
654-
':' => result.push_char('.'),
655-
656-
// These are legal symbols
657-
'a' .. 'z'
658-
| 'A' .. 'Z'
659-
| '0' .. '9'
660-
| '_' => result.push_char(c),
661-
662-
_ => {
663-
if c > 'z' && char::is_XID_continue(c) {
664-
result.push_char(c);
665-
}
640+
'@' => result += "_sbox_",
641+
'~' => result += "_ubox_",
642+
'*' => result += "_ptr_",
643+
'&' => result += "_ref_",
644+
',' => result += "_",
645+
646+
'{' | '(' => result += "_of_",
647+
'a' .. 'z'
648+
| 'A' .. 'Z'
649+
| '0' .. '9'
650+
| '_' => result.push_char(c),
651+
_ => {
652+
if c > 'z' && char::is_XID_continue(c) {
653+
result.push_char(c);
666654
}
655+
}
667656
}
668657
}
669658

@@ -745,7 +734,7 @@ pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
745734
}
746735

747736
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: &str) -> ~str {
748-
return fmt!("%s_%u", flav, (ccx.names)(flav).name);
737+
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
749738
}
750739

751740

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ use syntax::attr;
3939
use syntax::codemap;
4040
use syntax::diagnostic;
4141
use syntax::parse;
42-
use syntax::parse::token;
4342
use syntax::print::{pp, pprust};
4443
use syntax;
4544

@@ -231,7 +230,7 @@ pub fn compile_rest(sess: Session,
231230
sess.filesearch,
232231
session::sess_os_to_meta_os(sess.targ_cfg.os),
233232
sess.opts.is_static,
234-
token::get_ident_interner()));
233+
sess.parse_sess.interner));
235234

236235
let lang_items = time(time_passes, ~"language item collection", ||
237236
middle::lang_items::collect_language_items(crate, sess));
@@ -456,7 +455,7 @@ pub fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: &input,
456455
let is_expanded = upto != cu_parse;
457456
let src = sess.codemap.get_filemap(source_name(input)).src;
458457
do io::with_str_reader(*src) |rdr| {
459-
pprust::print_crate(sess.codemap, token::get_ident_interner(),
458+
pprust::print_crate(sess.codemap, sess.parse_sess.interner,
460459
sess.span_diagnostic, crate.unwrap(),
461460
source_name(input),
462461
rdr, io::stdout(), ann, is_expanded);
@@ -755,7 +754,7 @@ pub fn build_session_(sopts: @session::options,
755754
let target_cfg = build_target_config(sopts, demitter);
756755
let p_s = parse::new_parse_sess_special_handler(span_diagnostic_handler,
757756
cm);
758-
let cstore = @mut cstore::mk_cstore(token::get_ident_interner());
757+
let cstore = @mut cstore::mk_cstore(p_s.interner);
759758
let filesearch = filesearch::mk_filesearch(
760759
&sopts.maybe_sysroot,
761760
sopts.target_triple,
@@ -964,7 +963,7 @@ pub fn early_error(emitter: diagnostic::Emitter, msg: ~str) -> ! {
964963

965964
pub fn list_metadata(sess: Session, path: &Path, out: @io::Writer) {
966965
metadata::loader::list_file_metadata(
967-
token::get_ident_interner(),
966+
sess.parse_sess.interner,
968967
session::sess_os_to_meta_os(sess.targ_cfg.os), path, out);
969968
}
970969

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use syntax::diagnostic;
2626
use syntax::parse::ParseSess;
2727
use syntax::{ast, codemap};
2828
use syntax::abi;
29-
use syntax::parse::token;
3029
use syntax;
3130

3231
use core::hashmap::HashMap;
@@ -294,19 +293,14 @@ impl Session_ {
294293
self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
295294
}
296295

297-
// pointless function, now...
298296
pub fn str_of(@self, id: ast::ident) -> @~str {
299-
token::ident_to_str(&id)
297+
self.parse_sess.interner.get(id)
300298
}
301-
302-
// pointless function, now...
303299
pub fn ident_of(@self, st: &str) -> ast::ident {
304-
token::str_to_ident(st)
300+
self.parse_sess.interner.intern(st)
305301
}
306-
307-
// pointless function, now...
308302
pub fn intr(@self) -> @syntax::parse::token::ident_interner {
309-
token::get_ident_interner()
303+
self.parse_sess.interner
310304
}
311305
}
312306

branches/snap-stage3/src/librustc/front/test.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
2222
use syntax::codemap;
2323
use syntax::ext::base::ExtCtxt;
2424
use syntax::fold;
25-
use syntax::parse::token;
2625
use syntax::print::pprust;
2726
use syntax::{ast, ast_util};
2827

@@ -144,7 +143,7 @@ fn fold_item(cx: @mut TestCtxt, i: @ast::item, fld: @fold::ast_fold)
144143
-> Option<@ast::item> {
145144
cx.path.push(i.ident);
146145
debug!("current path: %s",
147-
ast_util::path_name_i(copy cx.path));
146+
ast_util::path_name_i(copy cx.path, cx.sess.parse_sess.interner));
148147

149148
if is_test_fn(cx, i) || is_bench_fn(i) {
150149
match i.node {
@@ -412,10 +411,13 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> @ast::expr {
412411

413412
let ext_cx = cx.ext_cx;
414413

415-
debug!("encoding %s", ast_util::path_name_i(path));
414+
debug!("encoding %s", ast_util::path_name_i(path,
415+
cx.sess.parse_sess.interner));
416416

417417
let name_lit: ast::lit =
418-
nospan(ast::lit_str(@ast_util::path_name_i(path)));
418+
nospan(ast::lit_str(@ast_util::path_name_i(
419+
path,
420+
cx.sess.parse_sess.interner)));
419421

420422
let name_expr = @ast::expr {
421423
id: cx.sess.next_node_id(),

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use core::vec;
2222
use syntax::attr;
2323
use syntax::codemap::{span, dummy_sp};
2424
use syntax::diagnostic::span_handler;
25-
use syntax::parse::token;
2625
use syntax::parse::token::ident_interner;
2726
use syntax::visit;
2827
use syntax::ast;
@@ -177,7 +176,7 @@ fn visit_item(e: @mut Env, i: @ast::item) {
177176
}
178177
nn
179178
}
180-
None => token::ident_to_str(&i.ident)
179+
None => e.intr.get(i.ident)
181180
};
182181
if attr::find_attrs_by_name(i.attrs, "nolink").is_empty() {
183182
already_added =
@@ -236,7 +235,7 @@ fn resolve_crate(e: @mut Env,
236235
hash: @~str,
237236
span: span)
238237
-> ast::crate_num {
239-
let metas = metas_with_ident(token::ident_to_str(&ident), metas);
238+
let metas = metas_with_ident(@/*bad*/copy *e.intr.get(ident), metas);
240239

241240
match existing_match(e, metas, hash) {
242241
None => {
@@ -277,7 +276,7 @@ fn resolve_crate(e: @mut Env,
277276
match attr::last_meta_item_value_str_by_name(load_ctxt.metas,
278277
"name") {
279278
Some(v) => v,
280-
None => token::ident_to_str(&ident),
279+
None => e.intr.get(ident),
281280
};
282281
let cmeta = @cstore::crate_metadata {
283282
name: cname,
@@ -306,11 +305,10 @@ fn resolve_crate_deps(e: @mut Env, cdata: @~[u8]) -> cstore::cnum_map {
306305
for decoder::get_crate_deps(e.intr, cdata).each |dep| {
307306
let extrn_cnum = dep.cnum;
308307
let cname = dep.name;
309-
let cname_str = token::ident_to_str(&dep.name);
310308
let cmetas = metas_with(dep.vers, @~"vers", ~[]);
311309
debug!("resolving dep crate %s ver: %s hash: %s",
312-
*cname_str, *dep.vers, *dep.hash);
313-
match existing_match(e, metas_with_ident(cname_str,
310+
*e.intr.get(dep.name), *dep.vers, *dep.hash);
311+
match existing_match(e, metas_with_ident(e.intr.get(cname),
314312
copy cmetas),
315313
dep.hash) {
316314
Some(local_cnum) => {

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use syntax::parse::token::{StringRef, ident_interner, special_idents};
4040
use syntax::print::pprust;
4141
use syntax::{ast, ast_util};
4242
use syntax::codemap;
43-
use syntax::parse::token;
4443

4544
type cmd = @crate_metadata;
4645

@@ -298,10 +297,10 @@ fn item_path(intr: @ident_interner, item_doc: ebml::Doc) -> ast_map::path {
298297
for reader::docs(path_doc) |tag, elt_doc| {
299298
if tag == tag_path_elt_mod {
300299
let str = reader::doc_as_str(elt_doc);
301-
result.push(ast_map::path_mod(token::str_to_ident(str)));
300+
result.push(ast_map::path_mod(intr.intern(str)));
302301
} else if tag == tag_path_elt_name {
303302
let str = reader::doc_as_str(elt_doc);
304-
result.push(ast_map::path_name(token::str_to_ident(str)));
303+
result.push(ast_map::path_name(intr.intern(str)));
305304
} else {
306305
// ignore tag_path_len element
307306
}
@@ -315,8 +314,8 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident {
315314
do reader::with_doc_data(name) |data| {
316315
let string = str::from_bytes_slice(data);
317316
match intr.find_equiv(&StringRef(string)) {
318-
None => token::str_to_ident(string),
319-
Some(val) => ast::new_ident(val),
317+
None => intr.intern(string),
318+
Some(val) => val,
320319
}
321320
}
322321
}
@@ -844,7 +843,7 @@ pub fn get_type_name_if_impl(intr: @ident_interner,
844843
}
845844

846845
for reader::tagged_docs(item, tag_item_impl_type_basename) |doc| {
847-
return Some(token::str_to_ident(str::from_bytes(reader::doc_data(doc))));
846+
return Some(intr.intern(str::from_bytes(reader::doc_data(doc))));
848847
}
849848

850849
return None;
@@ -1096,7 +1095,7 @@ pub fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] {
10961095
}
10971096
for reader::tagged_docs(depsdoc, tag_crate_dep) |depdoc| {
10981097
deps.push(crate_dep {cnum: crate_num,
1099-
name: token::str_to_ident(docstr(depdoc, tag_crate_dep_name)),
1098+
name: intr.intern(docstr(depdoc, tag_crate_dep_name)),
11001099
vers: @docstr(depdoc, tag_crate_dep_vers),
11011100
hash: @docstr(depdoc, tag_crate_dep_hash)});
11021101
crate_num += 1;
@@ -1110,7 +1109,7 @@ fn list_crate_deps(intr: @ident_interner, data: @~[u8], out: @io::Writer) {
11101109
for get_crate_deps(intr, data).each |dep| {
11111110
out.write_str(
11121111
fmt!("%d %s-%s-%s\n",
1113-
dep.cnum, *token::ident_to_str(&dep.name), *dep.hash, *dep.vers));
1112+
dep.cnum, *intr.get(dep.name), *dep.hash, *dep.vers));
11141113
}
11151114

11161115
out.write_str("\n");

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use syntax::opt_vec::OptVec;
4343
use syntax::opt_vec;
4444
use syntax::parse::token::special_idents;
4545
use syntax::{ast_util, visit};
46-
use syntax::parse::token;
4746
use syntax;
4847
use writer = extra::ebml::writer;
4948

@@ -142,7 +141,8 @@ fn add_to_index(ecx: @EncodeContext,
142141
full_path.push(name);
143142
index.push(
144143
entry {
145-
val: ast_util::path_name_i(full_path),
144+
val: ast_util::path_name_i(full_path,
145+
ecx.tcx.sess.parse_sess.interner),
146146
pos: ebml_w.writer.tell()
147147
});
148148
}
@@ -485,7 +485,8 @@ fn encode_info_for_mod(ecx: @EncodeContext,
485485
(%?/%?)",
486486
*ecx.tcx.sess.str_of(ident),
487487
did,
488-
ast_map::node_id_to_str(ecx.tcx.items, did, token::get_ident_interner()));
488+
ast_map::node_id_to_str(ecx.tcx.items, did, ecx.tcx
489+
.sess.parse_sess.interner));
489490

490491
ebml_w.start_tag(tag_mod_impl);
491492
ebml_w.wr_str(def_to_str(local_def(did)));
@@ -1054,7 +1055,7 @@ fn encode_info_for_item(ecx: @EncodeContext,
10541055
tcx.sess.span_unimpl(
10551056
item.span,
10561057
fmt!("Method %s is both provided and static",
1057-
*token::ident_to_str(&method_ty.ident)));
1058+
*tcx.sess.intr().get(method_ty.ident)));
10581059
}
10591060
encode_type_param_bounds(ebml_w, ecx,
10601061
&m.generics.ty_params);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use metadata::filesearch::FileSearch;
1919
use metadata::filesearch;
2020
use syntax::codemap::span;
2121
use syntax::diagnostic::span_handler;
22-
use syntax::parse::token;
2322
use syntax::parse::token::ident_interner;
2423
use syntax::print::pprust;
2524
use syntax::{ast, attr};
@@ -60,7 +59,7 @@ pub fn load_library_crate(cx: &Context) -> (~str, @~[u8]) {
6059
None => {
6160
cx.diag.span_fatal(
6261
cx.span, fmt!("can't find crate for `%s`",
63-
*token::ident_to_str(&cx.ident)));
62+
*cx.intr.get(cx.ident)));
6463
}
6564
}
6665
}

0 commit comments

Comments
 (0)