Skip to content

Modernized a few type names in rustc and syntax #8911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/librustc/back/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ 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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
Expand Down
32 changes: 16 additions & 16 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand All @@ -845,7 +845,7 @@ pub fn get_cc_prog(sess: Session) -> ~str {
(--android-cross-path)")
}
},
session::os_win32 => ~"g++",
session::OsWin32 => ~"g++",
_ => ~"cc"
}
}
Expand Down Expand Up @@ -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()]);
}

Expand All @@ -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
Expand All @@ -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"
};

Expand Down Expand Up @@ -995,28 +995,28 @@ 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());
}
}

// 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`,
// which lives in libm. Similar to above, on some linuxes we
// 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",
Expand All @@ -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");
}

Expand Down
14 changes: 7 additions & 7 deletions src/librustc/back/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ 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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
"-v64:64:64-v128:64:128" +
"-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" +
Expand Down
24 changes: 12 additions & 12 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ 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)
-> ~[~str] {
let os = sess.targ_cfg.os;

// No rpath on windows
if os == session::os_win32 {
if os == session::OsWin32 {
return ~[];
}

Expand All @@ -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],
Expand Down Expand Up @@ -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 {
Expand All @@ -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)))
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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"));
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/back/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/back/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading