diff options
Diffstat (limited to 'src/librustc')
67 files changed, 747 insertions, 742 deletions
diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs index 94f4adb590a..42855b63ff8 100644 --- a/src/librustc/back/arm.rs +++ b/src/librustc/back/arm.rs @@ -13,14 +13,14 @@ use driver::session::sess_os_to_meta_os; use driver::session; use metadata::loader::meta_section_name; -pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t { +pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t { return target_strs::t { module_asm: ~"", - meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), + meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(), data_layout: match target_os { - session::os_macos => { + session::OsMacos => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -28,7 +28,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_win32 => { + session::OsWin32 => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -36,7 +36,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_linux => { + session::OsLinux => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -44,7 +44,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_android => { + session::OsAndroid => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -52,7 +52,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_freebsd => { + session::OsFreebsd => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 7ebb47d5124..91666966949 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -814,13 +814,13 @@ pub fn mangle_internal_name_by_seq(_ccx: &mut CrateContext, flav: &str) -> ~str } -pub fn output_dll_filename(os: session::os, lm: LinkMeta) -> ~str { +pub fn output_dll_filename(os: session::Os, lm: LinkMeta) -> ~str { let (dll_prefix, dll_suffix) = match os { - session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX), - session::os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX), - session::os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX), - session::os_android => (android::DLL_PREFIX, android::DLL_SUFFIX), - session::os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX), + session::OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX), + session::OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX), + session::OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX), + session::OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX), + session::OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX), }; fmt!("%s%s-%s-%s%s", dll_prefix, lm.name, lm.extras_hash, lm.vers, dll_suffix) } @@ -835,7 +835,7 @@ pub fn get_cc_prog(sess: Session) -> ~str { match sess.opts.linker { Some(ref linker) => linker.to_str(), None => match sess.targ_cfg.os { - session::os_android => + session::OsAndroid => match &sess.opts.android_cross_path { &Some(ref path) => { fmt!("%s/bin/arm-linux-androideabi-gcc", *path) @@ -845,7 +845,7 @@ pub fn get_cc_prog(sess: Session) -> ~str { (--android-cross-path)") } }, - session::os_win32 => ~"g++", + session::OsWin32 => ~"g++", _ => ~"cc" } } @@ -892,7 +892,7 @@ pub fn link_binary(sess: Session, } // Clean up on Darwin - if sess.targ_cfg.os == session::os_macos { + if sess.targ_cfg.os == session::OsMacos { run::process_status("dsymutil", [output.to_str()]); } @@ -913,7 +913,7 @@ pub fn link_args(sess: Session, // Converts a library file-stem into a cc -l argument fn unlib(config: @session::config, stem: ~str) -> ~str { if stem.starts_with("lib") && - config.os != session::os_win32 { + config.os != session::OsWin32 { stem.slice(3, stem.len()).to_owned() } else { stem @@ -939,7 +939,7 @@ pub fn link_args(sess: Session, obj_filename.to_str()]); let lib_cmd = match sess.targ_cfg.os { - session::os_macos => ~"-dynamiclib", + session::OsMacos => ~"-dynamiclib", _ => ~"-shared" }; @@ -995,7 +995,7 @@ pub fn link_args(sess: Session, // On mac we need to tell the linker to let this library // be rpathed - if sess.targ_cfg.os == session::os_macos { + if sess.targ_cfg.os == session::OsMacos { args.push(~"-Wl,-install_name,@rpath/" + output.filename().unwrap()); } @@ -1003,7 +1003,7 @@ pub fn link_args(sess: Session, // On linux librt and libdl are an indirect dependencies via rustrt, // and binutils 2.22+ won't add them automatically - if sess.targ_cfg.os == session::os_linux { + if sess.targ_cfg.os == session::OsLinux { args.push_all([~"-lrt", ~"-ldl"]); // LLVM implements the `frem` instruction as a call to `fmod`, @@ -1011,12 +1011,12 @@ pub fn link_args(sess: Session, // have to be explicit about linking to it. See #2510 args.push(~"-lm"); } - else if sess.targ_cfg.os == session::os_android { + else if sess.targ_cfg.os == session::OsAndroid { args.push_all([~"-ldl", ~"-llog", ~"-lsupc++", ~"-lgnustl_shared"]); args.push(~"-lm"); } - if sess.targ_cfg.os == session::os_freebsd { + if sess.targ_cfg.os == session::OsFreebsd { args.push_all([~"-pthread", ~"-lrt", ~"-L/usr/local/lib", ~"-lexecinfo", ~"-L/usr/local/lib/gcc46", @@ -1030,7 +1030,7 @@ pub fn link_args(sess: Session, // linker from the dwarf unwind info. Unfortunately, it does not seem to // understand how to unwind our __morestack frame, so we have to turn it // off. This has impacted some other projects like GHC. - if sess.targ_cfg.os == session::os_macos { + if sess.targ_cfg.os == session::OsMacos { args.push(~"-Wl,-no_compact_unwind"); } diff --git a/src/librustc/back/mips.rs b/src/librustc/back/mips.rs index e19b3c78623..52d8463adfe 100644 --- a/src/librustc/back/mips.rs +++ b/src/librustc/back/mips.rs @@ -13,14 +13,14 @@ use driver::session; use driver::session::sess_os_to_meta_os; use metadata::loader::meta_section_name; -pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t { +pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t { return target_strs::t { module_asm: ~"", - meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), + meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(), data_layout: match target_os { - session::os_macos => { + session::OsMacos => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -28,7 +28,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_win32 => { + session::OsWin32 => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -36,7 +36,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_linux => { + session::OsLinux => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -44,7 +44,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_android => { + session::OsAndroid => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + @@ -52,7 +52,7 @@ pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_st "-a0:0:64-n32" } - session::os_freebsd => { + session::OsFreebsd => { ~"e-p:32:32:32" + "-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + "-f32:32:32-f64:64:64" + diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index 22ed0b3cf3c..f937ab446f6 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -16,8 +16,8 @@ use metadata::filesearch; use std::hashmap::HashSet; use std::{os, util, vec}; -fn not_win32(os: session::os) -> bool { - os != session::os_win32 +fn not_win32(os: session::Os) -> bool { + os != session::OsWin32 } pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) @@ -25,7 +25,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) let os = sess.targ_cfg.os; // No rpath on windows - if os == session::os_win32 { + if os == session::OsWin32 { return ~[]; } @@ -52,7 +52,7 @@ pub fn rpaths_to_flags(rpaths: &[Path]) -> ~[~str] { rpaths.iter().map(|rpath| fmt!("-Wl,-rpath,%s",rpath.to_str())).collect() } -fn get_rpaths(os: session::os, +fn get_rpaths(os: session::Os, sysroot: &Path, output: &Path, libs: &[Path], @@ -97,13 +97,13 @@ fn get_rpaths(os: session::os, return rpaths; } -fn get_rpaths_relative_to_output(os: session::os, +fn get_rpaths_relative_to_output(os: session::Os, output: &Path, libs: &[Path]) -> ~[Path] { libs.iter().map(|a| get_rpath_relative_to_output(os, output, a)).collect() } -pub fn get_rpath_relative_to_output(os: session::os, +pub fn get_rpath_relative_to_output(os: session::Os, output: &Path, lib: &Path) -> Path { @@ -113,10 +113,10 @@ pub fn get_rpath_relative_to_output(os: session::os, // Mac doesn't appear to support $ORIGIN let prefix = match os { - session::os_android | session::os_linux | session::os_freebsd + session::OsAndroid | session::OsLinux | session::OsFreebsd => "$ORIGIN", - session::os_macos => "@executable_path", - session::os_win32 => util::unreachable() + session::OsMacos => "@executable_path", + session::OsWin32 => util::unreachable() }; Path(prefix).push_rel(&os::make_absolute(output).get_relative_to(&os::make_absolute(lib))) @@ -205,7 +205,7 @@ mod test { #[cfg(target_os = "linux")] #[cfg(target_os = "android")] fn test_rpath_relative() { - let o = session::os_linux; + let o = session::OsLinux; let res = get_rpath_relative_to_output(o, &Path("bin/rustc"), &Path("lib/libstd.so")); assert_eq!(res.to_str(), ~"$ORIGIN/../lib"); @@ -214,7 +214,7 @@ mod test { #[test] #[cfg(target_os = "freebsd")] fn test_rpath_relative() { - let o = session::os_freebsd; + let o = session::OsFreebsd; let res = get_rpath_relative_to_output(o, &Path("bin/rustc"), &Path("lib/libstd.so")); assert_eq!(res.to_str(), ~"$ORIGIN/../lib"); @@ -223,7 +223,7 @@ mod test { #[test] #[cfg(target_os = "macos")] fn test_rpath_relative() { - let o = session::os_macos; + let o = session::OsMacos; let res = get_rpath_relative_to_output(o, &Path("bin/rustc"), &Path("lib/libstd.so")); diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index 968c5ba161b..4518ec0a148 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -14,32 +14,32 @@ use driver::session::sess_os_to_meta_os; use driver::session; use metadata::loader::meta_section_name; -pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t { +pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t { return target_strs::t { module_asm: ~"", - meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), + meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(), data_layout: match target_os { - session::os_macos => { + session::OsMacos => { ~"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16" + "-i32:32:32-i64:32:64" + "-f32:32:32-f64:32:64-v64:64:64" + "-v128:128:128-a0:0:64-f80:128:128" + "-n8:16:32" } - session::os_win32 => { + session::OsWin32 => { ~"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32" } - session::os_linux => { + session::OsLinux => { ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" } - session::os_android => { + session::OsAndroid => { ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" } - session::os_freebsd => { + session::OsFreebsd => { ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" } }, diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index 87aad7a108c..3833f0d2b94 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -14,38 +14,38 @@ use driver::session::sess_os_to_meta_os; use driver::session; use metadata::loader::meta_section_name; -pub fn get_target_strs(target_triple: ~str, target_os: session::os) -> target_strs::t { +pub fn get_target_strs(target_triple: ~str, target_os: session::Os) -> target_strs::t { return target_strs::t { module_asm: ~"", - meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)), + meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)).to_owned(), data_layout: match target_os { - session::os_macos => { + session::OsMacos => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ "f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ "s0:64:64-f80:128:128-n8:16:32:64" } - session::os_win32 => { + session::OsWin32 => { // FIXME: Test this. Copied from linux (#2398) ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ "f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ "s0:64:64-f80:128:128-n8:16:32:64-S128" } - session::os_linux => { + session::OsLinux => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ "f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ "s0:64:64-f80:128:128-n8:16:32:64-S128" } - session::os_android => { + session::OsAndroid => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ "f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ "s0:64:64-f80:128:128-n8:16:32:64-S128" } - session::os_freebsd => { + session::OsFreebsd => { ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+ "f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+ "s0:64:64-f80:128:128-n8:16:32:64-S128" diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 74452f19549..e4d3ca4baef 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -43,12 +43,12 @@ use syntax::parse::token; use syntax::print::{pp, pprust}; use syntax; -pub enum pp_mode { - ppm_normal, - ppm_expanded, - ppm_typed, - ppm_identified, - ppm_expanded_identified +pub enum PpMode { + PpmNormal, + PpmExpanded, + PpmTyped, + PpmIdentified, + PpmExpandedIdentified } /** @@ -67,11 +67,11 @@ pub fn source_name(input: &input) -> @str { pub fn default_configuration(sess: Session) -> ast::CrateConfig { let tos = match sess.targ_cfg.os { - session::os_win32 => @"win32", - session::os_macos => @"macos", - session::os_linux => @"linux", - session::os_android => @"android", - session::os_freebsd => @"freebsd" + session::OsWin32 => @"win32", + session::OsMacos => @"macos", + session::OsLinux => @"linux", + session::OsAndroid => @"android", + session::OsFreebsd => @"freebsd" }; // ARM is bi-endian, however using NDK seems to default @@ -338,8 +338,8 @@ pub fn phase_5_run_llvm_passes(sess: Session, // output are OK, so we generate assembly first and then run it through // an external assembler. // Same for Android. - if (sess.targ_cfg.os == session::os_android || - sess.targ_cfg.os == session::os_win32) && + if (sess.targ_cfg.os == session::OsAndroid || + sess.targ_cfg.os == session::OsWin32) && (sess.opts.output_type == link::output_type_object || sess.opts.output_type == link::output_type_exe) { let output_type = link::output_type_assembly; @@ -439,7 +439,7 @@ pub fn compile_input(sess: Session, cfg: ast::CrateConfig, input: &input, } pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input, - ppm: pp_mode) { + ppm: PpMode) { fn ann_paren_for_expr(node: pprust::ann_node) { match node { @@ -485,20 +485,20 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input, let crate = phase_1_parse_input(sess, cfg.clone(), input); let (crate, is_expanded) = match ppm { - ppm_expanded | ppm_expanded_identified | ppm_typed => { + PpmExpanded | PpmExpandedIdentified | PpmTyped => { (phase_2_configure_and_expand(sess, cfg, crate), true) } _ => (crate, false) }; let annotation = match ppm { - ppm_identified | ppm_expanded_identified => { + PpmIdentified | PpmExpandedIdentified => { pprust::pp_ann { pre: ann_paren_for_expr, post: ann_identified_post } } - ppm_typed => { + PpmTyped => { let analysis = phase_3_run_analysis_passes(sess, crate); pprust::pp_ann { pre: ann_paren_for_expr, @@ -518,19 +518,19 @@ pub fn pretty_print_input(sess: Session, cfg: ast::CrateConfig, input: &input, } } -pub fn get_os(triple: &str) -> Option<session::os> { +pub fn get_os(triple: &str) -> Option<session::Os> { for &(name, os) in os_names.iter() { if triple.contains(name) { return Some(os) } } None } -static os_names : &'static [(&'static str, session::os)] = &'static [ - ("mingw32", session::os_win32), - ("win32", session::os_win32), - ("darwin", session::os_macos), - ("android", session::os_android), - ("linux", session::os_linux), - ("freebsd", session::os_freebsd)]; +static os_names : &'static [(&'static str, session::Os)] = &'static [ + ("mingw32", session::OsWin32), + ("win32", session::OsWin32), + ("darwin", session::OsMacos), + ("android", session::OsAndroid), + ("linux", session::OsLinux), + ("freebsd", session::OsFreebsd)]; pub fn get_arch(triple: &str) -> Option<abi::Architecture> { for &(arch, abi) in architecture_abis.iter() { @@ -817,13 +817,13 @@ pub fn build_session_(sopts: @session::options, } } -pub fn parse_pretty(sess: Session, name: &str) -> pp_mode { +pub fn parse_pretty(sess: Session, name: &str) -> PpMode { match name { - &"normal" => ppm_normal, - &"expanded" => ppm_expanded, - &"typed" => ppm_typed, - &"expanded,identified" => ppm_expanded_identified, - &"identified" => ppm_identified, + &"normal" => PpmNormal, + &"expanded" => PpmExpanded, + &"typed" => PpmTyped, + &"expanded,identified" => PpmExpandedIdentified, + &"identified" => PpmIdentified, _ => { sess.fatal("argument to `pretty` must be one of `normal`, \ `expanded`, `typed`, `identified`, \ diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 90a23c78d30..acc0aab659d 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -20,7 +20,7 @@ use middle::lint; use syntax::ast::NodeId; use syntax::ast::{int_ty, uint_ty, float_ty}; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::diagnostic; use syntax::parse::ParseSess; use syntax::{ast, codemap}; @@ -31,7 +31,7 @@ use syntax; use std::hashmap::HashMap; #[deriving(Eq)] -pub enum os { os_win32, os_macos, os_linux, os_android, os_freebsd, } +pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, } #[deriving(Clone)] pub enum crate_type { @@ -41,7 +41,7 @@ pub enum crate_type { } pub struct config { - os: os, + os: Os, arch: abi::Architecture, target_strs: target_strs::t, int_type: int_ty, @@ -209,25 +209,25 @@ pub struct Session_ { parse_sess: @mut ParseSess, codemap: @codemap::CodeMap, // For a library crate, this is always none - entry_fn: @mut Option<(NodeId, codemap::span)>, + entry_fn: @mut Option<(NodeId, codemap::Span)>, entry_type: @mut Option<EntryFnType>, span_diagnostic: @mut diagnostic::span_handler, filesearch: @filesearch::FileSearch, building_library: @mut bool, working_dir: Path, - lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::span, ~str)]>, + lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::Span, ~str)]>, } pub type Session = @Session_; impl Session_ { - pub fn span_fatal(@self, sp: span, msg: &str) -> ! { + pub fn span_fatal(@self, sp: Span, msg: &str) -> ! { self.span_diagnostic.span_fatal(sp, msg) } pub fn fatal(@self, msg: &str) -> ! { self.span_diagnostic.handler().fatal(msg) } - pub fn span_err(@self, sp: span, msg: &str) { + pub fn span_err(@self, sp: Span, msg: &str) { self.span_diagnostic.span_err(sp, msg) } pub fn err(@self, msg: &str) { @@ -242,25 +242,25 @@ impl Session_ { pub fn abort_if_errors(@self) { self.span_diagnostic.handler().abort_if_errors() } - pub fn span_warn(@self, sp: span, msg: &str) { + pub fn span_warn(@self, sp: Span, msg: &str) { self.span_diagnostic.span_warn(sp, msg) } pub fn warn(@self, msg: &str) { self.span_diagnostic.handler().warn(msg) } - pub fn span_note(@self, sp: span, msg: &str) { + pub fn span_note(@self, sp: Span, msg: &str) { self.span_diagnostic.span_note(sp, msg) } pub fn note(@self, msg: &str) { self.span_diagnostic.handler().note(msg) } - pub fn span_bug(@self, sp: span, msg: &str) -> ! { + pub fn span_bug(@self, sp: Span, msg: &str) -> ! { self.span_diagnostic.span_bug(sp, msg) } pub fn bug(@self, msg: &str) -> ! { self.span_diagnostic.handler().bug(msg) } - pub fn span_unimpl(@self, sp: span, msg: &str) -> ! { + pub fn span_unimpl(@self, sp: Span, msg: &str) -> ! { self.span_diagnostic.span_unimpl(sp, msg) } pub fn unimpl(@self, msg: &str) -> ! { @@ -269,7 +269,7 @@ impl Session_ { pub fn add_lint(@self, lint: lint::lint, id: ast::NodeId, - sp: span, + sp: Span, msg: ~str) { match self.lints.find_mut(&id) { Some(arr) => { arr.push((lint, sp, msg)); return; } @@ -288,7 +288,7 @@ impl Session_ { } // This exists to help with refactoring to eliminate impossible // cases later on - pub fn impossible_case(@self, sp: span, msg: &str) -> ! { + pub fn impossible_case(@self, sp: Span, msg: &str) -> ! { self.span_bug(sp, fmt!("Impossible case reached: %s", msg)); } pub fn verbose(@self) -> bool { self.debugging_opt(verbose) } @@ -411,15 +411,15 @@ pub fn building_library(req_crate_type: crate_type, } } -pub fn sess_os_to_meta_os(os: os) -> metadata::loader::os { +pub fn sess_os_to_meta_os(os: Os) -> metadata::loader::Os { use metadata::loader; match os { - os_win32 => loader::os_win32, - os_linux => loader::os_linux, - os_android => loader::os_android, - os_macos => loader::os_macos, - os_freebsd => loader::os_freebsd + OsWin32 => loader::OsWin32, + OsLinux => loader::OsLinux, + OsAndroid => loader::OsAndroid, + OsMacos => loader::OsMacos, + OsFreebsd => loader::OsFreebsd } } diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs index 429a1c35b34..5d536ba7213 100644 --- a/src/librustc/front/std_inject.rs +++ b/src/librustc/front/std_inject.rs @@ -39,8 +39,8 @@ fn no_prelude(attrs: &[ast::Attribute]) -> bool { } fn inject_libstd_ref(sess: Session, crate: &ast::Crate) -> @ast::Crate { - fn spanned<T>(x: T) -> codemap::spanned<T> { - codemap::spanned { node: x, span: dummy_sp() } + fn spanned<T>(x: T) -> codemap::Spanned<T> { + codemap::Spanned { node: x, span: dummy_sp() } } let precursor = @fold::AstFoldFns { diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index a341db75393..906aa619fa3 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -18,7 +18,7 @@ use std::vec; use syntax::ast_util::*; use syntax::attr::AttrMetaMethods; use syntax::attr; -use syntax::codemap::{dummy_sp, span, ExpnInfo, NameAndSpan}; +use syntax::codemap::{dummy_sp, Span, ExpnInfo, NameAndSpan}; use syntax::codemap; use syntax::ext::base::ExtCtxt; use syntax::fold; @@ -29,7 +29,7 @@ use syntax::{ast, ast_util}; type node_id_gen = @fn() -> ast::NodeId; struct Test { - span: span, + span: Span, path: ~[ast::ident], bench: bool, ignore: bool, @@ -379,8 +379,8 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item { return @item; } -fn nospan<T>(t: T) -> codemap::spanned<T> { - codemap::spanned { node: t, span: dummy_sp() } +fn nospan<T>(t: T) -> codemap::Spanned<T> { + codemap::Spanned { node: t, span: dummy_sp() } } fn path_node(ids: ~[ast::ident]) -> ast::Path { diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 942d5f1373d..c463bd9bc03 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -21,7 +21,7 @@ use syntax::ast; use std::vec; use syntax::attr; use syntax::attr::AttrMetaMethods; -use syntax::codemap::{span, dummy_sp}; +use syntax::codemap::{Span, dummy_sp}; use syntax::diagnostic::span_handler; use syntax::parse::token; use syntax::parse::token::ident_interner; @@ -33,7 +33,7 @@ pub fn read_crates(diag: @mut span_handler, crate: &ast::Crate, cstore: @mut cstore::CStore, filesearch: @FileSearch, - os: loader::os, + os: loader::Os, statik: bool, intr: @ident_interner) { let e = @mut Env { @@ -68,7 +68,7 @@ impl visit::Visitor<()> for ReadCrateVisitor { #[deriving(Clone)] struct cache_entry { cnum: int, - span: span, + span: Span, hash: @str, metas: @~[@ast::MetaItem] } @@ -116,7 +116,7 @@ struct Env { diag: @mut span_handler, filesearch: @FileSearch, cstore: @mut cstore::CStore, - os: loader::os, + os: loader::Os, statik: bool, crate_cache: @mut ~[cache_entry], next_crate_num: ast::CrateNum, @@ -252,7 +252,7 @@ fn resolve_crate(e: @mut Env, ident: @str, metas: ~[@ast::MetaItem], hash: @str, - span: span) + span: Span) -> ast::CrateNum { let metas = metas_with_ident(ident, metas); diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index 3ad69ff4da0..198c41539cb 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -52,7 +52,7 @@ pub fn each_lang_item(cstore: @mut cstore::CStore, /// Iterates over each child of the given item. pub fn each_child_of_item(cstore: @mut cstore::CStore, def_id: ast::def_id, - callback: &fn(decoder::def_like, ast::ident)) { + callback: &fn(decoder::DefLike, ast::ident)) { let crate_data = cstore::get_crate_data(cstore, def_id.crate); let get_crate_data: decoder::GetCrateDataCb = |cnum| { cstore::get_crate_data(cstore, cnum) @@ -67,7 +67,7 @@ pub fn each_child_of_item(cstore: @mut cstore::CStore, /// Iterates over each top-level crate item. pub fn each_top_level_item_of_crate(cstore: @mut cstore::CStore, cnum: ast::CrateNum, - callback: &fn(decoder::def_like, + callback: &fn(decoder::DefLike, ast::ident)) { let crate_data = cstore::get_crate_data(cstore, cnum); let get_crate_data: decoder::GetCrateDataCb = |cnum| { diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 215f41f3fd6..592ee1b0a63 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -43,7 +43,7 @@ use syntax::ast; use syntax::codemap; use syntax::parse::token; -type cmd = @crate_metadata; +type Cmd = @crate_metadata; // A function that takes a def_id relative to the crate being searched and // returns a def_id relative to the compilation environment, i.e. if we hit a @@ -74,7 +74,7 @@ fn lookup_hash(d: ebml::Doc, eq_fn: &fn(x:&[u8]) -> bool, hash: u64) -> ret } -pub type GetCrateDataCb<'self> = &'self fn(ast::CrateNum) -> cmd; +pub type GetCrateDataCb<'self> = &'self fn(ast::CrateNum) -> Cmd; pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> { fn eq_item(bytes: &[u8], item_id: int) -> bool { @@ -192,12 +192,12 @@ fn item_reqd_and_translated_parent_item(cnum: ast::CrateNum, ast::def_id { crate: cnum, node: trait_did.node } } -fn item_def_id(d: ebml::Doc, cdata: cmd) -> ast::def_id { +fn item_def_id(d: ebml::Doc, cdata: Cmd) -> ast::def_id { let tagdoc = reader::get_doc(d, tag_def_id); return translate_def_id(cdata, reader::with_doc_data(tagdoc, parse_def_id)); } -fn get_provided_source(d: ebml::Doc, cdata: cmd) -> Option<ast::def_id> { +fn get_provided_source(d: ebml::Doc, cdata: Cmd) -> Option<ast::def_id> { do reader::maybe_get_doc(d, tag_item_method_provided_source).map_move |doc| { translate_def_id(cdata, reader::with_doc_data(doc, parse_def_id)) } @@ -213,13 +213,13 @@ fn variant_disr_val(d: ebml::Doc) -> Option<ty::Disr> { } } -fn doc_type(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::t { +fn doc_type(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::t { let tp = reader::get_doc(doc, tag_items_data_item_type); parse_ty_data(*tp.data, cdata.cnum, tp.start, tcx, |_, did| translate_def_id(cdata, did)) } -fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::BareFnTy { +fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::BareFnTy { let tp = reader::get_doc(doc, tag_item_method_fty); parse_bare_fn_ty_data(*tp.data, cdata.cnum, tp.start, tcx, |_, did| translate_def_id(cdata, did)) @@ -227,7 +227,7 @@ fn doc_method_fty(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::BareFnTy { fn doc_transformed_self_ty(doc: ebml::Doc, tcx: ty::ctxt, - cdata: cmd) -> Option<ty::t> + cdata: Cmd) -> Option<ty::t> { do reader::maybe_get_doc(doc, tag_item_method_transformed_self_ty).map |tp| { parse_ty_data(*tp.data, cdata.cnum, tp.start, tcx, @@ -236,21 +236,21 @@ fn doc_transformed_self_ty(doc: ebml::Doc, } pub fn item_type(_item_id: ast::def_id, item: ebml::Doc, - tcx: ty::ctxt, cdata: cmd) -> ty::t { + tcx: ty::ctxt, cdata: Cmd) -> ty::t { doc_type(item, tcx, cdata) } -fn doc_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::TraitRef { +fn doc_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::TraitRef { parse_trait_ref_data(*doc.data, cdata.cnum, doc.start, tcx, |_, did| translate_def_id(cdata, did)) } -fn item_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: cmd) -> ty::TraitRef { +fn item_trait_ref(doc: ebml::Doc, tcx: ty::ctxt, cdata: Cmd) -> ty::TraitRef { let tp = reader::get_doc(doc, tag_item_trait_ref); doc_trait_ref(tp, tcx, cdata) } -fn item_ty_param_defs(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd, +fn item_ty_param_defs(item: ebml::Doc, tcx: ty::ctxt, cdata: Cmd, tag: uint) -> @~[ty::TypeParameterDef] { let mut bounds = ~[]; @@ -278,7 +278,7 @@ fn item_ty_param_count(item: ebml::Doc) -> uint { n } -fn enum_variant_ids(item: ebml::Doc, cdata: cmd) -> ~[ast::def_id] { +fn enum_variant_ids(item: ebml::Doc, cdata: Cmd) -> ~[ast::def_id] { let mut ids: ~[ast::def_id] = ~[]; let v = tag_items_data_item_variant; do reader::tagged_docs(item, v) |p| { @@ -322,15 +322,15 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident { } fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::CrateNum) - -> def_like { + -> DefLike { let fam = item_family(item); match fam { - ImmStatic => dl_def(ast::def_static(did, false)), - MutStatic => dl_def(ast::def_static(did, true)), - Struct => dl_def(ast::def_struct(did)), - UnsafeFn => dl_def(ast::def_fn(did, ast::unsafe_fn)), - Fn => dl_def(ast::def_fn(did, ast::impure_fn)), - ForeignFn => dl_def(ast::def_fn(did, ast::extern_fn)), + ImmStatic => DlDef(ast::def_static(did, false)), + MutStatic => DlDef(ast::def_static(did, true)), + Struct => DlDef(ast::def_struct(did)), + UnsafeFn => DlDef(ast::def_fn(did, ast::unsafe_fn)), + Fn => DlDef(ast::def_fn(did, ast::impure_fn)), + ForeignFn => DlDef(ast::def_fn(did, ast::extern_fn)), StaticMethod | UnsafeStaticMethod => { let purity = if fam == UnsafeStaticMethod { ast::unsafe_fn } else { ast::impure_fn }; @@ -347,19 +347,19 @@ fn item_to_def_like(item: ebml::Doc, did: ast::def_id, cnum: ast::CrateNum) ast::FromImpl(item_reqd_and_translated_parent_item(cnum, item)) }; - dl_def(ast::def_static_method(did, provenance, purity)) + DlDef(ast::def_static_method(did, provenance, purity)) } - Type | ForeignType => dl_def(ast::def_ty(did)), - Mod => dl_def(ast::def_mod(did)), - ForeignMod => dl_def(ast::def_foreign_mod(did)), + Type | ForeignType => DlDef(ast::def_ty(did)), + Mod => DlDef(ast::def_mod(did)), + ForeignMod => DlDef(ast::def_foreign_mod(did)), Variant => { let enum_did = item_reqd_and_translated_parent_item(cnum, item); - dl_def(ast::def_variant(enum_did, did)) + DlDef(ast::def_variant(enum_did, did)) } - Trait => dl_def(ast::def_trait(did)), - Enum => dl_def(ast::def_ty(did)), - Impl => dl_impl(did), - PublicField | PrivateField | InheritedField => dl_field, + Trait => DlDef(ast::def_trait(did)), + Enum => DlDef(ast::def_ty(did)), + Impl => DlImpl(did), + PublicField | PrivateField | InheritedField => DlField, } } @@ -371,7 +371,7 @@ pub fn lookup_def(cnum: ast::CrateNum, data: @~[u8], did_: ast::def_id) -> return def_like_to_def(item_to_def_like(item, did, cnum)); } -pub fn get_trait_def(cdata: cmd, +pub fn get_trait_def(cdata: Cmd, item_id: ast::NodeId, tcx: ty::ctxt) -> ty::TraitDef { @@ -398,7 +398,7 @@ pub fn get_trait_def(cdata: cmd, } } -pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt) +pub fn get_type(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> ty::ty_param_bounds_and_ty { let item = lookup_item(id, cdata.data); @@ -415,7 +415,7 @@ pub fn get_type(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt) } } -pub fn get_region_param(cdata: cmd, id: ast::NodeId) +pub fn get_region_param(cdata: Cmd, id: ast::NodeId) -> Option<ty::region_variance> { let item = lookup_item(id, cdata.data); @@ -426,7 +426,7 @@ pub fn get_type_param_count(data: @~[u8], id: ast::NodeId) -> uint { item_ty_param_count(lookup_item(id, data)) } -pub fn get_impl_trait(cdata: cmd, +pub fn get_impl_trait(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> Option<@ty::TraitRef> { @@ -436,7 +436,7 @@ pub fn get_impl_trait(cdata: cmd, } } -pub fn get_impl_vtables(cdata: cmd, +pub fn get_impl_vtables(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> typeck::impl_res { @@ -451,7 +451,7 @@ pub fn get_impl_vtables(cdata: cmd, } -pub fn get_impl_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId, +pub fn get_impl_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, name: ast::ident) -> Option<ast::def_id> { let items = reader::get_doc(reader::Doc(cdata.data), tag_items); let mut found = None; @@ -470,22 +470,22 @@ pub fn get_symbol(data: @~[u8], id: ast::NodeId) -> ~str { } // Something that a name can resolve to. -pub enum def_like { - dl_def(ast::def), - dl_impl(ast::def_id), - dl_field +pub enum DefLike { + DlDef(ast::def), + DlImpl(ast::def_id), + DlField } -fn def_like_to_def(def_like: def_like) -> ast::def { +fn def_like_to_def(def_like: DefLike) -> ast::def { match def_like { - dl_def(def) => return def, - dl_impl(*) => fail!("found impl in def_like_to_def"), - dl_field => fail!("found field in def_like_to_def") + DlDef(def) => return def, + DlImpl(*) => fail!("found impl in def_like_to_def"), + DlField => fail!("found field in def_like_to_def") } } /// Iterates over the language items in the given crate. -pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool { +pub fn each_lang_item(cdata: Cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool { let root = reader::Doc(cdata.data); let lang_items = reader::get_doc(root, tag_lang_items); do reader::tagged_docs(lang_items, tag_lang_items_item) |item_doc| { @@ -501,10 +501,10 @@ pub fn each_lang_item(cdata: cmd, f: &fn(ast::NodeId, uint) -> bool) -> bool { struct EachItemContext<'self> { intr: @ident_interner, - cdata: cmd, + cdata: Cmd, get_crate_data: GetCrateDataCb<'self>, path_builder: &'self mut ~str, - callback: &'self fn(&str, def_like, ast::visibility) -> bool, + callback: &'self fn(&str, DefLike, ast::visibility) -> bool, } impl<'self> EachItemContext<'self> { @@ -533,7 +533,7 @@ impl<'self> EachItemContext<'self> { -> bool { let def_like = item_to_def_like(doc, def_id, self.cdata.cnum); match def_like { - dl_def(def) => { + DlDef(def) => { debug!("(iterating over each item of a module) processing \ `%s` (def %?)", *self.path_builder, @@ -703,10 +703,10 @@ impl<'self> EachItemContext<'self> { } fn each_child_of_item_or_crate(intr: @ident_interner, - cdata: cmd, + cdata: Cmd, item_doc: ebml::Doc, get_crate_data: GetCrateDataCb, - callback: &fn(def_like, ast::ident)) { + callback: &fn(DefLike, ast::ident)) { // Iterate over all children. let _ = do reader::tagged_docs(item_doc, tag_mod_child) |child_info_doc| { let child_def_id = reader::with_doc_data(child_info_doc, @@ -826,10 +826,10 @@ fn each_child_of_item_or_crate(intr: @ident_interner, /// Iterates over each child of the given item. pub fn each_child_of_item(intr: @ident_interner, - cdata: cmd, + cdata: Cmd, id: ast::NodeId, get_crate_data: GetCrateDataCb, - callback: &fn(def_like, ast::ident)) { + callback: &fn(DefLike, ast::ident)) { // Find the item. let root_doc = reader::Doc(cdata.data); let items = reader::get_doc(root_doc, tag_items); @@ -847,9 +847,9 @@ pub fn each_child_of_item(intr: @ident_interner, /// Iterates over all the top-level crate items. pub fn each_top_level_item_of_crate(intr: @ident_interner, - cdata: cmd, + cdata: Cmd, get_crate_data: GetCrateDataCb, - callback: &fn(def_like, ast::ident)) { + callback: &fn(DefLike, ast::ident)) { let root_doc = reader::Doc(cdata.data); let misc_info_doc = reader::get_doc(root_doc, tag_misc_info); let crate_items_doc = reader::get_doc(misc_info_doc, @@ -862,7 +862,7 @@ pub fn each_top_level_item_of_crate(intr: @ident_interner, callback) } -pub fn get_item_path(cdata: cmd, id: ast::NodeId) -> ast_map::path { +pub fn get_item_path(cdata: Cmd, id: ast::NodeId) -> ast_map::path { item_path(lookup_item(id, cdata.data)) } @@ -872,7 +872,7 @@ pub type decode_inlined_item<'self> = &'self fn( path: ast_map::path, par_doc: ebml::Doc) -> Option<ast::inlined_item>; -pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt, +pub fn maybe_get_item_ast(cdata: Cmd, tcx: ty::ctxt, id: ast::NodeId, decode_inlined_item: decode_inlined_item) -> csearch::found_ast { @@ -900,7 +900,7 @@ pub fn maybe_get_item_ast(cdata: cmd, tcx: ty::ctxt, } } -pub fn get_enum_variants(intr: @ident_interner, cdata: cmd, id: ast::NodeId, +pub fn get_enum_variants(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> ~[@ty::VariantInfo] { let data = cdata.data; let items = reader::get_doc(reader::Doc(data), tag_items); @@ -964,7 +964,7 @@ fn get_explicit_self(item: ebml::Doc) -> ast::explicit_self_ { } } -fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc, +fn item_impl_methods(intr: @ident_interner, cdata: Cmd, item: ebml::Doc, tcx: ty::ctxt) -> ~[@ty::Method] { let mut rslt = ~[]; do reader::tagged_docs(item, tag_item_impl_method) |doc| { @@ -977,7 +977,7 @@ fn item_impl_methods(intr: @ident_interner, cdata: cmd, item: ebml::Doc, } /// Returns information about the given implementation. -pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId, +pub fn get_impl(intr: @ident_interner, cdata: Cmd, impl_id: ast::NodeId, tcx: ty::ctxt) -> ty::Impl { let data = cdata.data; @@ -994,7 +994,7 @@ pub fn get_impl(intr: @ident_interner, cdata: cmd, impl_id: ast::NodeId, pub fn get_method_name_and_explicit_self( intr: @ident_interner, - cdata: cmd, + cdata: Cmd, id: ast::NodeId) -> (ast::ident, ast::explicit_self_) { let method_doc = lookup_item(id, cdata.data); @@ -1003,7 +1003,7 @@ pub fn get_method_name_and_explicit_self( (name, explicit_self) } -pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId, +pub fn get_method(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> ty::Method { let method_doc = lookup_item(id, cdata.data); @@ -1042,7 +1042,7 @@ pub fn get_method(intr: @ident_interner, cdata: cmd, id: ast::NodeId, ) } -pub fn get_trait_method_def_ids(cdata: cmd, +pub fn get_trait_method_def_ids(cdata: Cmd, id: ast::NodeId) -> ~[ast::def_id] { let data = cdata.data; let item = lookup_item(id, data); @@ -1054,7 +1054,7 @@ pub fn get_trait_method_def_ids(cdata: cmd, result } -pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd, +pub fn get_provided_trait_methods(intr: @ident_interner, cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> ~[@ty::Method] { let data = cdata.data; @@ -1075,7 +1075,7 @@ pub fn get_provided_trait_methods(intr: @ident_interner, cdata: cmd, } /// Returns the supertraits of the given trait. -pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt) +pub fn get_supertraits(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> ~[@ty::TraitRef] { let mut results = ~[]; let item_doc = lookup_item(id, cdata.data); @@ -1092,7 +1092,7 @@ pub fn get_supertraits(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt) return results; } -pub fn get_type_name_if_impl(cdata: cmd, +pub fn get_type_name_if_impl(cdata: Cmd, node_id: ast::NodeId) -> Option<ast::ident> { let item = lookup_item(node_id, cdata.data); if item_family(item) != Impl { @@ -1109,7 +1109,7 @@ pub fn get_type_name_if_impl(cdata: cmd, } pub fn get_static_methods_if_impl(intr: @ident_interner, - cdata: cmd, + cdata: Cmd, node_id: ast::NodeId) -> Option<~[StaticMethodInfo]> { let item = lookup_item(node_id, cdata.data); @@ -1156,7 +1156,7 @@ pub fn get_static_methods_if_impl(intr: @ident_interner, return Some(static_impl_methods); } -pub fn get_item_attrs(cdata: cmd, +pub fn get_item_attrs(cdata: Cmd, node_id: ast::NodeId, f: &fn(~[@ast::MetaItem])) { @@ -1179,7 +1179,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::visibility { } } -pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId) +pub fn get_struct_fields(intr: @ident_interner, cdata: Cmd, id: ast::NodeId) -> ~[ty::field_ty] { let data = cdata.data; let item = lookup_item(id, data); @@ -1209,7 +1209,7 @@ pub fn get_struct_fields(intr: @ident_interner, cdata: cmd, id: ast::NodeId) result } -pub fn get_item_visibility(cdata: cmd, id: ast::NodeId) +pub fn get_item_visibility(cdata: Cmd, id: ast::NodeId) -> ast::visibility { item_visibility(lookup_item(id, cdata.data)) } @@ -1308,7 +1308,7 @@ fn get_attributes(md: ebml::Doc) -> ~[ast::Attribute] { assert_eq!(meta_items.len(), 1u); let meta_item = meta_items[0]; attrs.push( - codemap::spanned { + codemap::Spanned { node: ast::Attribute_ { style: ast::AttrOuter, value: meta_item, @@ -1350,15 +1350,15 @@ pub fn get_crate_attributes(data: @~[u8]) -> ~[ast::Attribute] { } #[deriving(Clone)] -pub struct crate_dep { +pub struct CrateDep { cnum: ast::CrateNum, name: ast::ident, vers: @str, hash: @str } -pub fn get_crate_deps(data: @~[u8]) -> ~[crate_dep] { - let mut deps: ~[crate_dep] = ~[]; +pub fn get_crate_deps(data: @~[u8]) -> ~[CrateDep] { + let mut deps: ~[CrateDep] = ~[]; let cratedoc = reader::Doc(data); let depsdoc = reader::get_doc(cratedoc, tag_crate_deps); let mut crate_num = 1; @@ -1367,7 +1367,7 @@ pub fn get_crate_deps(data: @~[u8]) -> ~[crate_dep] { d.as_str_slice().to_managed() } do reader::tagged_docs(depsdoc, tag_crate_dep) |depdoc| { - deps.push(crate_dep {cnum: crate_num, + deps.push(CrateDep {cnum: crate_num, name: token::str_to_ident(docstr(depdoc, tag_crate_dep_name)), vers: docstr(depdoc, tag_crate_dep_vers), hash: docstr(depdoc, tag_crate_dep_hash)}); @@ -1419,7 +1419,7 @@ pub fn list_crate_metadata(intr: @ident_interner, bytes: @~[u8], // external crates - if those types further refer to types in other crates // then we must translate the crate number from that encoded in the external // crate to the correct local crate number. -pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id { +pub fn translate_def_id(cdata: Cmd, did: ast::def_id) -> ast::def_id { if did.crate == ast::LOCAL_CRATE { return ast::def_id { crate: cdata.cnum, node: did.node }; } @@ -1430,7 +1430,7 @@ pub fn translate_def_id(cdata: cmd, did: ast::def_id) -> ast::def_id { } } -pub fn get_link_args_for_crate(cdata: cmd) -> ~[~str] { +pub fn get_link_args_for_crate(cdata: Cmd) -> ~[~str] { let link_args = reader::get_doc(reader::Doc(cdata.data), tag_link_args); let mut result = ~[]; do reader::tagged_docs(link_args, tag_link_args_arg) |arg_doc| { @@ -1440,7 +1440,7 @@ pub fn get_link_args_for_crate(cdata: cmd) -> ~[~str] { result } -pub fn each_impl(cdata: cmd, callback: &fn(ast::def_id)) { +pub fn each_impl(cdata: Cmd, callback: &fn(ast::def_id)) { let impls_doc = reader::get_doc(reader::Doc(cdata.data), tag_impls); let _ = do reader::tagged_docs(impls_doc, tag_impls_impl) |impl_doc| { callback(item_def_id(impl_doc, cdata)); @@ -1448,7 +1448,7 @@ pub fn each_impl(cdata: cmd, callback: &fn(ast::def_id)) { }; } -pub fn each_implementation_for_type(cdata: cmd, +pub fn each_implementation_for_type(cdata: Cmd, id: ast::NodeId, callback: &fn(ast::def_id)) { let item_doc = lookup_item(id, cdata.data); @@ -1460,7 +1460,7 @@ pub fn each_implementation_for_type(cdata: cmd, }; } -pub fn each_implementation_for_trait(cdata: cmd, +pub fn each_implementation_for_trait(cdata: Cmd, id: ast::NodeId, callback: &fn(ast::def_id)) { let item_doc = lookup_item(id, cdata.data); @@ -1474,7 +1474,7 @@ pub fn each_implementation_for_trait(cdata: cmd, }; } -pub fn get_trait_of_method(cdata: cmd, id: ast::NodeId, tcx: ty::ctxt) +pub fn get_trait_of_method(cdata: Cmd, id: ast::NodeId, tcx: ty::ctxt) -> Option<ast::def_id> { let item_doc = lookup_item(id, cdata.data); let parent_item_id = match item_parent_item(item_doc) { diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index aad9dd33d8d..c6efeaec9b3 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1488,13 +1488,13 @@ fn encode_crate_deps(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, cstore: &cstore::CStore) { fn get_ordered_deps(ecx: &EncodeContext, cstore: &cstore::CStore) - -> ~[decoder::crate_dep] { - type numdep = decoder::crate_dep; + -> ~[decoder::CrateDep] { + type numdep = decoder::CrateDep; // Pull the cnums and name,vers,hash out of cstore let mut deps = ~[]; do cstore::iter_crate_data(cstore) |key, val| { - let dep = decoder::crate_dep {cnum: key, + let dep = decoder::CrateDep {cnum: key, name: ecx.tcx.sess.ident_of(val.name), vers: decoder::get_crate_vers(val.data), hash: decoder::get_crate_hash(val.data)}; @@ -1645,7 +1645,7 @@ fn encode_misc_info(ecx: &EncodeContext, fn encode_crate_dep(ecx: &EncodeContext, ebml_w: &mut writer::Encoder, - dep: decoder::crate_dep) { + dep: decoder::CrateDep) { ebml_w.start_tag(tag_crate_dep); ebml_w.start_tag(tag_crate_dep_name); let s = ecx.tcx.sess.str_of(dep.name); diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index fbf6e3fcff8..b5ba9bb5648 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -16,7 +16,7 @@ use metadata::decoder; use metadata::encoder; use metadata::filesearch::{FileSearch, FileMatch, FileMatches, FileDoesntMatch}; use metadata::filesearch; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::diagnostic::span_handler; use syntax::parse::token::ident_interner; use syntax::print::pprust; @@ -34,22 +34,22 @@ use std::str; use std::vec; use extra::flate; -pub enum os { - os_macos, - os_win32, - os_linux, - os_android, - os_freebsd +pub enum Os { + OsMacos, + OsWin32, + OsLinux, + OsAndroid, + OsFreebsd } pub struct Context { diag: @mut span_handler, filesearch: @FileSearch, - span: span, + span: Span, ident: @str, metas: ~[@ast::MetaItem], hash: @str, - os: os, + os: Os, is_static: bool, intr: @ident_interner } @@ -73,11 +73,11 @@ fn find_library_crate(cx: &Context) -> Option<(~str, @~[u8])> { fn libname(cx: &Context) -> (~str, ~str) { if cx.is_static { return (~"lib", ~".rlib"); } let (dll_prefix, dll_suffix) = match cx.os { - os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX), - os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX), - os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX), - os_android => (android::DLL_PREFIX, android::DLL_SUFFIX), - os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX), + OsWin32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX), + OsMacos => (macos::DLL_PREFIX, macos::DLL_SUFFIX), + OsLinux => (linux::DLL_PREFIX, linux::DLL_SUFFIX), + OsAndroid => (android::DLL_PREFIX, android::DLL_SUFFIX), + OsFreebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX), }; (dll_prefix.to_owned(), dll_suffix.to_owned()) @@ -196,7 +196,7 @@ pub fn metadata_matches(extern_metas: &[@ast::MetaItem], } } -fn get_metadata_section(os: os, +fn get_metadata_section(os: Os, filename: &Path) -> Option<@~[u8]> { unsafe { let mb = do filename.with_c_str |buf| { @@ -212,7 +212,7 @@ fn get_metadata_section(os: os, let name_buf = llvm::LLVMGetSectionName(si.llsi); let name = str::raw::from_c_str(name_buf); debug!("get_metadata_section: name %s", name); - if name == read_meta_section_name(os) { + if read_meta_section_name(os) == name { let cbuf = llvm::LLVMGetSectionContents(si.llsi); let csz = llvm::LLVMGetSectionSize(si.llsi) as uint; let mut found = None; @@ -245,29 +245,29 @@ fn get_metadata_section(os: os, } } -pub fn meta_section_name(os: os) -> ~str { +pub fn meta_section_name(os: Os) -> &'static str { match os { - os_macos => ~"__DATA,__note.rustc", - os_win32 => ~".note.rustc", - os_linux => ~".note.rustc", - os_android => ~".note.rustc", - os_freebsd => ~".note.rustc" + OsMacos => "__DATA,__note.rustc", + OsWin32 => ".note.rustc", + OsLinux => ".note.rustc", + OsAndroid => ".note.rustc", + OsFreebsd => ".note.rustc" } } -pub fn read_meta_section_name(os: os) -> ~str { +pub fn read_meta_section_name(os: Os) -> &'static str { match os { - os_macos => ~"__note.rustc", - os_win32 => ~".note.rustc", - os_linux => ~".note.rustc", - os_android => ~".note.rustc", - os_freebsd => ~".note.rustc" + OsMacos => "__note.rustc", + OsWin32 => ".note.rustc", + OsLinux => ".note.rustc", + OsAndroid => ".note.rustc", + OsFreebsd => ".note.rustc" } } // A diagnostic function for dumping crate metadata to an output stream pub fn list_file_metadata(intr: @ident_interner, - os: os, + os: Os, path: &Path, out: @io::Writer) { match get_metadata_section(os, path) { diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index d6b22381192..e38ac4feb9c 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -33,7 +33,7 @@ use syntax::ast; use syntax::ast_map; use syntax::ast_util::inlined_item_utils; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::codemap; use syntax::fold::*; use syntax::fold; @@ -214,7 +214,7 @@ impl ExtendedDecodeContext { assert_eq!(did.crate, ast::LOCAL_CRATE); ast::def_id { crate: ast::LOCAL_CRATE, node: self.tr_id(did.node) } } - pub fn tr_span(&self, _span: span) -> span { + pub fn tr_span(&self, _span: Span) -> Span { codemap::dummy_sp() // FIXME (#1972): handle span properly } } @@ -231,8 +231,8 @@ impl tr for ast::def_id { } } -impl tr for span { - fn tr(&self, xcx: @ExtendedDecodeContext) -> span { +impl tr for Span { + fn tr(&self, xcx: @ExtendedDecodeContext) -> Span { xcx.tr_span(*self) } } @@ -302,9 +302,9 @@ fn simplify_ast(ii: &ast::inlined_item) -> ast::inlined_item { let stmts_sans_items = do blk.stmts.iter().filter_map |stmt| { match stmt.node { ast::stmt_expr(_, _) | ast::stmt_semi(_, _) | - ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_), span: _}, _) + ast::stmt_decl(@codemap::Spanned { node: ast::decl_local(_), span: _}, _) => Some(*stmt), - ast::stmt_decl(@codemap::spanned { node: ast::decl_item(_), span: _}, _) + ast::stmt_decl(@codemap::Spanned { node: ast::decl_item(_), span: _}, _) => None, ast::stmt_mac(*) => fail!("unexpanded macro in astencode") } @@ -1255,7 +1255,7 @@ fn decode_item_ast(par_doc: ebml::Doc) -> @ast::item { trait fake_ext_ctxt { fn cfg(&self) -> ast::CrateConfig; fn parse_sess(&self) -> @mut parse::ParseSess; - fn call_site(&self) -> span; + fn call_site(&self) -> Span; fn ident_of(&self, st: &str) -> ast::ident; } @@ -1266,8 +1266,8 @@ type fake_session = @mut parse::ParseSess; impl fake_ext_ctxt for fake_session { fn cfg(&self) -> ast::CrateConfig { ~[] } fn parse_sess(&self) -> @mut parse::ParseSess { *self } - fn call_site(&self) -> span { - codemap::span { + fn call_site(&self) -> Span { + codemap::Span { lo: codemap::BytePos(0), hi: codemap::BytePos(0), expn_info: None diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 485a0aefe98..029080ed265 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -26,7 +26,7 @@ use middle::ty; use syntax::ast::{m_imm, m_mutbl}; use syntax::ast; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::visit::Visitor; use syntax::visit; use util::ppaux::Repr; @@ -56,7 +56,7 @@ impl<'self> Visitor<CheckLoanCtxt<'self>> for CheckLoanVisitor { check_loans_in_pat(self, p, e); } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:CheckLoanCtxt) { + b:&ast::Block, s:Span, n:ast::NodeId, e:CheckLoanCtxt) { check_loans_in_fn(self, fk, fd, b, s, n, e); } } @@ -82,7 +82,7 @@ pub fn check_loans(bccx: @BorrowckCtxt, enum MoveError { MoveOk, - MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/span) + MoveWhileBorrowed(/*loan*/@LoanPath, /*loan*/Span) } impl<'self> CheckLoanCtxt<'self> { @@ -107,7 +107,7 @@ impl<'self> CheckLoanCtxt<'self> { } } - fn check_captured_variables(&self, closure_id: ast::NodeId, span: span) { + fn check_captured_variables(&self, closure_id: ast::NodeId, span: Span) { let cap_vars = self.bccx.capture_map.get(&closure_id); for cap_var in cap_vars.iter() { let var_id = ast_util::def_id_of_def(cap_var.def).node; @@ -311,7 +311,7 @@ impl<'self> CheckLoanCtxt<'self> { pub fn check_if_path_is_moved(&self, id: ast::NodeId, - span: span, + span: Span, use_kind: MovedValueUseKind, lp: @LoanPath) { /*! @@ -669,7 +669,7 @@ impl<'self> CheckLoanCtxt<'self> { } } - fn check_move_out_from_id(&self, id: ast::NodeId, span: span) { + fn check_move_out_from_id(&self, id: ast::NodeId, span: Span) { do self.move_data.each_path_moved_by(id) |_, move_path| { match self.analyze_move_out_from(id, move_path) { MoveOk => {} @@ -713,7 +713,7 @@ impl<'self> CheckLoanCtxt<'self> { _expr: @ast::expr, _callee: Option<@ast::expr>, _callee_id: ast::NodeId, - _callee_span: span, + _callee_span: Span, _args: &[@ast::expr]) { // NB: This call to check for conflicting loans is not truly // necessary, because the callee_id never issues new loans. @@ -729,7 +729,7 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor, fk: &visit::fn_kind, decl: &ast::fn_decl, body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, this: CheckLoanCtxt<'a>) { match *fk { @@ -749,7 +749,7 @@ fn check_loans_in_fn<'a>(visitor: &mut CheckLoanVisitor, fn check_captured_variables(this: CheckLoanCtxt, closure_id: ast::NodeId, - span: span) { + span: Span) { let cap_vars = this.bccx.capture_map.get(&closure_id); for cap_var in cap_vars.iter() { let var_id = ast_util::def_id_of_def(cap_var.def).node; diff --git a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs index d6f9d1db7df..c25655803a4 100644 --- a/src/librustc/middle/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc/middle/borrowck/gather_loans/gather_moves.rs @@ -19,13 +19,13 @@ use middle::moves; use middle::ty; use syntax::ast; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use util::ppaux::{UserString}; pub fn gather_decl(bccx: @BorrowckCtxt, move_data: &mut MoveData, decl_id: ast::NodeId, - _decl_span: span, + _decl_span: Span, var_id: ast::NodeId) { let loan_path = @LpVar(var_id); move_data.add_move(bccx.tcx, loan_path, decl_id, Declared); @@ -86,7 +86,7 @@ pub fn gather_captures(bccx: @BorrowckCtxt, pub fn gather_assignment(bccx: @BorrowckCtxt, move_data: &mut MoveData, assignment_id: ast::NodeId, - assignment_span: span, + assignment_span: Span, assignee_loan_path: @LoanPath, assignee_id: ast::NodeId) { move_data.add_assignment(bccx.tcx, diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs index e76d11c269b..1776e041c83 100644 --- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs +++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs @@ -17,13 +17,13 @@ use mc = middle::mem_categorization; use middle::ty; use syntax::ast::{m_imm, m_mutbl}; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use util::ppaux::{note_and_explain_region}; pub fn guarantee_lifetime(bccx: @BorrowckCtxt, item_scope_id: ast::NodeId, root_scope_id: ast::NodeId, - span: span, + span: Span, cmt: mc::cmt, loan_region: ty::Region, loan_mutbl: LoanMutability) { @@ -52,7 +52,7 @@ struct GuaranteeLifetimeContext { // longest scope for which we can root managed boxes root_scope_id: ast::NodeId, - span: span, + span: Span, loan_region: ty::Region, loan_mutbl: LoanMutability, cmt_original: mc::cmt diff --git a/src/librustc/middle/borrowck/gather_loans/mod.rs b/src/librustc/middle/borrowck/gather_loans/mod.rs index dbe5214e0eb..43bb278c949 100644 --- a/src/librustc/middle/borrowck/gather_loans/mod.rs +++ b/src/librustc/middle/borrowck/gather_loans/mod.rs @@ -28,7 +28,7 @@ use util::ppaux::{Repr}; use syntax::ast; use syntax::ast_util::id_range; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust; use syntax::visit; use syntax::visit::Visitor; @@ -83,7 +83,7 @@ impl visit::Visitor<@mut GatherLoanCtxt> for GatherLoanVisitor { gather_loans_in_block(self, b, e); } fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, - s:span, n:NodeId, e:@mut GatherLoanCtxt) { + s:Span, n:NodeId, e:@mut GatherLoanCtxt) { gather_loans_in_fn(self, fk, fd, b, s, n, e); } fn visit_stmt(&mut self, s:@stmt, e:@mut GatherLoanCtxt) { @@ -131,7 +131,7 @@ fn gather_loans_in_fn(v: &mut GatherLoanVisitor, fk: &fn_kind, decl: &ast::fn_decl, body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, this: @mut GatherLoanCtxt) { match fk { @@ -413,7 +413,7 @@ impl GatherLoanCtxt { // dynamically that they are not freed. pub fn guarantee_valid(&mut self, borrow_id: ast::NodeId, - borrow_span: span, + borrow_span: Span, cmt: mc::cmt, req_mutbl: LoanMutability, loan_region: ty::Region) { @@ -538,7 +538,7 @@ impl GatherLoanCtxt { // } fn check_mutability(bccx: @BorrowckCtxt, - borrow_span: span, + borrow_span: Span, cmt: mc::cmt, req_mutbl: LoanMutability) { //! Implements the M-* rules in doc.rs. diff --git a/src/librustc/middle/borrowck/gather_loans/restrictions.rs b/src/librustc/middle/borrowck/gather_loans/restrictions.rs index 26c2cff189c..33b90cbe573 100644 --- a/src/librustc/middle/borrowck/gather_loans/restrictions.rs +++ b/src/librustc/middle/borrowck/gather_loans/restrictions.rs @@ -16,7 +16,7 @@ use middle::borrowck::*; use mc = middle::mem_categorization; use middle::ty; use syntax::ast::{m_imm, m_mutbl}; -use syntax::codemap::span; +use syntax::codemap::Span; pub enum RestrictionResult { Safe, @@ -24,7 +24,7 @@ pub enum RestrictionResult { } pub fn compute_restrictions(bccx: @BorrowckCtxt, - span: span, + span: Span, cmt: mc::cmt, restr: RestrictionSet) -> RestrictionResult { let ctxt = RestrictionsContext { @@ -41,7 +41,7 @@ pub fn compute_restrictions(bccx: @BorrowckCtxt, struct RestrictionsContext { bccx: @BorrowckCtxt, - span: span, + span: Span, cmt_original: mc::cmt } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 7113af3fbc2..0c182286b06 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -26,7 +26,7 @@ use std::ops::{BitOr, BitAnd}; use std::result::{Result}; use syntax::ast; use syntax::ast_map; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token; use syntax::visit; use syntax::visit::{Visitor,fn_kind}; @@ -65,7 +65,7 @@ struct BorrowckVisitor; impl Visitor<@BorrowckCtxt> for BorrowckVisitor { fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, - b:&Block, s:span, n:NodeId, e:@BorrowckCtxt) { + b:&Block, s:Span, n:NodeId, e:@BorrowckCtxt) { borrowck_fn(self, fk, fd, b, s, n, e); } } @@ -127,7 +127,7 @@ fn borrowck_fn(v: &mut BorrowckVisitor, fk: &visit::fn_kind, decl: &ast::fn_decl, body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, this: @BorrowckCtxt) { match fk { @@ -277,7 +277,7 @@ pub struct Loan { restrictions: ~[Restriction], gen_scope: ast::NodeId, kill_scope: ast::NodeId, - span: span, + span: Span, } #[deriving(Eq, IterBytes)] @@ -454,7 +454,7 @@ pub enum bckerr_code { // that caused it #[deriving(Eq)] pub struct BckError { - span: span, + span: Span, cmt: mc::cmt, code: bckerr_code } @@ -516,7 +516,7 @@ impl BorrowckCtxt { pub fn cat_def(&self, id: ast::NodeId, - span: span, + span: Span, ty: ty::t, def: ast::def) -> mc::cmt { @@ -550,7 +550,7 @@ impl BorrowckCtxt { } pub fn report_use_of_moved_value(&self, - use_span: span, + use_span: Span, use_kind: MovedValueUseKind, lp: &LoanPath, move: &move_data::Move, @@ -631,7 +631,7 @@ impl BorrowckCtxt { } pub fn report_reassigned_immutable_variable(&self, - span: span, + span: Span, lp: &LoanPath, assign: &move_data::Assignment) { @@ -644,11 +644,11 @@ impl BorrowckCtxt { fmt!("prior assignment occurs here")); } - pub fn span_err(&self, s: span, m: &str) { + pub fn span_err(&self, s: Span, m: &str) { self.tcx.sess.span_err(s, m); } - pub fn span_note(&self, s: span, m: &str) { + pub fn span_note(&self, s: Span, m: &str) { self.tcx.sess.span_note(s, m); } @@ -677,7 +677,7 @@ impl BorrowckCtxt { } pub fn report_aliasability_violation(&self, - span: span, + span: Span, kind: AliasableViolationKind, cause: mc::AliasableReason) { let prefix = match kind { diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 164139ad733..353a06a759e 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -25,7 +25,7 @@ use middle::ty; use middle::typeck; use syntax::ast; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::opt_vec::OptVec; use syntax::opt_vec; use util::ppaux::Repr; @@ -135,7 +135,7 @@ pub struct Assignment { id: ast::NodeId, /// span of node where assignment occurs - span: span, + span: Span, } pub struct MoveDataFlowOperator; @@ -327,7 +327,7 @@ impl MoveData { tcx: ty::ctxt, lp: @LoanPath, assign_id: ast::NodeId, - span: span, + span: Span, assignee_id: ast::NodeId) { /*! * Adds a new record for an assignment to `lp` that occurs at diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index fc779f73060..6a4570474f0 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -85,7 +85,7 @@ pub fn check_pat(v: &mut CheckCrateVisitor, p: @pat, _is_const: bool) { fn is_str(e: @expr) -> bool { match e.node { expr_vstore( - @expr { node: expr_lit(@codemap::spanned { + @expr { node: expr_lit(@codemap::Spanned { node: lit_str(_), _}), _ }, @@ -120,7 +120,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor, "disallowed operator in constant expression"); return; } - expr_lit(@codemap::spanned {node: lit_str(_), _}) => { } + expr_lit(@codemap::Spanned {node: lit_str(_), _}) => { } expr_binary(*) | expr_unary(*) => { if method_map.contains_key(&e.id) { sess.span_err(e.span, "user-defined operators are not \ @@ -200,7 +200,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor, } } match e.node { - expr_lit(@codemap::spanned {node: lit_int(v, t), _}) => { + expr_lit(@codemap::Spanned {node: lit_int(v, t), _}) => { if t != ty_char { if (v as u64) > ast_util::int_ty_max( if t == ty_i { sess.targ_cfg.int_type } else { t }) { @@ -208,7 +208,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor, } } } - expr_lit(@codemap::spanned {node: lit_uint(v, t), _}) => { + expr_lit(@codemap::Spanned {node: lit_uint(v, t), _}) => { if v > ast_util::uint_ty_max( if t == ty_u { sess.targ_cfg.uint_type } else { t }) { sess.span_err(e.span, "literal out of range for its type"); diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 3f321fcfcd2..1996f845914 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -24,7 +24,7 @@ use std::vec; use extra::sort; use syntax::ast::*; use syntax::ast_util::{unguarded_pat, walk_pat}; -use syntax::codemap::{span, dummy_sp, spanned}; +use syntax::codemap::{Span, dummy_sp, Spanned}; use syntax::visit; use syntax::visit::{Visitor,fn_kind}; @@ -45,7 +45,7 @@ impl Visitor<()> for CheckMatchVisitor { fn visit_local(&mut self, l:@Local, e:()) { check_local(self, self.cx, l, e); } - fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:()) { + fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:()) { check_fn(self, self.cx, fk, fd, b, s, n, e); } } @@ -160,7 +160,7 @@ pub fn raw_pat(p: @pat) -> @pat { } } -pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: span, pats: ~[@pat]) { +pub fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: ~[@pat]) { assert!((!pats.is_empty())); let ext = match is_useful(cx, &pats.map(|p| ~[*p]), [wild()]) { not_useful => { @@ -821,7 +821,7 @@ pub fn check_fn(v: &mut CheckMatchVisitor, kind: &visit::fn_kind, decl: &fn_decl, body: &Block, - sp: span, + sp: Span, id: NodeId, s: ()) { visit::walk_fn(v, kind, decl, body, sp, id, s); @@ -850,7 +850,7 @@ pub fn is_refutable(cx: &MatchCheckCtxt, pat: &pat) -> bool { is_refutable(cx, sub) } pat_wild | pat_ident(_, _, None) => { false } - pat_lit(@expr {node: expr_lit(@spanned { node: lit_nil, _}), _}) => { + pat_lit(@expr {node: expr_lit(@Spanned { node: lit_nil, _}), _}) => { // "()" false } diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index de0be2a0bc5..825f53c9e42 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -19,7 +19,7 @@ use util::ppaux; use syntax::ast::{deref, expr_call, expr_inline_asm, expr_method_call}; use syntax::ast::{expr_unary, unsafe_fn, expr_path}; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::visit::{fk_item_fn, fk_method}; use syntax::visit; use syntax::visit::{Visitor,fn_kind}; @@ -53,7 +53,7 @@ struct EffectCheckVisitor { } impl EffectCheckVisitor { - fn require_unsafe(&mut self, span: span, description: &str) { + fn require_unsafe(&mut self, span: Span, description: &str) { match self.context.unsafe_context { SafeContext => { // Report an error. @@ -73,7 +73,7 @@ impl EffectCheckVisitor { impl Visitor<()> for EffectCheckVisitor { fn visit_fn(&mut self, fn_kind:&fn_kind, fn_decl:&fn_decl, - block:&Block, span:span, node_id:NodeId, _:()) { + block:&Block, span:Span, node_id:NodeId, _:()) { let (is_item_fn, is_unsafe_fn) = match *fn_kind { fk_item_fn(_, _, purity, _) => (true, purity == unsafe_fn), diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index e6830a1f64e..8aa4584e042 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -14,7 +14,7 @@ use driver::session::Session; use syntax::ast::{Crate, NodeId, item, item_fn}; use syntax::ast_map; use syntax::attr; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token::special_idents; use syntax::visit; use syntax::visit::Visitor; @@ -26,17 +26,17 @@ struct EntryContext { ast_map: ast_map::map, // The top-level function called 'main' - main_fn: Option<(NodeId, span)>, + main_fn: Option<(NodeId, Span)>, // The function that has attribute named 'main' - attr_main_fn: Option<(NodeId, span)>, + attr_main_fn: Option<(NodeId, Span)>, // The function that has the attribute 'start' on it - start_fn: Option<(NodeId, span)>, + start_fn: Option<(NodeId, Span)>, // The functions that one might think are 'main' but aren't, e.g. // main functions not defined at the top level. For diagnostics. - non_main_fns: ~[(NodeId, span)], + non_main_fns: ~[(NodeId, Span)], } struct EntryVisitor; @@ -51,7 +51,7 @@ pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) // FIXME #4404 android JNI hacks if *session.building_library && - session.targ_cfg.os != session::os_android { + session.targ_cfg.os != session::OsAndroid { // No need to find a main function return; } @@ -157,7 +157,7 @@ fn configure_main(ctxt: @mut EntryContext) { } else { // If we *are* building a library, then we're on android where we still might // optionally want to translate main $4404 - assert_eq!(this.session.targ_cfg.os, session::os_android); + assert_eq!(this.session.targ_cfg.os, session::OsAndroid); } } } diff --git a/src/librustc/middle/freevars.rs b/src/librustc/middle/freevars.rs index c6446955cc8..0968ebc22df 100644 --- a/src/librustc/middle/freevars.rs +++ b/src/librustc/middle/freevars.rs @@ -16,7 +16,7 @@ use middle::resolve; use middle::ty; use std::hashmap::HashMap; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::{ast, ast_util}; use syntax::visit; use syntax::visit::Visitor; @@ -27,7 +27,7 @@ use syntax::ast::{item}; #[deriving(Encodable, Decodable)] pub struct freevar_entry { def: ast::def, //< The variable being accessed free. - span: span //< First span where it is accessed (there can be multiple) + span: Span //< First span where it is accessed (there can be multiple) } pub type freevar_info = @~[@freevar_entry]; pub type freevar_map = @mut HashMap<ast::NodeId, freevar_info>; @@ -110,7 +110,7 @@ struct AnnotateFreevarsVisitor { impl Visitor<()> for AnnotateFreevarsVisitor { fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - blk:&ast::Block, s:span, nid:ast::NodeId, _:()) { + blk:&ast::Block, s:Span, nid:ast::NodeId, _:()) { let vars = collect_freevars(self.def_map, blk); self.freevars.insert(nid, vars); visit::walk_fn(self, fk, fd, blk, s, nid, ()); diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 2daa2bafaac..0beb3d25064 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -18,7 +18,7 @@ use util::ppaux::UserString; use syntax::ast::*; use syntax::attr; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::opt_vec; use syntax::print::pprust::expr_to_str; use syntax::{visit,ast_util}; @@ -65,7 +65,7 @@ impl Visitor<Context> for KindAnalysisVisitor { check_expr(self, ex, e); } - fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:Context) { + fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:Context) { check_fn(self, fk, fd, b, s, n, e); } @@ -91,7 +91,7 @@ pub fn check_crate(tcx: ty::ctxt, } fn check_struct_safe_for_destructor(cx: Context, - span: span, + span: Span, struct_did: def_id) { let struct_tpt = ty::lookup_item_type(cx.tcx, struct_did); if !struct_tpt.generics.has_type_params() { @@ -245,7 +245,7 @@ fn check_fn( fk: &visit::fn_kind, decl: &fn_decl, body: &Block, - sp: span, + sp: Span, fn_id: NodeId, cx: Context) { @@ -364,7 +364,7 @@ pub fn check_builtin_bounds(cx: Context, ty: ty::t, bounds: ty::BuiltinBounds, pub fn check_typaram_bounds(cx: Context, _type_parameter_id: NodeId, - sp: span, + sp: Span, ty: ty::t, type_param_def: &ty::TypeParameterDef) { @@ -378,7 +378,7 @@ pub fn check_typaram_bounds(cx: Context, } } -pub fn check_freevar_bounds(cx: Context, sp: span, ty: ty::t, +pub fn check_freevar_bounds(cx: Context, sp: Span, ty: ty::t, bounds: ty::BuiltinBounds, referenced_ty: Option<ty::t>) { do check_builtin_bounds(cx, ty, bounds) |missing| { @@ -401,7 +401,7 @@ pub fn check_freevar_bounds(cx: Context, sp: span, ty: ty::t, } } -pub fn check_trait_cast_bounds(cx: Context, sp: span, ty: ty::t, +pub fn check_trait_cast_bounds(cx: Context, sp: Span, ty: ty::t, bounds: ty::BuiltinBounds) { do check_builtin_bounds(cx, ty, bounds) |missing| { cx.tcx.sess.span_err(sp, @@ -426,7 +426,7 @@ fn is_nullary_variant(cx: Context, ex: @expr) -> bool { } } -fn check_imm_free_var(cx: Context, def: def, sp: span) { +fn check_imm_free_var(cx: Context, def: def, sp: Span) { match def { def_local(_, is_mutbl) => { if is_mutbl { @@ -446,7 +446,7 @@ fn check_imm_free_var(cx: Context, def: def, sp: span) { } } -fn check_copy(cx: Context, ty: ty::t, sp: span, reason: &str) { +fn check_copy(cx: Context, ty: ty::t, sp: Span, reason: &str) { debug!("type_contents(%s)=%s", ty_to_str(cx.tcx, ty), ty::type_contents(cx.tcx, ty).to_str()); @@ -458,7 +458,7 @@ fn check_copy(cx: Context, ty: ty::t, sp: span, reason: &str) { } } -pub fn check_send(cx: Context, ty: ty::t, sp: span) -> bool { +pub fn check_send(cx: Context, ty: ty::t, sp: Span) -> bool { if !ty::type_is_sendable(cx.tcx, ty) { cx.tcx.sess.span_err( sp, fmt!("value has non-sendable type `%s`", @@ -470,7 +470,7 @@ pub fn check_send(cx: Context, ty: ty::t, sp: span) -> bool { } // note: also used from middle::typeck::regionck! -pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: span) -> bool { +pub fn check_durable(tcx: ty::ctxt, ty: ty::t, sp: Span) -> bool { if !ty::type_is_static(tcx, ty) { match ty::get(ty).sty { ty::ty_param(*) => { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 5a2e3a4b760..d60781dcc09 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -28,7 +28,7 @@ use extra::smallintmap::SmallIntMap; use syntax::ast_map; use syntax::attr; use syntax::attr::AttrMetaMethods; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::codemap; use syntax::parse::token; use syntax::{ast, ast_util, visit}; @@ -135,7 +135,7 @@ enum AttributedNode<'self> { #[deriving(Eq)] enum LintSource { - Node(span), + Node(Span), Default, CommandLine } @@ -304,7 +304,7 @@ pub fn get_lint_dict() -> LintDict { trait OuterLint { fn process_item(@mut self, i:@ast::item, e:@mut Context); fn process_fn(@mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context); + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context); // Returned inner variant will not proceed past subitems. // Supports decomposition of simple lints into subitem-traversing @@ -319,7 +319,7 @@ trait InnerLint { function_kind: &visit::fn_kind, function_declaration: &ast::fn_decl, function_body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, env: @mut Context); } @@ -332,7 +332,7 @@ impl<V:Visitor<@mut Context>> InnerLint for V { visit::walk_crate(self, crate, env); } fn descend_fn(@mut self, fk: &visit::fn_kind, fd: &ast::fn_decl, fb: &ast::Block, - sp: span, id: ast::NodeId, env: @mut Context) { + sp: Span, id: ast::NodeId, env: @mut Context) { visit::walk_fn(self, fk, fd, fb, sp, id, env); } } @@ -409,7 +409,7 @@ impl Context { fail!("unregistered lint %?", lint); } - fn span_lint(&self, lint: lint, span: span, msg: &str) { + fn span_lint(&self, lint: lint, span: Span, msg: &str) { let (level, src) = match self.curr.find(&(lint as uint)) { None => { return } Some(&(warn, src)) => (self.get_level(warnings), src), @@ -617,7 +617,7 @@ trait SubitemStoppableVisitor : Visitor<@mut Context> { } fn visit_fn_action(&mut self, _fk:&visit::fn_kind, _fd:&ast::fn_decl, - _b:&ast::Block, _s:span, _n:ast::NodeId, _e:@mut Context) { + _b:&ast::Block, _s:Span, _n:ast::NodeId, _e:@mut Context) { // fill in with particular action without recursion if desired } @@ -641,7 +641,7 @@ trait SubitemStoppableVisitor : Visitor<@mut Context> { } fn OVERRIDE_visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { if self.is_running_on_items() { self.visit_fn_action(fk, fd, b, s, n, e); visit::walk_fn(self, fk, fd, b, s, n, e); @@ -670,7 +670,7 @@ impl Visitor<@mut Context> for WhileTrueLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -679,7 +679,7 @@ impl Visitor<@mut Context> for WhileTrueLintVisitor { match e.node { ast::expr_while(cond, _) => { match cond.node { - ast::expr_lit(@codemap::spanned { + ast::expr_lit(@codemap::Spanned { node: ast::lit_bool(true), _}) => { cx.span_lint(while_true, e.span, @@ -703,7 +703,7 @@ macro_rules! outer_lint_boilerplate_impl( self.visit_item_action(i, e); } fn process_fn(@mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.visit_fn_action(fk, fd, b, s, n, e); } fn inner_variant(@mut self) -> @mut InnerLint { @@ -834,7 +834,7 @@ impl Visitor<@mut Context> for TypeLimitsLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -905,7 +905,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) { } } -fn check_type_for_lint(cx: &Context, lint: lint, span: span, ty: ty::t) { +fn check_type_for_lint(cx: &Context, lint: lint, span: Span, ty: ty::t) { if cx.get_level(lint) == allow { return } let mut n_box = 0; @@ -932,7 +932,7 @@ fn check_type_for_lint(cx: &Context, lint: lint, span: span, ty: ty::t) { } } -fn check_type(cx: &Context, span: span, ty: ty::t) { +fn check_type(cx: &Context, span: Span, ty: ty::t) { let xs = [managed_heap_memory, owned_heap_memory, heap_memory]; for lint in xs.iter() { check_type_for_lint(cx, *lint, span, ty); @@ -975,7 +975,7 @@ impl Visitor<@mut Context> for HeapLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1006,7 +1006,7 @@ impl Visitor<@mut Context> for PathStatementLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1044,7 +1044,7 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) { !ident.contains_char('_') } - fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: span) { + fn check_case(cx: &Context, sort: &str, ident: ast::ident, span: Span) { if !is_camel_case(cx.tcx, ident) { cx.span_lint( non_camel_case_types, span, @@ -1099,7 +1099,7 @@ impl Visitor<@mut Context> for UnusedUnsafeLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1157,7 +1157,7 @@ impl SubitemStoppableVisitor for UnusedMutLintVisitor { fn is_running_on_items(&mut self) -> bool { !self.stopping_on_items } fn visit_fn_action(&mut self, _a:&visit::fn_kind, fd:&ast::fn_decl, - _b:&ast::Block, _c:span, _d:ast::NodeId, cx:@mut Context) { + _b:&ast::Block, _c:Span, _d:ast::NodeId, cx:@mut Context) { self.visit_fn_decl(cx, fd); } } @@ -1168,7 +1168,7 @@ impl Visitor<@mut Context> for UnusedMutLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1225,7 +1225,7 @@ impl Visitor<@mut Context> for UnnecessaryAllocationLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1243,7 +1243,7 @@ impl UnnecessaryAllocationLintVisitor { ast::expr_vstore(e2, ast::expr_vstore_uniq) | ast::expr_vstore(e2, ast::expr_vstore_box) => { match e2.node { - ast::expr_lit(@codemap::spanned{ + ast::expr_lit(@codemap::Spanned{ node: ast::lit_str(*), _}) | ast::expr_vec(*) => {} _ => return @@ -1278,7 +1278,7 @@ impl MissingDocLintVisitor { fn check_attrs(&mut self, cx: @mut Context, attrs: &[ast::Attribute], - sp: span, + sp: Span, msg: &str) { // If we're building a test harness, then warning about documentation is // probably not really relevant right now @@ -1299,7 +1299,7 @@ impl Visitor<@mut Context> for MissingDocLintVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:@mut Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:@mut Context) { self.OVERRIDE_visit_fn(fk, fd, b, s, n, e); } @@ -1316,7 +1316,7 @@ impl SubitemStoppableVisitor for MissingDocLintVisitor { fn is_running_on_items(&mut self) -> bool { !self.stopping_on_items } fn visit_fn_action(&mut self, fk:&visit::fn_kind, _d:&ast::fn_decl, - _b:&ast::Block, sp:span, _id:ast::NodeId, cx:@mut Context) { + _b:&ast::Block, sp:Span, _id:ast::NodeId, cx:@mut Context) { // Only warn about explicitly public methods. Soon implicit // public-ness will hopefully be going away. @@ -1400,7 +1400,7 @@ impl Visitor<@mut Context> for LintCheckVisitor { } fn visit_fn(&mut self, fk:&visit::fn_kind, decl:&ast::fn_decl, - body:&ast::Block, span:span, id:ast::NodeId, cx:@mut Context) { + body:&ast::Block, span:Span, id:ast::NodeId, cx:@mut Context) { match *fk { visit::fk_method(_, _, m) => { diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index a18fffda32e..b79f6299e26 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -116,7 +116,7 @@ use std::to_str; use std::uint; use std::vec; use syntax::ast::*; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token::special_idents; use syntax::print::pprust::{expr_to_str, block_to_str}; use syntax::{visit, ast_util}; @@ -135,9 +135,9 @@ impl Clone for LiveNode { #[deriving(Eq)] enum LiveNodeKind { - FreeVarNode(span), - ExprNode(span), - VarDefNode(span), + FreeVarNode(Span), + ExprNode(Span), + VarDefNode(Span), ExitNode } @@ -154,7 +154,7 @@ fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str { struct LivenessVisitor; impl Visitor<@mut IrMaps> for LivenessVisitor { - fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:@mut IrMaps) { + fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:@mut IrMaps) { visit_fn(self, fk, fd, b, s, n, e); } fn visit_local(&mut self, l:@Local, e:@mut IrMaps) { visit_local(self, l, e); } @@ -308,7 +308,7 @@ impl IrMaps { v } - pub fn variable(&mut self, node_id: NodeId, span: span) -> Variable { + pub fn variable(&mut self, node_id: NodeId, span: Span) -> Variable { match self.variable_map.find(&node_id) { Some(&var) => var, None => { @@ -348,7 +348,7 @@ impl IrMaps { struct ErrorCheckVisitor; impl Visitor<@Liveness> for ErrorCheckVisitor { - fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, e:@Liveness) { + fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, e:@Liveness) { check_fn(self, fk, fd, b, s, n, e); } fn visit_local(&mut self, l:@Local, e:@Liveness) { @@ -366,7 +366,7 @@ fn visit_fn(v: &mut LivenessVisitor, fk: &visit::fn_kind, decl: &fn_decl, body: &Block, - sp: span, + sp: Span, id: NodeId, this: @mut IrMaps) { debug!("visit_fn: id=%d", id); @@ -602,7 +602,7 @@ fn Liveness(ir: @mut IrMaps, specials: Specials) -> Liveness { } impl Liveness { - pub fn live_node(&self, node_id: NodeId, span: span) -> LiveNode { + pub fn live_node(&self, node_id: NodeId, span: Span) -> LiveNode { let ir: &mut IrMaps = self.ir; match ir.live_node_map.find(&node_id) { Some(&ln) => ln, @@ -630,11 +630,11 @@ impl Liveness { } } - pub fn variable(&self, node_id: NodeId, span: span) -> Variable { + pub fn variable(&self, node_id: NodeId, span: Span) -> Variable { self.ir.variable(node_id, span) } - pub fn variable_from_def_map(&self, node_id: NodeId, span: span) + pub fn variable_from_def_map(&self, node_id: NodeId, span: Span) -> Option<Variable> { match self.tcx.def_map.find(&node_id) { Some(&def) => { @@ -651,7 +651,7 @@ impl Liveness { pub fn pat_bindings(&self, pat: @pat, - f: &fn(LiveNode, Variable, span, NodeId)) { + f: &fn(LiveNode, Variable, Span, NodeId)) { let def_map = self.tcx.def_map; do pat_util::pat_bindings(def_map, pat) |_bm, p_id, sp, _n| { let ln = self.live_node(p_id, sp); @@ -662,7 +662,7 @@ impl Liveness { pub fn arm_pats_bindings(&self, pats: &[@pat], - f: &fn(LiveNode, Variable, span, NodeId)) { + f: &fn(LiveNode, Variable, Span, NodeId)) { // only consider the first pattern; any later patterns must have // the same bindings, and we also consider the first pattern to be // the "authoratative" set of ids @@ -758,7 +758,7 @@ impl Liveness { pub fn find_loop_scope(&self, opt_label: Option<ident>, id: NodeId, - sp: span) + sp: Span) -> NodeId { match opt_label { Some(_) => // Refers to a labeled loop. Use the results of resolve @@ -1512,7 +1512,7 @@ fn check_fn(_v: &mut ErrorCheckVisitor, _fk: &visit::fn_kind, _decl: &fn_decl, _body: &Block, - _sp: span, + _sp: Span, _id: NodeId, _self: @Liveness) { // do not check contents of nested fns @@ -1528,7 +1528,7 @@ enum ReadKind { impl Liveness { pub fn check_ret(&self, id: NodeId, - sp: span, + sp: Span, _fk: &visit::fn_kind, entry_ln: LiveNode) { if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() { @@ -1584,7 +1584,7 @@ impl Liveness { } pub fn report_illegal_read(&self, - chk_span: span, + chk_span: Span, lnk: LiveNodeKind, var: Variable, rk: ReadKind) { @@ -1639,7 +1639,7 @@ impl Liveness { } pub fn warn_about_unused(&self, - sp: span, + sp: Span, id: NodeId, ln: LiveNode, var: Variable) @@ -1673,7 +1673,7 @@ impl Liveness { } pub fn warn_about_dead_assign(&self, - sp: span, + sp: Span, id: NodeId, ln: LiveNode, var: Variable) { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 3f1e409e170..21a2256b554 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -54,7 +54,7 @@ use util::common::indenter; use syntax::ast::{m_imm, m_mutbl}; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust; #[deriving(Eq)] @@ -134,7 +134,7 @@ pub enum MutabilityCategory { #[deriving(Eq)] pub struct cmt_ { id: ast::NodeId, // id of expr/pat producing this value - span: span, // span of same expr/pat + span: Span, // span of same expr/pat cat: categorization, // categorization of expr mutbl: MutabilityCategory, // mutability of expr as lvalue ty: ty::t // type of the expr (*see WARNING above*) @@ -256,7 +256,7 @@ pub fn cat_def( tcx: ty::ctxt, method_map: typeck::method_map, expr_id: ast::NodeId, - expr_span: span, + expr_span: Span, expr_ty: ty::t, def: ast::def) -> cmt { @@ -268,17 +268,17 @@ pub fn cat_def( pub trait ast_node { fn id(&self) -> ast::NodeId; - fn span(&self) -> span; + fn span(&self) -> Span; } impl ast_node for @ast::expr { fn id(&self) -> ast::NodeId { self.id } - fn span(&self) -> span { self.span } + fn span(&self) -> Span { self.span } } impl ast_node for @ast::pat { fn id(&self) -> ast::NodeId { self.id } - fn span(&self) -> span { self.span } + fn span(&self) -> Span { self.span } } pub struct mem_categorization_ctxt { @@ -442,7 +442,7 @@ impl mem_categorization_ctxt { pub fn cat_def(&self, id: ast::NodeId, - span: span, + span: Span, expr_ty: ty::t, def: ast::def) -> cmt { @@ -584,7 +584,7 @@ impl mem_categorization_ctxt { pub fn cat_rvalue(&self, cmt_id: ast::NodeId, - span: span, + span: Span, cleanup_scope_id: ast::NodeId, expr_ty: ty::t) -> cmt { @cmt_ { diff --git a/src/librustc/middle/moves.rs b/src/librustc/middle/moves.rs index 9f55e5e3509..8ba2c38250f 100644 --- a/src/librustc/middle/moves.rs +++ b/src/librustc/middle/moves.rs @@ -141,7 +141,7 @@ use syntax::ast::*; use syntax::ast_util; use syntax::visit; use syntax::visit::Visitor; -use syntax::codemap::span; +use syntax::codemap::Span; #[deriving(Encodable, Decodable)] pub enum CaptureMode { @@ -153,7 +153,7 @@ pub enum CaptureMode { #[deriving(Encodable, Decodable)] pub struct CaptureVar { def: def, // Variable being accessed free - span: span, // Location of an access to this variable + span: Span, // Location of an access to this variable mode: CaptureMode // How variable is being accessed } @@ -194,7 +194,7 @@ struct ComputeModesVisitor; impl visit::Visitor<VisitContext> for ComputeModesVisitor { fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&fn_decl, - b:&Block, s:span, n:NodeId, e:VisitContext) { + b:&Block, s:Span, n:NodeId, e:VisitContext) { compute_modes_for_fn(*self, fk, fd, b, s, n, e); } fn visit_expr(&mut self, ex:@expr, e:VisitContext) { @@ -250,7 +250,7 @@ fn compute_modes_for_fn(v: ComputeModesVisitor, fk: &visit::fn_kind, decl: &fn_decl, body: &Block, - span: span, + span: Span, id: NodeId, cx: VisitContext) { let mut v = v; diff --git a/src/librustc/middle/pat_util.rs b/src/librustc/middle/pat_util.rs index a67a488ef30..253d234afcf 100644 --- a/src/librustc/middle/pat_util.rs +++ b/src/librustc/middle/pat_util.rs @@ -14,7 +14,7 @@ use middle::resolve; use std::hashmap::HashMap; use syntax::ast::*; use syntax::ast_util::{path_to_ident, walk_pat}; -use syntax::codemap::span; +use syntax::codemap::Span; pub type PatIdMap = HashMap<ident, NodeId>; @@ -71,7 +71,7 @@ pub fn pat_is_binding_or_wild(dm: resolve::DefMap, pat: @pat) -> bool { } pub fn pat_bindings(dm: resolve::DefMap, pat: @pat, - it: &fn(binding_mode, NodeId, span, &Path)) { + it: &fn(binding_mode, NodeId, Span, &Path)) { do walk_pat(pat) |p| { match p.node { pat_ident(binding_mode, ref pth, _) if pat_is_binding(dm, p) => { diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index ccb62252e5d..5fa85674f9a 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -31,7 +31,7 @@ use syntax::ast_map; use syntax::ast_util::{Private, Public, is_local}; use syntax::ast_util::{variant_visibility_to_privacy, visibility_to_privacy}; use syntax::attr; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token; use syntax::visit; use syntax::visit::Visitor; @@ -79,7 +79,7 @@ impl PrivacyVisitor { } // Checks that an enum variant is in scope - fn check_variant(&mut self, span: span, enum_id: ast::def_id) { + fn check_variant(&mut self, span: Span, enum_id: ast::def_id) { let variant_info = ty::enum_variants(self.tcx, enum_id)[0]; let parental_privacy = if is_local(enum_id) { let parent_vis = ast_map::node_item_query(self.tcx.items, @@ -108,7 +108,7 @@ impl PrivacyVisitor { } // Returns true if a crate-local method is private and false otherwise. - fn method_is_private(&mut self, span: span, method_id: NodeId) -> bool { + fn method_is_private(&mut self, span: Span, method_id: NodeId) -> bool { let check = |vis: visibility, container_id: def_id| { let mut is_private = false; if vis == private { @@ -171,7 +171,7 @@ impl PrivacyVisitor { } // Returns true if the given local item is private and false otherwise. - fn local_item_is_private(&mut self, span: span, item_id: NodeId) -> bool { + fn local_item_is_private(&mut self, span: Span, item_id: NodeId) -> bool { let mut f: &fn(NodeId) -> bool = |_| false; f = |item_id| { match self.tcx.items.find(&item_id) { @@ -203,7 +203,7 @@ impl PrivacyVisitor { } // Checks that a private field is in scope. - fn check_field(&mut self, span: span, id: ast::def_id, ident: ast::ident) { + fn check_field(&mut self, span: Span, id: ast::def_id, ident: ast::ident) { let fields = ty::lookup_struct_fields(self.tcx, id); for field in fields.iter() { if field.ident != ident { loop; } @@ -216,7 +216,7 @@ impl PrivacyVisitor { } // Given the ID of a method, checks to ensure it's in scope. - fn check_method_common(&mut self, span: span, method_id: def_id, name: &ident) { + fn check_method_common(&mut self, span: Span, method_id: def_id, name: &ident) { // If the method is a default method, we need to use the def_id of // the default implementation. // Having to do this this is really unfortunate. @@ -245,7 +245,7 @@ impl PrivacyVisitor { } // Checks that a private path is in scope. - fn check_path(&mut self, span: span, def: def, path: &Path) { + fn check_path(&mut self, span: Span, def: def, path: &Path) { debug!("checking path"); match def { def_static_method(method_id, _, _) => { @@ -280,7 +280,7 @@ impl PrivacyVisitor { } // Checks that a private method is in scope. - fn check_method(&mut self, span: span, origin: &method_origin, ident: ast::ident) { + fn check_method(&mut self, span: Span, origin: &method_origin, ident: ast::ident) { match *origin { method_static(method_id) => { self.check_method_common(span, method_id, &ident) @@ -343,7 +343,7 @@ impl PrivacyVisitor { impl<'self> Visitor<&'self method_map> for PrivacyVisitor { - fn visit_mod<'mm>(&mut self, the_module:&_mod, _:span, _:NodeId, + fn visit_mod<'mm>(&mut self, the_module:&_mod, _:Span, _:NodeId, method_map:&'mm method_map) { let n_added = self.add_privileged_items(the_module.items); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index d6b6a948a57..2d503029256 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -30,7 +30,7 @@ use middle::ty; use std::hashmap::{HashMap, HashSet}; use syntax::ast_map; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust; use syntax::parse::token; use syntax::parse::token::special_idents; @@ -318,7 +318,7 @@ impl RegionMaps { } /// Records the current parent (if any) as the parent of `child_id`. -fn parent_to_expr(cx: Context, child_id: ast::NodeId, sp: span) { +fn parent_to_expr(cx: Context, child_id: ast::NodeId, sp: Span) { debug!("region::parent_to_expr(span=%?)", cx.sess.codemap.span_to_str(sp)); for parent_id in cx.parent.iter() { @@ -431,7 +431,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor, fk: &visit::fn_kind, decl: &ast::fn_decl, body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, cx: Context) { debug!("region::resolve_fn(id=%?, \ @@ -482,7 +482,7 @@ impl Visitor<Context> for RegionResolutionVisitor { resolve_item(self, i, cx); } - fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:span, n:NodeId, cx:Context) { + fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, b:&Block, s:Span, n:NodeId, cx:Context) { resolve_fn(self, fk, fd, b, s, n, cx); } fn visit_arm(&mut self, a:&arm, cx:Context) { @@ -744,7 +744,7 @@ fn determine_rp_in_fn(visitor: &mut DetermineRpVisitor, fk: &visit::fn_kind, decl: &ast::fn_decl, body: &ast::Block, - _: span, + _: Span, _: ast::NodeId, cx: @mut DetermineRpCtxt) { do cx.with(cx.item_id, false) { @@ -911,7 +911,7 @@ struct DetermineRpVisitor; impl Visitor<@mut DetermineRpCtxt> for DetermineRpVisitor { fn visit_fn(&mut self, fk:&fn_kind, fd:&fn_decl, - b:&Block, s:span, n:NodeId, e:@mut DetermineRpCtxt) { + b:&Block, s:Span, n:NodeId, e:@mut DetermineRpCtxt) { determine_rp_in_fn(self, fk, fd, b, s, n, e); } fn visit_item(&mut self, i:@item, e:@mut DetermineRpCtxt) { diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index c5be424e284..303a534974d 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -16,7 +16,7 @@ use metadata::csearch::get_static_methods_if_impl; use metadata::csearch::{get_type_name_if_impl, get_struct_fields}; use metadata::csearch; use metadata::cstore::find_extern_mod_stmt_cnum; -use metadata::decoder::{def_like, dl_def, dl_field, dl_impl}; +use metadata::decoder::{DefLike, DlDef, DlField, DlImpl}; use middle::lang_items::LanguageItems; use middle::lint::{unnecessary_qualification, unused_imports}; use middle::pat_util::pat_bindings; @@ -32,7 +32,7 @@ use syntax::parse::token; use syntax::parse::token::ident_interner; use syntax::parse::token::special_idents; use syntax::print::pprust::path_to_str; -use syntax::codemap::{span, dummy_sp, BytePos}; +use syntax::codemap::{Span, dummy_sp, BytePos}; use syntax::opt_vec::OptVec; use syntax::visit; use syntax::visit::Visitor; @@ -46,7 +46,7 @@ use std::util; pub type DefMap = @mut HashMap<NodeId,def>; pub struct binding_info { - span: span, + span: Span, binding_mode: binding_mode, } @@ -311,41 +311,44 @@ pub enum DuplicateCheckingMode { /// One local scope. pub struct Rib { - bindings: @mut HashMap<ident,def_like>, - self_binding: @mut Option<def_like>, + bindings: @mut HashMap<ident, DefLike>, + self_binding: @mut Option<DefLike>, kind: RibKind, } -pub fn Rib(kind: RibKind) -> Rib { - Rib { - bindings: @mut HashMap::new(), - self_binding: @mut None, - kind: kind +impl Rib { + pub fn new(kind: RibKind) -> Rib { + Rib { + bindings: @mut HashMap::new(), + self_binding: @mut None, + kind: kind + } } } - /// One import directive. pub struct ImportDirective { privacy: Privacy, module_path: ~[ident], subclass: @ImportDirectiveSubclass, - span: span, + span: Span, id: NodeId, } -pub fn ImportDirective(privacy: Privacy, - module_path: ~[ident], - subclass: @ImportDirectiveSubclass, - span: span, - id: NodeId) - -> ImportDirective { - ImportDirective { - privacy: privacy, - module_path: module_path, - subclass: subclass, - span: span, - id: id +impl ImportDirective { + pub fn new(privacy: Privacy, + module_path: ~[ident], + subclass: @ImportDirectiveSubclass, + span: Span, + id: NodeId) + -> ImportDirective { + ImportDirective { + privacy: privacy, + module_path: module_path, + subclass: subclass, + span: span, + id: id + } } } @@ -355,12 +358,14 @@ pub struct Target { bindings: @mut NameBindings, } -pub fn Target(target_module: @mut Module, - bindings: @mut NameBindings) - -> Target { - Target { - target_module: target_module, - bindings: bindings +impl Target { + pub fn new(target_module: @mut Module, + bindings: @mut NameBindings) + -> Target { + Target { + target_module: target_module, + bindings: bindings + } } } @@ -388,19 +393,19 @@ pub struct ImportResolution { type_id: NodeId, } -pub fn ImportResolution(privacy: Privacy, - id: NodeId) -> ImportResolution { - ImportResolution { - privacy: privacy, - type_id: id, - value_id: id, - outstanding_references: 0, - value_target: None, - type_target: None, +impl ImportResolution { + pub fn new(privacy: Privacy, + id: NodeId) -> ImportResolution { + ImportResolution { + privacy: privacy, + type_id: id, + value_id: id, + outstanding_references: 0, + value_target: None, + type_target: None, + } } -} -impl ImportResolution { pub fn target_for_namespace(&self, namespace: Namespace) -> Option<Target> { match namespace { @@ -478,27 +483,27 @@ pub struct Module { populated: bool, } -pub fn Module(parent_link: ParentLink, - def_id: Option<def_id>, - kind: ModuleKind, - external: bool) - -> Module { - Module { - parent_link: parent_link, - def_id: def_id, - kind: kind, - children: @mut HashMap::new(), - imports: @mut ~[], - external_module_children: @mut HashMap::new(), - anonymous_children: @mut HashMap::new(), - import_resolutions: @mut HashMap::new(), - glob_count: 0, - resolved_import_count: 0, - populated: !external, +impl Module { + pub fn new(parent_link: ParentLink, + def_id: Option<def_id>, + kind: ModuleKind, + external: bool) + -> Module { + Module { + parent_link: parent_link, + def_id: def_id, + kind: kind, + children: @mut HashMap::new(), + imports: @mut ~[], + external_module_children: @mut HashMap::new(), + anonymous_children: @mut HashMap::new(), + import_resolutions: @mut HashMap::new(), + glob_count: 0, + resolved_import_count: 0, + populated: !external, + } } -} -impl Module { pub fn all_imports_resolved(&self) -> bool { let imports = &mut *self.imports; return imports.len() == self.resolved_import_count; @@ -510,14 +515,14 @@ pub struct TypeNsDef { privacy: Privacy, module_def: Option<@mut Module>, type_def: Option<def>, - type_span: Option<span> + type_span: Option<Span> } // Records a possibly-private value definition. pub struct ValueNsDef { privacy: Privacy, def: def, - value_span: Option<span>, + value_span: Option<Span>, } // Records the definitions (at most one for each namespace) that a name is @@ -542,9 +547,9 @@ impl NameBindings { def_id: Option<def_id>, kind: ModuleKind, external: bool, - sp: span) { + sp: Span) { // Merges the module with the existing type def or creates a new one. - let module_ = @mut Module(parent_link, def_id, kind, external); + let module_ = @mut Module::new(parent_link, def_id, kind, external); match self.type_def { None => { self.type_def = Some(TypeNsDef { @@ -572,10 +577,10 @@ impl NameBindings { def_id: Option<def_id>, kind: ModuleKind, external: bool, - _sp: span) { + _sp: Span) { match self.type_def { None => { - let module = @mut Module(parent_link, def_id, kind, external); + let module = @mut Module::new(parent_link, def_id, kind, external); self.type_def = Some(TypeNsDef { privacy: privacy, module_def: Some(module), @@ -586,7 +591,7 @@ impl NameBindings { Some(type_def) => { match type_def.module_def { None => { - let module = @mut Module(parent_link, + let module = @mut Module::new(parent_link, def_id, kind, external); @@ -604,7 +609,7 @@ impl NameBindings { } /// Records a type definition. - pub fn define_type(@mut self, privacy: Privacy, def: def, sp: span) { + pub fn define_type(@mut self, privacy: Privacy, def: def, sp: Span) { // Merges the type with the existing type def or creates a new one. match self.type_def { None => { @@ -627,7 +632,7 @@ impl NameBindings { } /// Records a value definition. - pub fn define_value(@mut self, privacy: Privacy, def: def, sp: span) { + pub fn define_value(@mut self, privacy: Privacy, def: def, sp: Span) { self.value_def = Some(ValueNsDef { privacy: privacy, def: def, value_span: Some(sp) }); } @@ -723,7 +728,7 @@ impl NameBindings { } } - pub fn span_for_namespace(&self, namespace: Namespace) -> Option<span> { + pub fn span_for_namespace(&self, namespace: Namespace) -> Option<Span> { if self.defined_in_namespace(namespace) { match namespace { TypeNS => { @@ -1016,7 +1021,7 @@ impl Resolver { reduced_graph_parent: ReducedGraphParent, duplicate_checking_mode: DuplicateCheckingMode, // For printing errors - sp: span) + sp: Span) -> (@mut NameBindings, ReducedGraphParent) { // If this is the immediate descendant of a module, then we add the // child name directly. Otherwise, we create or reuse an anonymous @@ -1571,7 +1576,7 @@ impl Resolver { let def_id = def_id { crate: crate_id, node: 0 }; let parent_link = ModuleParentLink (self.get_module_from_parent(parent), name); - let external_module = @mut Module(parent_link, + let external_module = @mut Module::new(parent_link, Some(def_id), NormalModuleKind, false); @@ -1635,7 +1640,7 @@ impl Resolver { block_id); let parent_module = self.get_module_from_parent(parent); - let new_module = @mut Module( + let new_module = @mut Module::new( BlockParentLink(parent_module, block_id), None, AnonymousModuleKind, @@ -1777,10 +1782,10 @@ impl Resolver { /// Builds the reduced graph for a single item in an external crate. fn build_reduced_graph_for_external_crate_def(@mut self, root: @mut Module, - def_like: def_like, + def_like: DefLike, ident: ident) { match def_like { - dl_def(def) => { + DlDef(def) => { // Add the new child item, if necessary. match def { def_foreign_mod(def_id) => { @@ -1811,7 +1816,7 @@ impl Resolver { } } } - dl_impl(def) => { + DlImpl(def) => { // We only process static methods of impls here. match get_type_name_if_impl(self.session.cstore, def) { None => {} @@ -1900,7 +1905,7 @@ impl Resolver { } } } - dl_field => { + DlField => { debug!("(building reduced graph for external crate) \ ignoring field"); } @@ -1959,9 +1964,9 @@ impl Resolver { module_: @mut Module, module_path: ~[ident], subclass: @ImportDirectiveSubclass, - span: span, + span: Span, id: NodeId) { - let directive = @ImportDirective(privacy, module_path, + let directive = @ImportDirective::new(privacy, module_path, subclass, span, id); module_.imports.push(directive); @@ -1989,7 +1994,7 @@ impl Resolver { } None => { debug!("(building import directive) creating new"); - let resolution = @mut ImportResolution(privacy, id); + let resolution = @mut ImportResolution::new(privacy, id); resolution.outstanding_references = 1; module_.import_resolutions.insert(target, resolution); } @@ -2402,7 +2407,7 @@ impl Resolver { BoundResult(target_module, name_bindings) => { debug!("(resolving single import) found value target"); import_resolution.value_target = - Some(Target(target_module, name_bindings)); + Some(Target::new(target_module, name_bindings)); import_resolution.value_id = directive.id; } UnboundResult => { /* Continue. */ } @@ -2415,7 +2420,7 @@ impl Resolver { debug!("(resolving single import) found type target: %?", name_bindings.type_def.unwrap().type_def); import_resolution.type_target = - Some(Target(target_module, name_bindings)); + Some(Target::new(target_module, name_bindings)); import_resolution.type_id = directive.id; } UnboundResult => { /* Continue. */ } @@ -2522,7 +2527,7 @@ impl Resolver { None if target_import_resolution.privacy == Public => { // Simple: just copy the old import resolution. let new_import_resolution = - @mut ImportResolution(privacy, id); + @mut ImportResolution::new(privacy, id); new_import_resolution.value_target = target_import_resolution.value_target; new_import_resolution.type_target = @@ -2564,7 +2569,7 @@ impl Resolver { match module_.import_resolutions.find(&ident) { None => { // Create a new import resolution from this child. - dest_import_resolution = @mut ImportResolution(privacy, id); + dest_import_resolution = @mut ImportResolution::new(privacy, id); module_.import_resolutions.insert (ident, dest_import_resolution); } @@ -2584,13 +2589,13 @@ impl Resolver { if name_bindings.defined_in_public_namespace(ValueNS) { debug!("(resolving glob import) ... for value target"); dest_import_resolution.value_target = - Some(Target(containing_module, name_bindings)); + Some(Target::new(containing_module, name_bindings)); dest_import_resolution.value_id = id; } if name_bindings.defined_in_public_namespace(TypeNS) { debug!("(resolving glob import) ... for type target"); dest_import_resolution.type_target = - Some(Target(containing_module, name_bindings)); + Some(Target::new(containing_module, name_bindings)); dest_import_resolution.type_id = id; } }; @@ -2617,7 +2622,7 @@ impl Resolver { module_: @mut Module, module_path: &[ident], index: uint, - span: span, + span: Span, mut name_search_type: NameSearchType) -> ResolveResult<@mut Module> { let mut search_module = module_; @@ -2637,7 +2642,7 @@ impl Resolver { let segment_name = self.session.str_of(name); let module_name = self.module_to_str(search_module); if "???" == module_name { - let span = span { + let span = Span { lo: span.lo, hi: span.lo + BytePos(segment_name.len()), expn_info: span.expn_info, @@ -2726,7 +2731,7 @@ impl Resolver { module_: @mut Module, module_path: &[ident], use_lexical_scope: UseLexicalScopeFlag, - span: span, + span: Span, name_search_type: NameSearchType) -> ResolveResult<@mut Module> { let module_path_len = module_path.len(); @@ -2834,7 +2839,7 @@ impl Resolver { match module_.children.find(&name) { Some(name_bindings) if name_bindings.defined_in_namespace(namespace) => { - return Success(Target(module_, *name_bindings)); + return Success(Target::new(module_, *name_bindings)); } Some(_) | None => { /* Not found; continue. */ } } @@ -2873,7 +2878,7 @@ impl Resolver { let name_bindings = @mut Resolver::create_name_bindings_from_module( *module); - return Success(Target(module_, name_bindings)); + return Success(Target::new(module_, name_bindings)); } } } @@ -3090,7 +3095,7 @@ impl Resolver { Some(name_bindings) if name_bindings.defined_in_namespace(namespace) => { debug!("(resolving name in module) found node as child"); - return Success(Target(module_, *name_bindings)); + return Success(Target::new(module_, *name_bindings)); } Some(_) | None => { // Continue. @@ -3148,7 +3153,7 @@ impl Resolver { let name_bindings = @mut Resolver::create_name_bindings_from_module( *module); - return Success(Target(module_, name_bindings)); + return Success(Target::new(module_, name_bindings)); } } } @@ -3382,24 +3387,24 @@ impl Resolver { pub fn upvarify(@mut self, ribs: &mut ~[@Rib], rib_index: uint, - def_like: def_like, - span: span, + def_like: DefLike, + span: Span, allow_capturing_self: AllowCapturingSelfFlag) - -> Option<def_like> { + -> Option<DefLike> { let mut def; let is_ty_param; match def_like { - dl_def(d @ def_local(*)) | dl_def(d @ def_upvar(*)) | - dl_def(d @ def_arg(*)) | dl_def(d @ def_binding(*)) => { + DlDef(d @ def_local(*)) | DlDef(d @ def_upvar(*)) | + DlDef(d @ def_arg(*)) | DlDef(d @ def_binding(*)) => { def = d; is_ty_param = false; } - dl_def(d @ def_ty_param(*)) => { + DlDef(d @ def_ty_param(*)) => { def = d; is_ty_param = true; } - dl_def(d @ def_self(*)) + DlDef(d @ def_self(*)) if allow_capturing_self == DontAllowCapturingSelf => { def = d; is_ty_param = false; @@ -3488,15 +3493,15 @@ impl Resolver { rib_index += 1; } - return Some(dl_def(def)); + return Some(DlDef(def)); } pub fn search_ribs(@mut self, ribs: &mut ~[@Rib], name: ident, - span: span, + span: Span, allow_capturing_self: AllowCapturingSelfFlag) - -> Option<def_like> { + -> Option<DefLike> { // FIXME #4950: This should not use a while loop. // FIXME #4950: Try caching? @@ -3584,10 +3589,10 @@ impl Resolver { item_trait(ref generics, ref traits, ref methods) => { // Create a new rib for the self type. - let self_type_rib = @Rib(NormalRibKind); + let self_type_rib = @Rib::new(NormalRibKind); self.type_ribs.push(self_type_rib); self_type_rib.bindings.insert(self.type_self_ident, - dl_def(def_self_ty(item.id))); + DlDef(def_self_ty(item.id))); // Create a new rib for the trait-wide type parameters. do self.with_type_parameter_rib @@ -3714,14 +3719,14 @@ impl Resolver { HasTypeParameters(generics, node_id, initial_index, rib_kind) => { - let function_type_rib = @Rib(rib_kind); + let function_type_rib = @Rib::new(rib_kind); self.type_ribs.push(function_type_rib); for (index, type_parameter) in generics.ty_params.iter().enumerate() { let name = type_parameter.ident; debug!("with_type_parameter_rib: %d %d", node_id, type_parameter.id); - let def_like = dl_def(def_ty_param + let def_like = DlDef(def_ty_param (local_def(type_parameter.id), index + initial_index)); // Associate this type parameter with @@ -3751,13 +3756,13 @@ impl Resolver { } pub fn with_label_rib(@mut self, f: &fn()) { - self.label_ribs.push(@Rib(NormalRibKind)); + self.label_ribs.push(@Rib::new(NormalRibKind)); f(); self.label_ribs.pop(); } pub fn with_constant_rib(@mut self, f: &fn()) { - self.value_ribs.push(@Rib(ConstantItemRibKind)); + self.value_ribs.push(@Rib::new(ConstantItemRibKind)); f(); self.value_ribs.pop(); } @@ -3770,11 +3775,11 @@ impl Resolver { self_binding: SelfBinding, visitor: &mut ResolveVisitor) { // Create a value rib for the function. - let function_value_rib = @Rib(rib_kind); + let function_value_rib = @Rib::new(rib_kind); self.value_ribs.push(function_value_rib); // Create a label rib for the function. - let function_label_rib = @Rib(rib_kind); + let function_label_rib = @Rib::new(rib_kind); self.label_ribs.push(function_label_rib); // If this function has type parameters, add them now. @@ -3796,7 +3801,7 @@ impl Resolver { // Nothing to do. } HasSelfBinding(self_node_id) => { - let def_like = dl_def(def_self(self_node_id)); + let def_like = DlDef(def_self(self_node_id)); *function_value_rib.self_binding = Some(def_like); } } @@ -4029,7 +4034,7 @@ impl Resolver { pub fn resolve_module(@mut self, module_: &_mod, - _span: span, + _span: Span, _name: ident, id: NodeId, visitor: &mut ResolveVisitor) { @@ -4110,7 +4115,7 @@ impl Resolver { } pub fn resolve_arm(@mut self, arm: &arm, visitor: &mut ResolveVisitor) { - self.value_ribs.push(@Rib(NormalRibKind)); + self.value_ribs.push(@Rib::new(NormalRibKind)); let bindings_list = @mut HashMap::new(); for pattern in arm.pats.iter() { @@ -4130,7 +4135,7 @@ impl Resolver { pub fn resolve_block(@mut self, block: &Block, visitor: &mut ResolveVisitor) { debug!("(resolving block) entering block"); - self.value_ribs.push(@Rib(NormalRibKind)); + self.value_ribs.push(@Rib::new(NormalRibKind)); // Move down in the graph, if there's an anonymous module rooted here. let orig_module = self.current_module; @@ -4366,7 +4371,7 @@ impl Resolver { let last_rib = this.value_ribs[ this.value_ribs.len() - 1]; last_rib.bindings.insert(ident, - dl_def(def)); + DlDef(def)); bindings_list.insert(ident, pat_id); } Some(b) => { @@ -4387,7 +4392,7 @@ impl Resolver { let last_rib = this.value_ribs[ this.value_ribs.len() - 1]; last_rib.bindings.insert(ident, - dl_def(def)); + DlDef(def)); } } } @@ -4602,7 +4607,7 @@ impl Resolver { identifier: ident, namespace: Namespace, check_ribs: bool, - span: span) + span: Span) -> Option<def> { if check_ribs { match self.resolve_identifier_in_local_ribs(identifier, @@ -4826,7 +4831,7 @@ impl Resolver { pub fn resolve_identifier_in_local_ribs(@mut self, ident: ident, namespace: Namespace, - span: span) + span: Span) -> Option<def> { // Check the local set of ribs. let search_result; @@ -4843,20 +4848,20 @@ impl Resolver { } match search_result { - Some(dl_def(def)) => { + Some(DlDef(def)) => { debug!("(resolving path in local ribs) resolved `%s` to \ local: %?", self.session.str_of(ident), def); return Some(def); } - Some(dl_field) | Some(dl_impl(_)) | None => { + Some(DlField) | Some(DlImpl(_)) | None => { return None; } } } - pub fn resolve_self_value_in_local_ribs(@mut self, span: span) + pub fn resolve_self_value_in_local_ribs(@mut self, span: Span) -> Option<def> { // FIXME #4950: This should not use a while loop. let ribs = &mut self.value_ribs; @@ -4870,7 +4875,7 @@ impl Resolver { def_like, span, DontAllowCapturingSelf) { - Some(dl_def(def)) => return Some(def), + Some(DlDef(def)) => return Some(def), _ => { if self.session.has_errors() { // May happen inside a nested fn item, cf #6642. @@ -4929,7 +4934,7 @@ impl Resolver { rs } - fn resolve_error(@mut self, span: span, s: &str) { + fn resolve_error(@mut self, span: Span, s: &str) { if self.emit_errors { self.session.span_err(span, s); } @@ -5135,7 +5140,7 @@ impl Resolver { do self.with_label_rib { { let this = &mut *self; - let def_like = dl_def(def_label(expr.id)); + let def_like = DlDef(def_label(expr.id)); let rib = this.label_ribs[this.label_ribs.len() - 1]; rib.bindings.insert(label, def_like); } @@ -5155,7 +5160,7 @@ impl Resolver { `%s`", self.session.str_of( label))), - Some(dl_def(def @ def_label(_))) => { + Some(DlDef(def @ def_label(_))) => { self.record_def(expr.id, def) } Some(_) => { diff --git a/src/librustc/middle/stack_check.rs b/src/librustc/middle/stack_check.rs index 4266b051c68..1f64038e43f 100644 --- a/src/librustc/middle/stack_check.rs +++ b/src/librustc/middle/stack_check.rs @@ -21,7 +21,7 @@ use middle::ty; use syntax::ast; use syntax::ast_map; use syntax::attr; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::visit; use syntax::visit::Visitor; use util::ppaux::Repr; @@ -39,7 +39,7 @@ impl Visitor<Context> for StackCheckVisitor { stack_check_item(*self, i, e); } fn visit_fn(&mut self, fk:&visit::fn_kind, fd:&ast::fn_decl, - b:&ast::Block, s:span, n:ast::NodeId, e:Context) { + b:&ast::Block, s:Span, n:ast::NodeId, e:Context) { stack_check_fn(*self, fk, fd, b, s, n, e); } fn visit_expr(&mut self, ex:@ast::expr, e:Context) { @@ -94,7 +94,7 @@ fn stack_check_fn<'a>(v: StackCheckVisitor, fk: &visit::fn_kind, decl: &ast::fn_decl, body: &ast::Block, - sp: span, + sp: Span, id: ast::NodeId, in_cx: Context) { let safe_stack = match *fk { diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 9a92d91ab50..9259b323d42 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -225,7 +225,7 @@ use syntax::ast; use syntax::ast::ident; use syntax::ast_util::path_to_ident; use syntax::ast_util; -use syntax::codemap::{span, dummy_sp}; +use syntax::codemap::{Span, dummy_sp}; // An option identifying a literal: either a unit-like struct or an // expression. @@ -386,7 +386,7 @@ struct BindingInfo { llmatch: ValueRef, trmode: TransBindingMode, id: ast::NodeId, - span: span, + span: Span, ty: ty::t, } @@ -1014,7 +1014,7 @@ fn match_datum(bcx: @mut Block, val: ValueRef, pat_id: ast::NodeId) -> Datum { fn extract_vec_elems(bcx: @mut Block, - pat_span: span, + pat_span: Span, pat_id: ast::NodeId, elem_count: uint, slice: Option<uint>, @@ -1891,7 +1891,7 @@ fn trans_match_inner(scope_cx: @mut Block, bcx = controlflow::join_blocks(scope_cx, arm_cxs); return bcx; - fn mk_fail(bcx: @mut Block, sp: span, msg: @str, + fn mk_fail(bcx: @mut Block, sp: Span, msg: @str, finished: @mut Option<BasicBlockRef>) -> BasicBlockRef { match *finished { Some(bb) => return bb, _ => () } let fail_cx = sub_block(bcx, "case_fallthrough"); diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index a5cbb1cfe1d..7206eb47554 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -81,7 +81,7 @@ use syntax::ast_map::{path, path_elt_to_str, path_name}; use syntax::ast_util::{local_def}; use syntax::attr; use syntax::attr::AttrMetaMethods; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token; use syntax::parse::token::{special_idents}; use syntax::print::pprust::stmt_to_str; @@ -138,7 +138,7 @@ fn fcx_has_nonzero_span(fcx: &FunctionContext) -> bool { } } -fn span_is_empty(opt_span: &Option<span>) -> bool { +fn span_is_empty(opt_span: &Option<Span>) -> bool { match *opt_span { None => true, Some(span) => *span.lo == 0 && *span.hi == 0 @@ -791,7 +791,7 @@ pub fn cast_shift_rhs(op: ast::binop, } } -pub fn fail_if_zero(cx: @mut Block, span: span, divrem: ast::binop, +pub fn fail_if_zero(cx: @mut Block, span: Span, divrem: ast::binop, rhs: ValueRef, rhs_t: ty::t) -> @mut Block { let text = if divrem == ast::div { @"attempted to divide by zero" @@ -1064,7 +1064,7 @@ pub fn load_if_immediate(cx: @mut Block, v: ValueRef, t: ty::t) -> ValueRef { return v; } -pub fn trans_trace(bcx: @mut Block, sp_opt: Option<span>, trace_str: @str) { +pub fn trans_trace(bcx: @mut Block, sp_opt: Option<Span>, trace_str: @str) { if !bcx.sess().trace() { return; } let _icx = push_ctxt("trans_trace"); add_comment(bcx, trace_str); @@ -1615,7 +1615,7 @@ pub fn new_fn_ctxt_w_id(ccx: @mut CrateContext, skip_retptr: bool, param_substs: Option<@param_substs>, opt_node_info: Option<NodeInfo>, - sp: Option<span>) + sp: Option<Span>) -> @mut FunctionContext { for p in param_substs.iter() { p.validate(); } @@ -1690,7 +1690,7 @@ pub fn new_fn_ctxt(ccx: @mut CrateContext, path: path, llfndecl: ValueRef, output_type: ty::t, - sp: Option<span>) + sp: Option<Span>) -> @mut FunctionContext { new_fn_ctxt_w_id(ccx, path, llfndecl, -1, output_type, false, None, None, sp) } @@ -2283,7 +2283,7 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) { } pub fn register_fn(ccx: @mut CrateContext, - sp: span, + sp: Span, sym: ~str, node_id: ast::NodeId, node_type: ty::t) @@ -2293,7 +2293,7 @@ pub fn register_fn(ccx: @mut CrateContext, } pub fn register_fn_llvmty(ccx: @mut CrateContext, - sp: span, + sp: Span, sym: ~str, node_id: ast::NodeId, cc: lib::llvm::CallConv, @@ -2309,7 +2309,7 @@ pub fn register_fn_llvmty(ccx: @mut CrateContext, // FIXME #4404 android JNI hacks let is_entry = is_entry_fn(&ccx.sess, node_id) && (!*ccx.sess.building_library || (*ccx.sess.building_library && - ccx.sess.targ_cfg.os == session::os_android)); + ccx.sess.targ_cfg.os == session::OsAndroid)); if is_entry { create_entry_wrapper(ccx, sp, llfn); } @@ -2326,7 +2326,7 @@ pub fn is_entry_fn(sess: &Session, node_id: ast::NodeId) -> bool { // Create a _rust_main(args: ~[str]) function which will be called from the // runtime rust_start function pub fn create_entry_wrapper(ccx: @mut CrateContext, - _sp: span, + _sp: Span, main_llfn: ValueRef) { let et = ccx.sess.entry_type.unwrap(); match et { diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index dab97056921..acec33f7004 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -15,7 +15,7 @@ use lib::llvm::{Opcode, IntPredicate, RealPredicate}; use lib::llvm::{ValueRef, BasicBlockRef}; use lib; use middle::trans::common::*; -use syntax::codemap::span; +use syntax::codemap::Span; use middle::trans::builder::Builder; use middle::trans::type_::Type; @@ -629,7 +629,7 @@ pub fn _UndefReturn(cx: @mut Block, Fn: ValueRef) -> ValueRef { } } -pub fn add_span_comment(cx: @mut Block, sp: span, text: &str) { +pub fn add_span_comment(cx: @mut Block, sp: Span, text: &str) { B(cx).add_span_comment(sp, text) } diff --git a/src/librustc/middle/trans/builder.rs b/src/librustc/middle/trans/builder.rs index 9b910ab1ebc..6a1acf68efa 100644 --- a/src/librustc/middle/trans/builder.rs +++ b/src/librustc/middle/trans/builder.rs @@ -21,7 +21,7 @@ use std::cast; use std::hashmap::HashMap; use std::libc::{c_uint, c_ulonglong, c_char}; use std::vec; -use syntax::codemap::span; +use syntax::codemap::Span; use std::ptr::is_not_null; pub struct Builder { @@ -728,7 +728,7 @@ impl Builder { } } - pub fn add_span_comment(&self, sp: span, text: &str) { + pub fn add_span_comment(&self, sp: Span, text: &str) { if self.ccx.sess.asm_comments() { let s = fmt!("%s (%s)", text, self.ccx.sess.codemap.span_to_str(sp)); debug!("%s", s); diff --git a/src/librustc/middle/trans/cabi_x86.rs b/src/librustc/middle/trans/cabi_x86.rs index f0af31e795a..de53d8dd3da 100644 --- a/src/librustc/middle/trans/cabi_x86.rs +++ b/src/librustc/middle/trans/cabi_x86.rs @@ -9,7 +9,7 @@ // except according to those terms. -use driver::session::{os_win32, os_macos}; +use driver::session::{OsWin32, OsMacos}; use lib::llvm::*; use super::cabi::*; use super::common::*; @@ -42,7 +42,7 @@ pub fn compute_abi_info(ccx: &mut CrateContext, enum Strategy { RetValue(Type), RetPointer } let strategy = match ccx.sess.targ_cfg.os { - os_win32 | os_macos => { + OsWin32 | OsMacos => { match llsize_of_alloc(ccx, rty) { 1 => RetValue(Type::i8()), 2 => RetValue(Type::i16()), diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index d8c7b916a02..6a0541f0046 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -40,7 +40,7 @@ use std::libc::{c_uint, c_longlong, c_ulonglong, c_char}; use std::vec; use syntax::ast::ident; use syntax::ast_map::{path, path_elt}; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token; use syntax::{ast, ast_map}; @@ -220,7 +220,7 @@ pub struct FunctionContext { // The source span and nesting context where this function comes from, for // error reporting and symbol generation. - span: Option<span>, + span: Option<Span>, path: path, // This function's enclosing crate context. @@ -509,7 +509,7 @@ impl get_node_info for Option<@ast::expr> { pub struct NodeInfo { id: ast::NodeId, callee_id: Option<ast::NodeId>, - span: span + span: Span } // Basic block context. We create a block context for each basic block @@ -1110,7 +1110,7 @@ pub fn dummy_substs(tps: ~[ty::t]) -> ty::substs { } pub fn filename_and_line_num_from_span(bcx: @mut Block, - span: span) -> (ValueRef, ValueRef) { + span: Span) -> (ValueRef, ValueRef) { let loc = bcx.sess().parse_sess.cm.lookup_char_pos(span.lo); let filename_cstr = C_cstr(bcx.ccx(), loc.file.name); let filename = build::PointerCast(bcx, filename_cstr, Type::i8p()); @@ -1123,7 +1123,7 @@ pub fn bool_to_i1(bcx: @mut Block, llval: ValueRef) -> ValueRef { build::ICmp(bcx, lib::llvm::IntNE, llval, C_bool(false)) } -pub fn langcall(bcx: @mut Block, span: Option<span>, msg: &str, +pub fn langcall(bcx: @mut Block, span: Option<Span>, msg: &str, li: LangItem) -> ast::def_id { match bcx.tcx().lang_items.require(li) { Ok(id) => id, diff --git a/src/librustc/middle/trans/controlflow.rs b/src/librustc/middle/trans/controlflow.rs index 04d401f8297..feacede9725 100644 --- a/src/librustc/middle/trans/controlflow.rs +++ b/src/librustc/middle/trans/controlflow.rs @@ -30,7 +30,7 @@ use syntax::ast; use syntax::ast::ident; use syntax::ast_map::path_mod; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; pub fn trans_block(bcx: @mut Block, b: &ast::Block, dest: expr::Dest) -> @mut Block { let _icx = push_ctxt("trans_block"); @@ -353,7 +353,7 @@ pub fn trans_ret(bcx: @mut Block, e: Option<@ast::expr>) -> @mut Block { } pub fn trans_fail_expr(bcx: @mut Block, - sp_opt: Option<span>, + sp_opt: Option<Span>, fail_expr: Option<@ast::expr>) -> @mut Block { let _icx = push_ctxt("trans_fail_expr"); @@ -381,7 +381,7 @@ pub fn trans_fail_expr(bcx: @mut Block, } pub fn trans_fail(bcx: @mut Block, - sp_opt: Option<span>, + sp_opt: Option<Span>, fail_str: @str) -> @mut Block { let _icx = push_ctxt("trans_fail"); @@ -390,7 +390,7 @@ pub fn trans_fail(bcx: @mut Block, } fn trans_fail_value(bcx: @mut Block, - sp_opt: Option<span>, + sp_opt: Option<Span>, V_fail_str: ValueRef) -> @mut Block { let _icx = push_ctxt("trans_fail_value"); @@ -415,7 +415,7 @@ fn trans_fail_value(bcx: @mut Block, return bcx; } -pub fn trans_fail_bounds_check(bcx: @mut Block, sp: span, +pub fn trans_fail_bounds_check(bcx: @mut Block, sp: Span, index: ValueRef, len: ValueRef) -> @mut Block { let _icx = push_ctxt("trans_fail_bounds_check"); let (filename, line) = filename_and_line_num_from_span(bcx, sp); diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 1060a06a5cf..2fd0e38aea8 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -106,7 +106,7 @@ use util::ppaux::ty_to_str; use std::uint; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token::special_idents; #[deriving(Eq)] @@ -613,7 +613,7 @@ impl Datum { /// is_auto: If true, only deref if auto-derefable. pub fn try_deref(&self, bcx: @mut Block, - span: span, + span: Span, expr_id: ast::NodeId, derefs: uint, is_auto: bool) @@ -739,7 +739,7 @@ impl Datum { pub fn autoderef(&self, bcx: @mut Block, - span: span, + span: Span, expr_id: ast::NodeId, max: uint) -> DatumBlock { @@ -772,7 +772,7 @@ impl Datum { pub fn get_vec_base_and_len(&self, mut bcx: @mut Block, - span: span, + span: Span, expr_id: ast::NodeId, derefs: uint) -> (@mut Block, ValueRef, ValueRef) { @@ -796,7 +796,7 @@ impl Datum { pub fn root_and_write_guard(&self, bcx: @mut Block, - span: span, + span: Span, expr_id: ast::NodeId, derefs: uint) -> @mut Block { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index f8f29ec47e4..71269d5e61e 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -68,7 +68,7 @@ use std::hashmap::HashMap; use std::libc::{c_uint, c_ulonglong, c_longlong}; use std::ptr; use std::vec; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::{ast, codemap, ast_util, ast_map, opt_vec}; use syntax::parse::token::special_idents; @@ -158,7 +158,7 @@ pub fn create_match_binding_metadata(bcx: @mut Block, variable_ident: ast::ident, node_id: ast::NodeId, variable_type: ty::t, - span: span) { + span: Span) { declare_local(bcx, variable_ident, node_id, variable_type, span); } @@ -296,7 +296,7 @@ pub fn create_argument_metadata(bcx: @mut Block, /// reliably find the correct visibility scope for the code position. pub fn set_source_location(fcx: &FunctionContext, node_id: ast::NodeId, - span: span) { + span: Span) { let cx: &mut CrateContext = fcx.ccx; if !cx.sess.opts.debuginfo || (*span.lo == 0 && *span.hi == 0) { @@ -643,7 +643,7 @@ fn declare_local(bcx: @mut Block, variable_ident: ast::ident, node_id: ast::NodeId, variable_type: ty::t, - span: span) { + span: Span) { let cx: &mut CrateContext = bcx.ccx(); let filename = span_start(cx, span).file.name; @@ -720,7 +720,7 @@ fn file_metadata(cx: &mut CrateContext, full_path: &str) -> DIFile { /// Finds the scope metadata node for the given AST node. fn scope_metadata(fcx: &FunctionContext, node_id: ast::NodeId, - span: span) -> DIScope { + span: Span) -> DIScope { if fcx.debug_context.is_none() { fcx.ccx.sess.span_bug(span, "debuginfo: FunctionDebugContext should be initialized \ but is not!"); @@ -808,7 +808,7 @@ fn pointer_type_metadata(cx: &mut CrateContext, fn struct_metadata(cx: &mut CrateContext, struct_type: ty::t, fields: ~[ty::field], - span: span) + span: Span) -> DICompositeType { let struct_name = ty_to_str(cx.tcx, struct_type); debug!("struct_metadata: %s", struct_name); @@ -840,7 +840,7 @@ fn struct_metadata(cx: &mut CrateContext, fn tuple_metadata(cx: &mut CrateContext, tuple_type: ty::t, component_types: &[ty::t], - span: span) + span: Span) -> DICompositeType { let tuple_name = ty_to_str(cx.tcx, tuple_type); @@ -865,7 +865,7 @@ fn tuple_metadata(cx: &mut CrateContext, fn enum_metadata(cx: &mut CrateContext, enum_type: ty::t, enum_def_id: ast::def_id, - span: span) + span: Span) -> DIType { let enum_name = ty_to_str(cx.tcx, enum_type); @@ -987,7 +987,7 @@ fn enum_metadata(cx: &mut CrateContext, struct_def: &adt::Struct, variant_info: &ty::VariantInfo, discriminant_type_metadata: Option<DIType>, - span: span) + span: Span) -> DICompositeType { let arg_llvm_types: ~[Type] = do struct_def.fields.map |&ty| { type_of::type_of(cx, ty) }; @@ -1031,7 +1031,7 @@ fn composite_type_metadata(cx: &mut CrateContext, member_llvm_types: &[Type], member_names: &[~str], member_type_metadata: &[DIType], - span: span) + span: Span) -> DICompositeType { let loc = span_start(cx, span); @@ -1088,7 +1088,7 @@ fn boxed_type_metadata(cx: &mut CrateContext, content_type_name: Option<&str>, content_llvm_type: Type, content_type_metadata: DIType, - span: span) + span: Span) -> DICompositeType { let box_type_name = match content_type_name { @@ -1140,7 +1140,7 @@ fn boxed_type_metadata(cx: &mut CrateContext, fn fixed_vec_metadata(cx: &mut CrateContext, element_type: ty::t, len: uint, - span: span) + span: Span) -> DIType { let element_type_metadata = type_metadata(cx, element_type, span); let element_llvm_type = type_of::type_of(cx, element_type); @@ -1166,7 +1166,7 @@ fn fixed_vec_metadata(cx: &mut CrateContext, fn vec_metadata(cx: &mut CrateContext, element_type: ty::t, - span: span) + span: Span) -> DICompositeType { let element_type_metadata = type_metadata(cx, element_type, span); @@ -1204,7 +1204,7 @@ fn vec_metadata(cx: &mut CrateContext, fn boxed_vec_metadata(cx: &mut CrateContext, element_type: ty::t, - span: span) + span: Span) -> DICompositeType { let element_llvm_type = type_of::type_of(cx, element_type); @@ -1223,7 +1223,7 @@ fn boxed_vec_metadata(cx: &mut CrateContext, fn vec_slice_metadata(cx: &mut CrateContext, vec_type: ty::t, element_type: ty::t, - span: span) + span: Span) -> DICompositeType { debug!("vec_slice_metadata: %?", ty::get(vec_type)); @@ -1264,7 +1264,7 @@ fn bare_fn_metadata(cx: &mut CrateContext, _fn_ty: ty::t, inputs: ~[ty::t], output: ty::t, - span: span) + span: Span) -> DICompositeType { debug!("bare_fn_metadata: %?", ty::get(_fn_ty)); @@ -1307,7 +1307,7 @@ fn unimplemented_type_metadata(cx: &mut CrateContext, t: ty::t) -> DIType { fn type_metadata(cx: &mut CrateContext, t: ty::t, - span: span) + span: Span) -> DIType { let type_id = ty::type_id(t); match dbg_cx(cx).created_types.find(&type_id) { @@ -1493,7 +1493,7 @@ fn roundup(x: uint, a: uint) -> uint { } /// Return codemap::Loc corresponding to the beginning of the span -fn span_start(cx: &CrateContext, span: span) -> codemap::Loc { +fn span_start(cx: &CrateContext, span: Span) -> codemap::Loc { cx.sess.codemap.lookup_char_pos(span.lo) } @@ -1561,7 +1561,7 @@ fn populate_scope_map(cx: &mut CrateContext, // local helper functions for walking the AST. fn with_new_scope(cx: &mut CrateContext, - scope_span: span, + scope_span: Span, scope_stack: &mut ~[ScopeStackEntry], scope_map: &mut HashMap<ast::NodeId, DIScope>, inner_walk: &fn(&mut CrateContext, @@ -1625,7 +1625,7 @@ fn populate_scope_map(cx: &mut CrateContext, scope_stack: &mut ~[ScopeStackEntry], scope_map: &mut HashMap<ast::NodeId, DIScope>) { match *decl { - codemap::spanned { node: ast::decl_local(@ref local), _ } => { + codemap::Spanned { node: ast::decl_local(@ref local), _ } => { scope_map.insert(local.id, scope_stack.last().scope_metadata); walk_pattern(cx, local.pat, scope_stack, scope_map); diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 7c81bfbda65..f36b20e053b 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -680,7 +680,7 @@ fn trans_rvalue_dps_unadjusted(bcx: @mut Block, expr: @ast::expr, args.iter().enumerate().map(|(i, arg)| (i, *arg)).collect(); return trans_adt(bcx, repr, 0, numbered_fields, None, dest); } - ast::expr_lit(@codemap::spanned {node: ast::lit_str(s), _}) => { + ast::expr_lit(@codemap::Spanned {node: ast::lit_str(s), _}) => { return tvec::trans_lit_str(bcx, expr, s, dest); } ast::expr_vstore(contents, ast::expr_vstore_slice) | @@ -1163,7 +1163,7 @@ pub fn with_field_tys<R>(tcx: ty::ctxt, fn trans_rec_or_struct(bcx: @mut Block, fields: &[ast::Field], base: Option<@ast::expr>, - expr_span: codemap::span, + expr_span: codemap::Span, id: ast::NodeId, dest: Dest) -> @mut Block { diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index bd4e50e01b5..26968ce4881 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -29,7 +29,7 @@ use middle::ty::FnSig; use std::uint; use std::vec; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::{ast}; use syntax::{attr, ast_map}; use syntax::parse::token::special_idents; @@ -350,7 +350,7 @@ pub fn trans_foreign_mod(ccx: @mut CrateContext, // correct code in the first place, but this is much simpler. pub fn register_rust_fn_with_foreign_abi(ccx: @mut CrateContext, - sp: span, + sp: Span, sym: ~str, node_id: ast::NodeId) -> ValueRef { diff --git a/src/librustc/middle/trans/tvec.rs b/src/librustc/middle/trans/tvec.rs index 47d5b7ff3a5..59f5c9d0723 100644 --- a/src/librustc/middle/trans/tvec.rs +++ b/src/librustc/middle/trans/tvec.rs @@ -205,7 +205,7 @@ pub fn trans_slice_vstore(bcx: @mut Block, // Handle the &"..." case: match content_expr.node { - ast::expr_lit(@codemap::spanned {node: ast::lit_str(s), span: _}) => { + ast::expr_lit(@codemap::Spanned {node: ast::lit_str(s), span: _}) => { return trans_lit_str(bcx, content_expr, s, dest); } _ => {} @@ -295,7 +295,7 @@ pub fn trans_uniq_or_managed_vstore(bcx: @mut Block, heap: heap, vstore_expr: @a match heap { heap_exchange => { match content_expr.node { - ast::expr_lit(@codemap::spanned { + ast::expr_lit(@codemap::Spanned { node: ast::lit_str(s), span }) => { let llptrval = C_cstr(bcx.ccx(), s); @@ -357,7 +357,7 @@ pub fn write_content(bcx: @mut Block, let _indenter = indenter(); match content_expr.node { - ast::expr_lit(@codemap::spanned { node: ast::lit_str(s), _ }) => { + ast::expr_lit(@codemap::Spanned { node: ast::lit_str(s), _ }) => { match dest { Ignore => { return bcx; @@ -490,7 +490,7 @@ pub fn elements_required(bcx: @mut Block, content_expr: &ast::expr) -> uint { //! Figure out the number of elements we need to store this content match content_expr.node { - ast::expr_lit(@codemap::spanned { node: ast::lit_str(s), _ }) => { + ast::expr_lit(@codemap::Spanned { node: ast::lit_str(s), _ }) => { s.len() }, ast::expr_vec(ref es, _) => es.len(), diff --git a/src/librustc/middle/trans/write_guard.rs b/src/librustc/middle/trans/write_guard.rs index 182044c8d0d..ad999e0c1aa 100644 --- a/src/librustc/middle/trans/write_guard.rs +++ b/src/librustc/middle/trans/write_guard.rs @@ -28,14 +28,14 @@ use middle::trans::common::*; use middle::trans::datum::*; use middle::trans::expr; use middle::ty; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::ast; use middle::trans::type_::Type; pub fn root_and_write_guard(datum: &Datum, mut bcx: @mut Block, - span: span, + span: Span, expr_id: ast::NodeId, derefs: uint) -> @mut Block { let key = root_map_key { id: expr_id, derefs: derefs }; @@ -103,7 +103,7 @@ pub fn return_to_mut(mut bcx: @mut Block, fn root(datum: &Datum, mut bcx: @mut Block, - span: span, + span: Span, root_key: root_map_key, root_info: RootInfo) -> @mut Block { //! In some cases, borrowck will decide that an @T/@[]/@str @@ -183,7 +183,7 @@ fn root(datum: &Datum, fn perform_write_guard(datum: &Datum, bcx: @mut Block, - span: span) -> @mut Block { + span: Span) -> @mut Block { debug!("perform_write_guard"); let llval = datum.to_value_llval(bcx); diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index a3673928df7..b464ce6d624 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -38,7 +38,7 @@ use syntax::ast::*; use syntax::ast_util::is_local; use syntax::ast_util; use syntax::attr; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::codemap; use syntax::parse::token; use syntax::{ast, ast_map}; @@ -2898,7 +2898,7 @@ pub fn ty_vstore(ty: t) -> vstore { } pub fn ty_region(tcx: ctxt, - span: span, + span: Span, ty: t) -> Region { match get(ty).sty { ty_rptr(r, _) => r, @@ -2996,7 +2996,7 @@ pub fn expr_ty_adjusted(cx: ctxt, expr: &ast::expr) -> t { } pub fn adjust_ty(cx: ctxt, - span: span, + span: Span, unadjusted_ty: ty::t, adjustment: Option<@AutoAdjustment>) -> ty::t { @@ -3076,7 +3076,7 @@ pub fn adjust_ty(cx: ctxt, } }; - fn borrow_vec(cx: ctxt, span: span, + fn borrow_vec(cx: ctxt, span: Span, r: Region, m: ast::mutability, ty: ty::t) -> ty::t { match get(ty).sty { @@ -3097,7 +3097,7 @@ pub fn adjust_ty(cx: ctxt, } } - fn borrow_fn(cx: ctxt, span: span, r: Region, ty: ty::t) -> ty::t { + fn borrow_fn(cx: ctxt, span: Span, r: Region, ty: ty::t) -> ty::t { match get(ty).sty { ty_closure(ref fty) => { ty::mk_closure(cx, ClosureTy { @@ -3116,7 +3116,7 @@ pub fn adjust_ty(cx: ctxt, } } - fn borrow_obj(cx: ctxt, span: span, r: Region, + fn borrow_obj(cx: ctxt, span: Span, r: Region, m: ast::mutability, ty: ty::t) -> ty::t { match get(ty).sty { ty_trait(trt_did, ref trt_substs, _, _, b) => { @@ -3283,7 +3283,7 @@ pub fn expr_kind(tcx: ctxt, ast::expr_do_body(*) | ast::expr_block(*) | ast::expr_repeat(*) | - ast::expr_lit(@codemap::spanned {node: lit_str(_), _}) | + ast::expr_lit(@codemap::Spanned {node: lit_str(_), _}) | ast::expr_vstore(_, ast::expr_vstore_slice) | ast::expr_vstore(_, ast::expr_vstore_mut_slice) | ast::expr_vec(*) => { @@ -3395,7 +3395,7 @@ pub fn param_tys_in_type(ty: t) -> ~[param_ty] { rslt } -pub fn occurs_check(tcx: ctxt, sp: span, vid: TyVid, rt: t) { +pub fn occurs_check(tcx: ctxt, sp: Span, vid: TyVid, rt: t) { // Returns a vec of all the type variables occurring in `ty`. It may // contain duplicates. (Integral type vars aren't counted.) fn vars_in_type(ty: t) -> ~[TyVid] { diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 18cc5e65a8b..419bc999e03 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -65,7 +65,7 @@ use middle::typeck::lookup_def_tcx; use std::result; use syntax::abi::AbiSet; use syntax::{ast, ast_util}; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::opt_vec::OptVec; use syntax::opt_vec; use syntax::print::pprust::{lifetime_to_str, path_to_str}; @@ -78,12 +78,12 @@ pub trait AstConv { fn get_trait_def(&self, id: ast::def_id) -> @ty::TraitDef; // what type should we use when a type is omitted? - fn ty_infer(&self, span: span) -> ty::t; + fn ty_infer(&self, span: Span) -> ty::t; } pub fn get_region_reporting_err( tcx: ty::ctxt, - span: span, + span: Span, a_r: &Option<ast::Lifetime>, res: Result<ty::Region, RegionError>) -> ty::Region { @@ -107,7 +107,7 @@ pub fn get_region_reporting_err( pub fn ast_region_to_region<AC:AstConv,RS:RegionScope + Clone + 'static>( this: &AC, rscope: &RS, - default_span: span, + default_span: Span, opt_lifetime: &Option<ast::Lifetime>) -> ty::Region { let (span, res) = match opt_lifetime { @@ -701,7 +701,7 @@ pub fn ty_of_closure<AC:AstConv,RS:RegionScope + Clone + 'static>( decl: &ast::fn_decl, expected_sig: Option<ty::FnSig>, lifetimes: &OptVec<ast::Lifetime>, - span: span) + span: Span) -> ty::ClosureTy { // The caller should not both provide explicit bound lifetime diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 628ceccd61e..b2cec19963d 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -21,7 +21,7 @@ use middle::typeck::require_same_types; use std::hashmap::{HashMap, HashSet}; use syntax::ast; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust; pub fn check_match(fcx: @mut FnCtxt, @@ -284,7 +284,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: @ast::pat, path: &ast::Path, /// (e.g. K,V in HashMap<K,V>). /// `etc` is true if the pattern said '...' and false otherwise. pub fn check_struct_pat_fields(pcx: &pat_ctxt, - span: span, + span: Span, path: &ast::Path, fields: &[ast::field_pat], class_fields: ~[ty::field_ty], @@ -338,7 +338,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt, } } -pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span, +pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: Span, expected: ty::t, path: &ast::Path, fields: &[ast::field_pat], etc: bool, struct_id: ast::def_id, @@ -372,7 +372,7 @@ pub fn check_struct_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, span: span, pub fn check_struct_like_enum_variant_pat(pcx: &pat_ctxt, pat_id: ast::NodeId, - span: span, + span: Span, expected: ty::t, path: &ast::Path, fields: &[ast::field_pat], @@ -651,7 +651,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, pointer_kind: PointerKind, inner: @ast::pat, pat_id: ast::NodeId, - span: span, + span: Span, expected: ty::t) { let fcx = pcx.fcx; let check_inner: &fn(ty::mt) = |e_inner| { diff --git a/src/librustc/middle/typeck/check/demand.rs b/src/librustc/middle/typeck/check/demand.rs index cf29d3f7f1f..6b755510e8d 100644 --- a/src/librustc/middle/typeck/check/demand.rs +++ b/src/librustc/middle/typeck/check/demand.rs @@ -16,24 +16,24 @@ use middle::typeck::infer; use std::result::{Err, Ok}; use std::result; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; // Requires that the two types unify, and prints an error message if they // don't. -pub fn suptype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) { +pub fn suptype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { suptype_with_fn(fcx, sp, false, expected, actual, |sp, e, a, s| { fcx.report_mismatched_types(sp, e, a, s) }) } -pub fn subtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) { +pub fn subtype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { suptype_with_fn(fcx, sp, true, actual, expected, |sp, a, e, s| { fcx.report_mismatched_types(sp, e, a, s) }) } pub fn suptype_with_fn(fcx: @mut FnCtxt, - sp: span, b_is_expected: bool, + sp: Span, b_is_expected: bool, ty_a: ty::t, ty_b: ty::t, - handle_err: &fn(span, ty::t, ty::t, &ty::type_err)) { + handle_err: &fn(Span, ty::t, ty::t, &ty::type_err)) { // n.b.: order of actual, expected is reversed match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp), ty_b, ty_a) { @@ -44,7 +44,7 @@ pub fn suptype_with_fn(fcx: @mut FnCtxt, } } -pub fn eqtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) { +pub fn eqtype(fcx: @mut FnCtxt, sp: Span, expected: ty::t, actual: ty::t) { match infer::mk_eqty(fcx.infcx(), false, infer::Misc(sp), actual, expected) { Ok(()) => { /* ok */ } Err(ref err) => { @@ -55,7 +55,7 @@ pub fn eqtype(fcx: @mut FnCtxt, sp: span, expected: ty::t, actual: ty::t) { // Checks that the type `actual` can be coerced to `expected`. pub fn coerce(fcx: @mut FnCtxt, - sp: span, + sp: Span, expected: ty::t, expr: @ast::expr) { let expr_ty = fcx.expr_ty(expr); diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 3016d40729b..0d4185470b7 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -122,7 +122,7 @@ use syntax::ast; use syntax::ast_map; use syntax::ast_util::local_def; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::codemap; use syntax::opt_vec::OptVec; use syntax::opt_vec; @@ -144,7 +144,7 @@ pub mod method; pub struct SelfInfo { self_ty: ty::t, self_id: ast::NodeId, - span: span + span: Span } /// Fields that are part of a `FnCtxt` which are inherited by @@ -398,7 +398,7 @@ impl Visitor<()> for GatherLocalsVisitor { // Don't descend into fns and items fn visit_fn(&mut self, _:&visit::fn_kind, _:&ast::fn_decl, - _:&ast::Block, _:span, _:ast::NodeId, _:()) { } + _:&ast::Block, _:Span, _:ast::NodeId, _:()) { } fn visit_item(&mut self, _:@ast::item, _:()) { } } @@ -557,7 +557,7 @@ pub fn check_method(ccx: @mut CrateCtxt, } pub fn check_no_duplicate_fields(tcx: ty::ctxt, - fields: ~[(ast::ident, span)]) { + fields: ~[(ast::ident, Span)]) { let mut field_names = HashMap::new(); for p in fields.iter() { @@ -577,7 +577,7 @@ pub fn check_no_duplicate_fields(tcx: ty::ctxt, } } -pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: span) { +pub fn check_struct(ccx: @mut CrateCtxt, id: ast::NodeId, span: Span) { let tcx = ccx.tcx; // Check that the class is instantiable @@ -665,7 +665,7 @@ impl AstConv for FnCtxt { ty::lookup_trait_def(self.tcx(), id) } - fn ty_infer(&self, _span: span) -> ty::t { + fn ty_infer(&self, _span: Span) -> ty::t { self.infcx().next_ty_var() } } @@ -678,7 +678,7 @@ impl FnCtxt { self.ccx.tcx.sess.err_count() - self.err_count_on_creation } pub fn search_in_scope_regions(&self, - span: span, + span: Span, br: ty::bound_region) -> Result<ty::Region, RegionError> { let in_scope_regions = self.in_scope_regions; @@ -706,14 +706,14 @@ impl FnCtxt { } impl RegionScope for FnCtxt { - fn anon_region(&self, span: span) -> Result<ty::Region, RegionError> { + fn anon_region(&self, span: Span) -> Result<ty::Region, RegionError> { result::Ok(self.infcx().next_region_var(infer::MiscVariable(span))) } - fn self_region(&self, span: span) -> Result<ty::Region, RegionError> { + fn self_region(&self, span: Span) -> Result<ty::Region, RegionError> { self.search_in_scope_regions(span, ty::br_self) } fn named_region(&self, - span: span, + span: Span, id: ast::ident) -> Result<ty::Region, RegionError> { self.search_in_scope_regions(span, ty::br_named(id)) } @@ -726,7 +726,7 @@ impl FnCtxt { } } - pub fn local_ty(&self, span: span, nid: ast::NodeId) -> ty::t { + pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> ty::t { match self.inh.locals.find(&nid) { Some(&t) => t, None => { @@ -918,7 +918,7 @@ impl FnCtxt { pub fn region_var_if_parameterized(&self, rp: Option<ty::region_variance>, - span: span) + span: Span) -> OptVec<ty::Region> { match rp { None => opt_vec::Empty, @@ -931,7 +931,7 @@ impl FnCtxt { } pub fn type_error_message(&self, - sp: span, + sp: Span, mk_msg: &fn(~str) -> ~str, actual_ty: ty::t, err: Option<&ty::type_err>) { @@ -939,7 +939,7 @@ impl FnCtxt { } pub fn report_mismatched_return_types(&self, - sp: span, + sp: Span, e: ty::t, a: ty::t, err: &ty::type_err) { @@ -951,7 +951,7 @@ impl FnCtxt { } pub fn report_mismatched_types(&self, - sp: span, + sp: Span, e: ty::t, a: ty::t, err: &ty::type_err) { @@ -959,7 +959,7 @@ impl FnCtxt { } } -pub fn do_autoderef(fcx: @mut FnCtxt, sp: span, t: ty::t) -> (ty::t, uint) { +pub fn do_autoderef(fcx: @mut FnCtxt, sp: Span, t: ty::t) -> (ty::t, uint) { /*! * * Autoderefs the type `t` as many times as possible, returning @@ -1306,7 +1306,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fn check_method_argument_types( fcx: @mut FnCtxt, - sp: span, + sp: Span, method_fn_ty: ty::t, callee_expr: @ast::expr, args: &[@ast::expr], @@ -1336,7 +1336,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fn check_argument_types( fcx: @mut FnCtxt, - sp: span, + sp: Span, fn_inputs: &[ty::t], callee_expr: @ast::expr, args: &[@ast::expr], @@ -1597,7 +1597,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, then_blk: &ast::Block, opt_else_expr: Option<@ast::expr>, id: ast::NodeId, - sp: span, + sp: Span, expected: Option<ty::t>) { check_expr_has_type(fcx, cond_expr, ty::mk_bool()); @@ -2005,7 +2005,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, } fn check_struct_or_variant_fields(fcx: @mut FnCtxt, - span: span, + span: Span, class_id: ast::def_id, node_id: ast::NodeId, substitutions: ty::substs, @@ -2096,7 +2096,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fn check_struct_constructor(fcx: @mut FnCtxt, id: ast::NodeId, - span: codemap::span, + span: codemap::Span, class_id: ast::def_id, fields: &[ast::Field], base_expr: Option<@ast::expr>) { @@ -2185,7 +2185,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, fn check_struct_enum_variant(fcx: @mut FnCtxt, id: ast::NodeId, - span: codemap::span, + span: codemap::Span, enum_id: ast::def_id, variant_id: ast::def_id, fields: &[ast::Field]) { @@ -2259,7 +2259,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, match expr.node { ast::expr_vstore(ev, vst) => { let typ = match ev.node { - ast::expr_lit(@codemap::spanned { node: ast::lit_str(_), _ }) => { + ast::expr_lit(@codemap::Spanned { node: ast::lit_str(_), _ }) => { let tt = ast_expr_vstore_to_vstore(fcx, ev, vst); ty::mk_estr(tcx, tt) } @@ -2708,7 +2708,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, _ => false } } - fn types_compatible(fcx: @mut FnCtxt, sp: span, + fn types_compatible(fcx: @mut FnCtxt, sp: Span, t1: ty::t, t2: ty::t) -> bool { if !is_vec(t1) { false @@ -2897,7 +2897,7 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, unifier(); } -pub fn require_integral(fcx: @mut FnCtxt, sp: span, t: ty::t) { +pub fn require_integral(fcx: @mut FnCtxt, sp: Span, t: ty::t) { if !type_is_integral(fcx, sp, t) { fcx.type_error_message(sp, |actual| { fmt!("mismatched types: expected integral type but found `%s`", @@ -3022,7 +3022,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt, let s_id = ast_util::stmt_id(*s); let s_ty = fcx.node_ty(s_id); if last_was_bot && !warned && match s.node { - ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_), + ast::stmt_decl(@codemap::Spanned { node: ast::decl_local(_), _}, _) | ast::stmt_expr(_, _) | ast::stmt_semi(_, _) => { true @@ -3070,7 +3070,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt, } pub fn check_const(ccx: @mut CrateCtxt, - sp: span, + sp: Span, e: @ast::expr, id: ast::NodeId) { let rty = ty::node_id_to_type(ccx.tcx, id); @@ -3080,7 +3080,7 @@ pub fn check_const(ccx: @mut CrateCtxt, } pub fn check_const_with_ty(fcx: @mut FnCtxt, - _: span, + _: Span, e: @ast::expr, declty: ty::t) { check_expr(fcx, e); @@ -3102,7 +3102,7 @@ pub fn check_const_with_ty(fcx: @mut FnCtxt, /// /// is representable, but not instantiable. pub fn check_instantiable(tcx: ty::ctxt, - sp: span, + sp: Span, item_id: ast::NodeId) { let item_ty = ty::node_id_to_type(tcx, item_id); if !ty::is_instantiable(tcx, item_ty) { @@ -3113,7 +3113,7 @@ pub fn check_instantiable(tcx: ty::ctxt, } } -pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::NodeId) { +pub fn check_simd(tcx: ty::ctxt, sp: Span, id: ast::NodeId) { let t = ty::node_id_to_type(tcx, id); if ty::type_needs_subst(t) { tcx.sess.span_err(sp, "SIMD vector cannot be generic"); @@ -3143,7 +3143,7 @@ pub fn check_simd(tcx: ty::ctxt, sp: span, id: ast::NodeId) { } pub fn check_enum_variants(ccx: @mut CrateCtxt, - sp: span, + sp: Span, vs: &[ast::variant], id: ast::NodeId) { fn do_check(ccx: @mut CrateCtxt, @@ -3236,13 +3236,13 @@ pub fn check_enum_variants(ccx: @mut CrateCtxt, check_instantiable(ccx.tcx, sp, id); } -pub fn lookup_def(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) -> ast::def { +pub fn lookup_def(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) -> ast::def { lookup_def_ccx(fcx.ccx, sp, id) } // Returns the type parameter count and the type for the given definition. pub fn ty_param_bounds_and_ty_for_def(fcx: @mut FnCtxt, - sp: span, + sp: Span, defn: ast::def) -> ty_param_bounds_and_ty { match defn { @@ -3295,7 +3295,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, pth: &ast::Path, tpt: ty_param_bounds_and_ty, def: ast::def, - span: span, + span: Span, node_id: ast::NodeId) { debug!(">>> instantiate_path"); @@ -3409,7 +3409,7 @@ pub fn instantiate_path(fcx: @mut FnCtxt, // Resolves `typ` by a single level if `typ` is a type variable. If no // resolution is possible, then an error is reported. -pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: span, tp: ty::t) +pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: Span, tp: ty::t) -> ty::t { match infer::resolve_type(fcx.infcx(), tp, force_tvar) { Ok(t_s) if !ty::type_is_ty_var(t_s) => t_s, @@ -3424,32 +3424,32 @@ pub fn structurally_resolved_type(fcx: @mut FnCtxt, sp: span, tp: ty::t) } // Returns the one-level-deep structure of the given type. -pub fn structure_of<'a>(fcx: @mut FnCtxt, sp: span, typ: ty::t) +pub fn structure_of<'a>(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> &'a ty::sty { &ty::get(structurally_resolved_type(fcx, sp, typ)).sty } -pub fn type_is_integral(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool { +pub fn type_is_integral(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool { let typ_s = structurally_resolved_type(fcx, sp, typ); return ty::type_is_integral(typ_s); } -pub fn type_is_scalar(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool { +pub fn type_is_scalar(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool { let typ_s = structurally_resolved_type(fcx, sp, typ); return ty::type_is_scalar(typ_s); } -pub fn type_is_unsafe_ptr(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool { +pub fn type_is_unsafe_ptr(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool { let typ_s = structurally_resolved_type(fcx, sp, typ); return ty::type_is_unsafe_ptr(typ_s); } -pub fn type_is_region_ptr(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool { +pub fn type_is_region_ptr(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool { let typ_s = structurally_resolved_type(fcx, sp, typ); return ty::type_is_region_ptr(typ_s); } -pub fn type_is_c_like_enum(fcx: @mut FnCtxt, sp: span, typ: ty::t) -> bool { +pub fn type_is_c_like_enum(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> bool { let typ_s = structurally_resolved_type(fcx, sp, typ); return ty::type_is_c_like_enum(fcx.ccx.tcx, typ_s); } @@ -3492,7 +3492,7 @@ pub fn may_break(cx: ty::ctxt, id: ast::NodeId, b: &ast::Block) -> bool { } pub fn check_bounds_are_used(ccx: @mut CrateCtxt, - span: span, + span: Span, tps: &OptVec<ast::TyParam>, ty: ty::t) { debug!("check_bounds_are_used(n_tps=%u, ty=%s)", diff --git a/src/librustc/middle/typeck/check/regionck.rs b/src/librustc/middle/typeck/check/regionck.rs index b25d81056b0..dc5a60876a4 100644 --- a/src/librustc/middle/typeck/check/regionck.rs +++ b/src/librustc/middle/typeck/check/regionck.rs @@ -42,7 +42,7 @@ use middle::pat_util; use syntax::ast::{ManagedSigil, OwnedSigil, BorrowedSigil}; use syntax::ast::{def_arg, def_binding, def_local, def_self, def_upvar}; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::visit; use syntax::visit::Visitor; @@ -626,7 +626,7 @@ fn constrain_derefs(rcx: @mut Rcx, } pub fn mk_subregion_due_to_derefence(rcx: @mut Rcx, - deref_span: span, + deref_span: Span, minimum_lifetime: ty::Region, maximum_lifetime: ty::Region) { rcx.fcx.mk_subr(true, infer::DerefPointer(deref_span), @@ -809,7 +809,7 @@ pub mod guarantor { use middle::typeck::infer; use middle::ty; use syntax::ast; - use syntax::codemap::span; + use syntax::codemap::Span; use util::ppaux::{ty_to_str}; pub fn for_addr_of(rcx: @mut Rcx, expr: @ast::expr, base: @ast::expr) { @@ -918,7 +918,7 @@ pub mod guarantor { fn link( rcx: @mut Rcx, - span: span, + span: Span, id: ast::NodeId, guarantor: Option<ty::Region>) { /*! diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 670553f569a..abea685eaf8 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -27,7 +27,7 @@ use std::hashmap::HashSet; use std::result; use syntax::ast; use syntax::ast_util; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust::expr_to_str; use syntax::visit; use syntax::visit::Visitor; @@ -62,7 +62,7 @@ use syntax::visit::Visitor; /// responsible for this vtable instantiation. (This may not be an expression /// if the vtable instantiation is being performed as part of "deriving".) pub struct LocationInfo { - span: span, + span: Span, id: ast::NodeId } diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index e62f562d9b3..6878cbcbb7b 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -27,11 +27,11 @@ use middle::typeck::write_ty_to_tcx; use util::ppaux; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust::pat_to_str; use syntax::oldvisit; -fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: span, typ: ty::t) +fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: Span, typ: ty::t) -> Option<ty::t> { if !ty::type_needs_infer(typ) { return Some(typ); } match resolve_type(fcx.infcx(), typ, resolve_all | force_all) { @@ -49,7 +49,7 @@ fn resolve_type_vars_in_type(fcx: @mut FnCtxt, sp: span, typ: ty::t) } } -fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t]) +fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: Span, tys: &[ty::t]) -> ~[ty::t] { tys.map(|t| { match resolve_type_vars_in_type(fcx, sp, *t) { @@ -59,7 +59,7 @@ fn resolve_type_vars_in_types(fcx: @mut FnCtxt, sp: span, tys: &[ty::t]) }) } -fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) { +fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) { // Resolve any method map entry match fcx.inh.method_map.find(&id) { None => {} @@ -79,7 +79,7 @@ fn resolve_method_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) { } } -fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) { +fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: Span, id: ast::NodeId) { // Resolve any method map entry match fcx.inh.vtable_map.find(&id) { None => {} @@ -92,13 +92,13 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) { } } - fn resolve_origins(fcx: @mut FnCtxt, sp: span, + fn resolve_origins(fcx: @mut FnCtxt, sp: Span, vtbls: vtable_res) -> vtable_res { @vtbls.map(|os| @os.map(|o| resolve_origin(fcx, sp, o))) } fn resolve_origin(fcx: @mut FnCtxt, - sp: span, + sp: Span, origin: &vtable_origin) -> vtable_origin { match origin { &vtable_static(def_id, ref tys, origins) => { @@ -113,7 +113,7 @@ fn resolve_vtable_map_entry(fcx: @mut FnCtxt, sp: span, id: ast::NodeId) { } } -fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::NodeId) +fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: Span, id: ast::NodeId) -> Option<ty::t> { let fcx = wbcx.fcx; let tcx = fcx.ccx.tcx; @@ -196,7 +196,7 @@ fn resolve_type_vars_for_node(wbcx: @mut WbCtxt, sp: span, id: ast::NodeId) } fn maybe_resolve_type_vars_for_node(wbcx: @mut WbCtxt, - sp: span, + sp: Span, id: ast::NodeId) -> Option<ty::t> { if wbcx.fcx.inh.node_types.contains_key(&id) { diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 2aa4e28f1a4..91ebbbd17ba 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -42,7 +42,7 @@ use syntax::ast; use syntax::ast_map::node_item; use syntax::ast_map; use syntax::ast_util::{def_id_of_def, local_def}; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::opt_vec; use syntax::visit; use syntax::parse; @@ -58,7 +58,7 @@ pub struct UniversalQuantificationResult { } pub fn get_base_type(inference_context: @mut InferCtxt, - span: span, + span: Span, original_type: t) -> Option<t> { let resolved_type; @@ -121,7 +121,7 @@ pub fn type_is_defined_in_local_crate(original_type: t) -> bool { // Returns the def ID of the base type, if there is one. pub fn get_base_type_def_id(inference_context: @mut InferCtxt, - span: span, + span: Span, original_type: t) -> Option<def_id> { match get_base_type(inference_context, span, original_type) { @@ -546,7 +546,7 @@ impl CoherenceChecker { &self, all_methods: &mut ~[@Method], trait_did: def_id, - trait_ref_span: span) { + trait_ref_span: Span) { let tcx = self.crate_context.tcx; @@ -647,7 +647,7 @@ impl CoherenceChecker { } } - pub fn span_of_impl(&self, implementation: @Impl) -> span { + pub fn span_of_impl(&self, implementation: @Impl) -> Span { assert_eq!(implementation.did.crate, LOCAL_CRATE); match self.crate_context.tcx.items.find(&implementation.did.node) { Some(&node_item(item, _)) => { diff --git a/src/librustc/middle/typeck/collect.rs b/src/librustc/middle/typeck/collect.rs index 71a9a041fb5..4707af5ca6c 100644 --- a/src/librustc/middle/typeck/collect.rs +++ b/src/librustc/middle/typeck/collect.rs @@ -54,7 +54,7 @@ use syntax::ast::{RegionTyParamBound, TraitTyParamBound}; use syntax::ast; use syntax::ast_map; use syntax::ast_util::{local_def, split_trait_methods}; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::codemap; use syntax::print::pprust::{path_to_str, explicit_self_to_str}; use syntax::visit; @@ -140,7 +140,7 @@ impl AstConv for CrateCtxt { get_trait_def(self, id) } - fn ty_infer(&self, span: span) -> ty::t { + fn ty_infer(&self, span: Span) -> ty::t { self.tcx.sess.span_bug(span, "found `ty_infer` in unexpected place"); } @@ -397,7 +397,7 @@ pub fn ensure_trait_methods(ccx: &CrateCtxt, pub fn ensure_supertraits(ccx: &CrateCtxt, id: ast::NodeId, - sp: codemap::span, + sp: codemap::Span, rp: Option<ty::region_variance>, ast_trait_refs: &[ast::trait_ref], generics: &ast::Generics) -> ty::BuiltinBounds @@ -740,7 +740,7 @@ pub fn convert_field(ccx: &CrateCtxt, pub struct ConvertedMethod { mty: @ty::Method, id: ast::NodeId, - span: span, + span: Span, body_id: ast::NodeId } @@ -828,7 +828,7 @@ pub fn convert_methods(ccx: &CrateCtxt, } pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, - span: span, + span: Span, generics: &ast::Generics, thing: &'static str) { for ty_param in generics.ty_params.iter() { diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index a11abda8ec5..da3471168dd 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -44,7 +44,7 @@ use extra::smallintmap::SmallIntMap; use syntax::ast::{m_imm, m_mutbl}; use syntax::ast; use syntax::codemap; -use syntax::codemap::span; +use syntax::codemap::Span; pub mod doc; pub mod macros; @@ -100,25 +100,25 @@ pub struct InferCtxt { #[deriving(Clone)] pub enum TypeOrigin { // Not yet categorized in a better way - Misc(span), + Misc(Span), // Checking that method of impl is compatible with trait - MethodCompatCheck(span), + MethodCompatCheck(Span), // Checking that this expression can be assigned where it needs to be ExprAssignable(@ast::expr), // Relating trait refs when resolving vtables - RelateTraitRefs(span), + RelateTraitRefs(Span), // Relating trait refs when resolving vtables - RelateSelfType(span), + RelateSelfType(Span), // Computing common supertype in a match expression - MatchExpression(span), + MatchExpression(Span), // Computing common supertype in an if expression - IfExpression(span), + IfExpression(Span), } /// See `error_reporting.rs` for more details @@ -148,47 +148,47 @@ pub enum SubregionOrigin { // Stack-allocated closures cannot outlive innermost loop // or function so as to ensure we only require finite stack - InfStackClosure(span), + InfStackClosure(Span), // Invocation of closure must be within its lifetime - InvokeClosure(span), + InvokeClosure(Span), // Dereference of borrowed pointer must be within its lifetime - DerefPointer(span), + DerefPointer(Span), // Closure bound must not outlive captured free variables - FreeVariable(span), + FreeVariable(Span), // Index into slice must be within its lifetime - IndexSlice(span), + IndexSlice(Span), // When casting `&'a T` to an `&'b Trait` object, // relating `'a` to `'b` - RelateObjectBound(span), + RelateObjectBound(Span), // Creating a pointer `b` to contents of another borrowed pointer - Reborrow(span), + Reborrow(Span), // (&'a &'b T) where a >= b - ReferenceOutlivesReferent(ty::t, span), + ReferenceOutlivesReferent(ty::t, Span), // A `ref b` whose region does not enclose the decl site - BindingTypeIsNotValidAtDecl(span), + BindingTypeIsNotValidAtDecl(Span), // Regions appearing in a method receiver must outlive method call - CallRcvr(span), + CallRcvr(Span), // Regions appearing in a function argument must outlive func call - CallArg(span), + CallArg(Span), // Region in return type of invoked fn must enclose call - CallReturn(span), + CallReturn(Span), // Region resulting from a `&` expr must enclose the `&` expr - AddrOf(span), + AddrOf(Span), // An auto-borrow that does not enclose the expr where it occurs - AutoBorrow(span), + AutoBorrow(Span), } /// Reasons to create a region inference variable @@ -197,36 +197,36 @@ pub enum SubregionOrigin { pub enum RegionVariableOrigin { // Region variables created for ill-categorized reasons, // mostly indicates places in need of refactoring - MiscVariable(span), + MiscVariable(Span), // Regions created by a `&P` or `[...]` pattern - PatternRegion(span), + PatternRegion(Span), // Regions created by `&` operator - AddrOfRegion(span), + AddrOfRegion(Span), // Regions created by `&[...]` literal - AddrOfSlice(span), + AddrOfSlice(Span), // Regions created as part of an autoref of a method receiver - Autoref(span), + Autoref(Span), // Regions created as part of an automatic coercion Coercion(TypeTrace), // Region variables created for bound regions // in a function or method that is called - BoundRegionInFnCall(span, ty::bound_region), + BoundRegionInFnCall(Span, ty::bound_region), // Region variables created for bound regions // when doing subtyping/lub/glb computations - BoundRegionInFnType(span, ty::bound_region), + BoundRegionInFnType(Span, ty::bound_region), - BoundRegionInTypeOrImpl(span), + BoundRegionInTypeOrImpl(Span), BoundRegionInCoherence, - BoundRegionError(span), + BoundRegionError(Span), } pub enum fixup_err { @@ -710,7 +710,7 @@ impl InferCtxt { // types using one of these four methods, and should not call span_err directly for such // errors. pub fn type_error_message_str(@mut self, - sp: span, + sp: Span, mk_msg: &fn(Option<~str>, ~str) -> ~str, actual_ty: ~str, err: Option<&ty::type_err>) { @@ -718,7 +718,7 @@ impl InferCtxt { } pub fn type_error_message_str_with_expected(@mut self, - sp: span, + sp: Span, mk_msg: &fn(Option<~str>, ~str) -> ~str, @@ -749,7 +749,7 @@ impl InferCtxt { } pub fn type_error_message(@mut self, - sp: span, + sp: Span, mk_msg: &fn(~str) -> ~str, actual_ty: ty::t, err: Option<&ty::type_err>) { @@ -764,7 +764,7 @@ impl InferCtxt { } pub fn report_mismatched_types(@mut self, - sp: span, + sp: Span, e: ty::t, a: ty::t, err: &ty::type_err) { @@ -812,7 +812,7 @@ pub fn fold_regions_in_sig( } impl TypeTrace { - pub fn span(&self) -> span { + pub fn span(&self) -> Span { self.origin.span() } } @@ -824,7 +824,7 @@ impl Repr for TypeTrace { } impl TypeOrigin { - pub fn span(&self) -> span { + pub fn span(&self) -> Span { match *self { MethodCompatCheck(span) => span, ExprAssignable(expr) => expr.span, @@ -852,7 +852,7 @@ impl Repr for TypeOrigin { } impl SubregionOrigin { - pub fn span(&self) -> span { + pub fn span(&self) -> Span { match *self { Subtype(a) => a.span(), InfStackClosure(a) => a, @@ -896,7 +896,7 @@ impl Repr for SubregionOrigin { } impl RegionVariableOrigin { - pub fn span(&self) -> span { + pub fn span(&self) -> Span { match *self { MiscVariable(a) => a, PatternRegion(a) => a, diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index a8a3701e4a5..4d88df06480 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -61,7 +61,7 @@ use std::hashmap::HashMap; use std::result; use extra::list::List; use extra::list; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::print::pprust::*; use syntax::{ast, ast_map, abi}; use syntax::opt_vec; @@ -249,7 +249,7 @@ pub fn write_tpt_to_tcx(tcx: ty::ctxt, } } -pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::NodeId) -> ast::def { +pub fn lookup_def_tcx(tcx: ty::ctxt, sp: Span, id: ast::NodeId) -> ast::def { match tcx.def_map.find(&id) { Some(&x) => x, _ => { @@ -258,7 +258,7 @@ pub fn lookup_def_tcx(tcx: ty::ctxt, sp: span, id: ast::NodeId) -> ast::def { } } -pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: span, id: ast::NodeId) +pub fn lookup_def_ccx(ccx: &CrateCtxt, sp: Span, id: ast::NodeId) -> ast::def { lookup_def_tcx(ccx.tcx, sp, id) } @@ -275,7 +275,7 @@ pub fn require_same_types( tcx: ty::ctxt, maybe_infcx: Option<@mut infer::InferCtxt>, t1_is_expected: bool, - span: span, + span: Span, t1: ty::t, t2: ty::t, msg: &fn() -> ~str) -> bool { @@ -330,7 +330,7 @@ impl get_and_find_region for isr_alist { fn check_main_fn_ty(ccx: &CrateCtxt, main_id: ast::NodeId, - main_span: span) { + main_span: Span) { let tcx = ccx.tcx; let main_t = ty::node_id_to_type(tcx, main_id); match ty::get(main_t).sty { @@ -374,7 +374,7 @@ fn check_main_fn_ty(ccx: &CrateCtxt, fn check_start_fn_ty(ccx: &CrateCtxt, start_id: ast::NodeId, - start_span: span) { + start_span: Span) { let tcx = ccx.tcx; let start_t = ty::node_id_to_type(tcx, start_id); match ty::get(start_t).sty { diff --git a/src/librustc/middle/typeck/rscope.rs b/src/librustc/middle/typeck/rscope.rs index a93ff9c5fd0..b1342de067c 100644 --- a/src/librustc/middle/typeck/rscope.rs +++ b/src/librustc/middle/typeck/rscope.rs @@ -13,7 +13,7 @@ use middle::ty; use std::result; use syntax::ast; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::opt_vec::OptVec; use syntax::opt_vec; use syntax::parse::token::special_idents; @@ -25,25 +25,25 @@ pub struct RegionError { } pub trait RegionScope { - fn anon_region(&self, span: span) -> Result<ty::Region, RegionError>; - fn self_region(&self, span: span) -> Result<ty::Region, RegionError>; - fn named_region(&self, span: span, id: ast::ident) + fn anon_region(&self, span: Span) -> Result<ty::Region, RegionError>; + fn self_region(&self, span: Span) -> Result<ty::Region, RegionError>; + fn named_region(&self, span: Span, id: ast::ident) -> Result<ty::Region, RegionError>; } #[deriving(Clone)] pub struct EmptyRscope; impl RegionScope for EmptyRscope { - fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> { result::Err(RegionError { msg: ~"only 'static is allowed here", replacement: ty::re_static }) } - fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> { self.anon_region(_span) } - fn named_region(&self, _span: span, _id: ast::ident) + fn named_region(&self, _span: Span, _id: ast::ident) -> Result<ty::Region, RegionError> { self.anon_region(_span) @@ -176,13 +176,13 @@ impl MethodRscope { } impl RegionScope for MethodRscope { - fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> { result::Err(RegionError { msg: ~"anonymous lifetimes are not permitted here", replacement: ty::re_bound(ty::br_self) }) } - fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> { assert!(self.variance.is_some()); match self.variance { None => {} // must be borrowed self, so this is OK @@ -197,7 +197,7 @@ impl RegionScope for MethodRscope { } result::Ok(ty::re_bound(ty::br_self)) } - fn named_region(&self, span: span, id: ast::ident) + fn named_region(&self, span: Span, id: ast::ident) -> Result<ty::Region, RegionError> { if !self.region_param_names.has_ident(id) { return RegionParamNames::undeclared_name(None); @@ -224,13 +224,13 @@ impl TypeRscope { } } impl RegionScope for TypeRscope { - fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> { result::Err(RegionError { msg: ~"anonymous lifetimes are not permitted here", replacement: self.replacement() }) } - fn self_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn self_region(&self, _span: Span) -> Result<ty::Region, RegionError> { match **self { None => { // if the self region is used, region parameterization should @@ -249,7 +249,7 @@ impl RegionScope for TypeRscope { } result::Ok(ty::re_bound(ty::br_self)) } - fn named_region(&self, span: span, id: ast::ident) + fn named_region(&self, span: Span, id: ast::ident) -> Result<ty::Region, RegionError> { do EmptyRscope.named_region(span, id).chain_err |_e| { result::Err(RegionError { @@ -298,16 +298,16 @@ pub fn in_binding_rscope<RS:RegionScope + Clone + 'static>( } impl RegionScope for BindingRscope { - fn anon_region(&self, _span: span) -> Result<ty::Region, RegionError> { + fn anon_region(&self, _span: Span) -> Result<ty::Region, RegionError> { let idx = *self.anon_bindings; *self.anon_bindings += 1; result::Ok(ty::re_bound(ty::br_anon(idx))) } - fn self_region(&self, span: span) -> Result<ty::Region, RegionError> { + fn self_region(&self, span: Span) -> Result<ty::Region, RegionError> { self.base.self_region(span) } fn named_region(&self, - span: span, + span: Span, id: ast::ident) -> Result<ty::Region, RegionError> { do self.base.named_region(span, id).chain_err |_e| { diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs index 06b3f6aae27..72cd3fa7b4f 100644 --- a/src/librustc/rustc.rs +++ b/src/librustc/rustc.rs @@ -28,7 +28,7 @@ extern mod syntax; use driver::driver::{host_triple, optgroups, early_error}; use driver::driver::{str_input, file_input, build_session_options}; use driver::driver::{build_session, build_configuration, parse_pretty}; -use driver::driver::{pp_mode, pretty_print_input, list_metadata}; +use driver::driver::{PpMode, pretty_print_input, list_metadata}; use driver::driver::{compile_input}; use driver::session; use middle::lint; @@ -262,11 +262,11 @@ pub fn run_compiler(args: &[~str], demitter: diagnostic::Emitter) { parse_pretty(sess, a) }; match pretty { - Some::<pp_mode>(ppm) => { + Some::<PpMode>(ppm) => { pretty_print_input(sess, cfg, &input, ppm); return; } - None::<pp_mode> => {/* continue */ } + None::<PpMode> => {/* continue */ } } let ls = opt_present(matches, "ls"); if ls { @@ -326,7 +326,7 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) { let ch_capture = ch.clone(); // The 'diagnostics emitter'. Every error, warning, etc. should // go through this function. - let demitter: @fn(Option<(@codemap::CodeMap, codemap::span)>, + let demitter: @fn(Option<(@codemap::CodeMap, codemap::Span)>, &str, diagnostic::level) = |cmsp, msg, lvl| { diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index 22d7a4a5f58..e2475efa40b 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -10,7 +10,7 @@ use syntax::ast; -use syntax::codemap::{span}; +use syntax::codemap::{Span}; use syntax::visit; use syntax::visit::Visitor; @@ -105,7 +105,7 @@ pub fn block_query(b: &ast::Block, p: @fn(@ast::expr) -> bool) -> bool { return *rs; } -pub fn local_rhs_span(l: @ast::Local, def: span) -> span { +pub fn local_rhs_span(l: @ast::Local, def: Span) -> Span { match l.init { Some(i) => return i.span, _ => return def diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 3549323cf08..de839239e72 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -26,7 +26,7 @@ use middle::ty; use middle::typeck; use syntax::abi::AbiSet; use syntax::ast_map; -use syntax::codemap::span; +use syntax::codemap::Span; use syntax::parse::token; use syntax::print::pprust; use syntax::{ast, ast_util}; @@ -69,7 +69,7 @@ pub fn explain_region(cx: ctxt, region: ty::Region) -> ~str { pub fn explain_region_and_span(cx: ctxt, region: ty::Region) - -> (~str, Option<span>) { + -> (~str, Option<Span>) { return match region { re_scope(node_id) => { match cx.items.find(&node_id) { @@ -136,8 +136,8 @@ pub fn explain_region_and_span(cx: ctxt, region: ty::Region) } }; - fn explain_span(cx: ctxt, heading: &str, span: span) - -> (~str, Option<span>) + fn explain_span(cx: ctxt, heading: &str, span: Span) + -> (~str, Option<Span>) { let lo = cx.sess.codemap.lookup_char_pos_adj(span.lo); (fmt!("the %s at %u:%u", heading, @@ -827,7 +827,7 @@ impl Repr for ty::BuiltinBounds { } } -impl Repr for span { +impl Repr for Span { fn repr(&self, tcx: ctxt) -> ~str { tcx.sess.codemap.span_to_str(*self) } |
