Skip to content

Commit 9d63403

Browse files
committed
auto merge of #11417 : eddyb/rust/desnaking, r=bstrie
2 parents 63ba93f + 72ee4a5 commit 9d63403

File tree

143 files changed

+4253
-4357
lines changed

Some content is hidden

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

143 files changed

+4253
-4357
lines changed

src/librustc/back/link.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ use extra::hex::ToHex;
3838
use extra::tempfile::TempDir;
3939
use syntax::abi;
4040
use syntax::ast;
41-
use syntax::ast_map::{path, path_mod, path_name, path_pretty_name};
41+
use syntax::ast_map::{PathMod, PathName, PathPrettyName};
42+
use syntax::ast_map;
4243
use syntax::attr;
4344
use syntax::attr::AttrMetaMethods;
4445
use syntax::crateid::CrateId;
@@ -583,7 +584,7 @@ pub fn sanitize(s: &str) -> ~str {
583584
return result;
584585
}
585586

586-
pub fn mangle(sess: Session, ss: path,
587+
pub fn mangle(sess: Session, ss: ast_map::Path,
587588
hash: Option<&str>, vers: Option<&str>) -> ~str {
588589
// Follow C++ namespace-mangling style, see
589590
// http://en.wikipedia.org/wiki/Name_mangling for more info.
@@ -609,7 +610,7 @@ pub fn mangle(sess: Session, ss: path,
609610
// First, connect each component with <len, name> pairs.
610611
for s in ss.iter() {
611612
match *s {
612-
path_name(s) | path_mod(s) | path_pretty_name(s, _) => {
613+
PathName(s) | PathMod(s) | PathPrettyName(s, _) => {
613614
push(sess.str_of(s))
614615
}
615616
}
@@ -625,7 +626,7 @@ pub fn mangle(sess: Session, ss: path,
625626
let mut hash = match hash { Some(s) => s.to_owned(), None => ~"" };
626627
for s in ss.iter() {
627628
match *s {
628-
path_pretty_name(_, extra) => {
629+
PathPrettyName(_, extra) => {
629630
let hi = (extra >> 32) as u32 as uint;
630631
let lo = extra as u32 as uint;
631632
hash.push_char(EXTRA_CHARS[hi % EXTRA_CHARS.len()] as char);
@@ -647,7 +648,7 @@ pub fn mangle(sess: Session, ss: path,
647648
}
648649

649650
pub fn exported_name(sess: Session,
650-
path: path,
651+
path: ast_map::Path,
651652
hash: &str,
652653
vers: &str) -> ~str {
653654
// The version will get mangled to have a leading '_', but it makes more
@@ -662,7 +663,7 @@ pub fn exported_name(sess: Session,
662663
}
663664

664665
pub fn mangle_exported_name(ccx: &CrateContext,
665-
path: path,
666+
path: ast_map::Path,
666667
t: ty::t) -> ~str {
667668
let hash = get_symbol_hash(ccx, t);
668669
return exported_name(ccx.sess, path,
@@ -676,8 +677,8 @@ pub fn mangle_internal_name_by_type_only(ccx: &CrateContext,
676677
let s = ppaux::ty_to_short_str(ccx.tcx, t);
677678
let hash = get_symbol_hash(ccx, t);
678679
return mangle(ccx.sess,
679-
~[path_name(ccx.sess.ident_of(name)),
680-
path_name(ccx.sess.ident_of(s))],
680+
~[PathName(ccx.sess.ident_of(name)),
681+
PathName(ccx.sess.ident_of(s))],
681682
Some(hash.as_slice()),
682683
None);
683684
}
@@ -689,20 +690,21 @@ pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
689690
let hash = get_symbol_hash(ccx, t);
690691
let (_, name) = gensym_name(name);
691692
return mangle(ccx.sess,
692-
~[path_name(ccx.sess.ident_of(s)), name],
693+
~[PathName(ccx.sess.ident_of(s)), name],
693694
Some(hash.as_slice()),
694695
None);
695696
}
696697

697698
pub fn mangle_internal_name_by_path_and_seq(ccx: &CrateContext,
698-
mut path: path,
699+
mut path: ast_map::Path,
699700
flav: &str) -> ~str {
700701
let (_, name) = gensym_name(flav);
701702
path.push(name);
702703
mangle(ccx.sess, path, None, None)
703704
}
704705

705-
pub fn mangle_internal_name_by_path(ccx: &CrateContext, path: path) -> ~str {
706+
pub fn mangle_internal_name_by_path(ccx: &CrateContext,
707+
path: ast_map::Path) -> ~str {
706708
mangle(ccx.sess, path, None, None)
707709
}
708710

src/librustc/driver/driver.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pub fn phase_1_parse_input(sess: Session, cfg: ast::CrateConfig, input: &input)
164164
pub fn phase_2_configure_and_expand(sess: Session,
165165
cfg: ast::CrateConfig,
166166
mut crate: ast::Crate)
167-
-> (ast::Crate, syntax::ast_map::map) {
167+
-> (ast::Crate, syntax::ast_map::Map) {
168168
let time_passes = sess.time_passes();
169169

170170
sess.building_library.set(session::building_library(sess.opts, &crate));
@@ -220,7 +220,7 @@ pub struct CrateAnalysis {
220220
/// structures carrying the results of the analysis.
221221
pub fn phase_3_run_analysis_passes(sess: Session,
222222
crate: &ast::Crate,
223-
ast_map: syntax::ast_map::map) -> CrateAnalysis {
223+
ast_map: syntax::ast_map::Map) -> CrateAnalysis {
224224

225225
let time_passes = sess.time_passes();
226226

@@ -515,29 +515,29 @@ struct IdentifiedAnnotation {
515515
contents: (),
516516
}
517517

518-
impl pprust::pp_ann for IdentifiedAnnotation {
519-
fn pre(&self, node: pprust::ann_node) {
518+
impl pprust::PpAnn for IdentifiedAnnotation {
519+
fn pre(&self, node: pprust::AnnNode) {
520520
match node {
521-
pprust::node_expr(s, _) => pprust::popen(s),
521+
pprust::NodeExpr(s, _) => pprust::popen(s),
522522
_ => ()
523523
}
524524
}
525-
fn post(&self, node: pprust::ann_node) {
525+
fn post(&self, node: pprust::AnnNode) {
526526
match node {
527-
pprust::node_item(s, item) => {
527+
pprust::NodeItem(s, item) => {
528528
pp::space(&mut s.s);
529529
pprust::synth_comment(s, item.id.to_str());
530530
}
531-
pprust::node_block(s, blk) => {
531+
pprust::NodeBlock(s, blk) => {
532532
pp::space(&mut s.s);
533533
pprust::synth_comment(s, ~"block " + blk.id.to_str());
534534
}
535-
pprust::node_expr(s, expr) => {
535+
pprust::NodeExpr(s, expr) => {
536536
pp::space(&mut s.s);
537537
pprust::synth_comment(s, expr.id.to_str());
538538
pprust::pclose(s);
539539
}
540-
pprust::node_pat(s, pat) => {
540+
pprust::NodePat(s, pat) => {
541541
pp::space(&mut s.s);
542542
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
543543
}
@@ -549,17 +549,17 @@ struct TypedAnnotation {
549549
analysis: CrateAnalysis,
550550
}
551551

552-
impl pprust::pp_ann for TypedAnnotation {
553-
fn pre(&self, node: pprust::ann_node) {
552+
impl pprust::PpAnn for TypedAnnotation {
553+
fn pre(&self, node: pprust::AnnNode) {
554554
match node {
555-
pprust::node_expr(s, _) => pprust::popen(s),
555+
pprust::NodeExpr(s, _) => pprust::popen(s),
556556
_ => ()
557557
}
558558
}
559-
fn post(&self, node: pprust::ann_node) {
559+
fn post(&self, node: pprust::AnnNode) {
560560
let tcx = self.analysis.ty_cx;
561561
match node {
562-
pprust::node_expr(s, expr) => {
562+
pprust::NodeExpr(s, expr) => {
563563
pp::space(&mut s.s);
564564
pp::word(&mut s.s, "as");
565565
pp::space(&mut s.s);
@@ -589,16 +589,16 @@ pub fn pretty_print_input(sess: Session,
589589
PpmIdentified | PpmExpandedIdentified => {
590590
@IdentifiedAnnotation {
591591
contents: (),
592-
} as @pprust::pp_ann
592+
} as @pprust::PpAnn
593593
}
594594
PpmTyped => {
595595
let ast_map = ast_map.expect("--pretty=typed missing ast_map");
596596
let analysis = phase_3_run_analysis_passes(sess, &crate, ast_map);
597597
@TypedAnnotation {
598598
analysis: analysis
599-
} as @pprust::pp_ann
599+
} as @pprust::PpAnn
600600
}
601-
_ => @pprust::no_ann::new() as @pprust::pp_ann,
601+
_ => @pprust::NoAnn as @pprust::PpAnn,
602602
};
603603

604604
let src = sess.codemap.get_filemap(source_name(input)).src;
@@ -662,10 +662,10 @@ pub fn build_target_config(sopts: @session::options,
662662
"unknown architecture: " + sopts.target_triple)
663663
};
664664
let (int_type, uint_type) = match arch {
665-
abi::X86 => (ast::ty_i32, ast::ty_u32),
666-
abi::X86_64 => (ast::ty_i64, ast::ty_u64),
667-
abi::Arm => (ast::ty_i32, ast::ty_u32),
668-
abi::Mips => (ast::ty_i32, ast::ty_u32)
665+
abi::X86 => (ast::TyI32, ast::TyU32),
666+
abi::X86_64 => (ast::TyI64, ast::TyU64),
667+
abi::Arm => (ast::TyI32, ast::TyU32),
668+
abi::Mips => (ast::TyI32, ast::TyU32)
669669
};
670670
let target_triple = sopts.target_triple.clone();
671671
let target_strs = match arch {
@@ -1116,7 +1116,7 @@ pub fn build_output_filenames(input: &input,
11161116
}
11171117

11181118
pub fn early_error(emitter: &diagnostic::Emitter, msg: &str) -> ! {
1119-
emitter.emit(None, msg, diagnostic::fatal);
1119+
emitter.emit(None, msg, diagnostic::Fatal);
11201120
fail!();
11211121
}
11221122

src/librustc/driver/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use middle::lint;
1919

2020
use syntax::attr::AttrMetaMethods;
2121
use syntax::ast::NodeId;
22-
use syntax::ast::{int_ty, uint_ty};
22+
use syntax::ast::{IntTy, UintTy};
2323
use syntax::codemap::Span;
2424
use syntax::diagnostic;
2525
use syntax::parse::ParseSess;
@@ -35,8 +35,8 @@ pub struct config {
3535
os: abi::Os,
3636
arch: abi::Architecture,
3737
target_strs: target_strs::t,
38-
int_type: int_ty,
39-
uint_type: uint_ty,
38+
int_type: IntTy,
39+
uint_type: UintTy,
4040
}
4141

4242
pub static verbose: uint = 1 << 0;
@@ -368,7 +368,7 @@ impl Session_ {
368368
}
369369

370370
// pointless function, now...
371-
pub fn intr(&self) -> @syntax::parse::token::ident_interner {
371+
pub fn intr(&self) -> @syntax::parse::token::IdentInterner {
372372
token::get_ident_interner()
373373
}
374374
}

src/librustc/front/assign_node_ids_and_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ impl ast_map::FoldOps for NodeIdAssigner {
2424
}
2525
}
2626

27-
pub fn assign_node_ids_and_map(sess: Session, crate: ast::Crate) -> (ast::Crate, ast_map::map) {
27+
pub fn assign_node_ids_and_map(sess: Session, crate: ast::Crate) -> (ast::Crate, ast_map::Map) {
2828
ast_map::map_crate(sess.diagnostic(), crate, NodeIdAssigner { sess: sess })
2929
}

0 commit comments

Comments
 (0)