Skip to content

snapshot #8476

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 2 commits 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
97 changes: 0 additions & 97 deletions src/libextra/terminfo/parm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,103 +475,6 @@ impl FormatOp {
}
}

#[cfg(stage0)]
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
let mut s = match val {
Number(d) => {
match op {
FormatString => {
return Err(~"non-number on stack with %s")
}
_ => {
let radix = match op {
FormatDigit => 10,
FormatOctal => 8,
FormatHex|FormatHEX => 16,
FormatString => util::unreachable()
};
let mut s = ~[];
match op {
FormatDigit => {
let sign = if flags.sign { SignAll } else { SignNeg };
do int_to_str_bytes_common(d, radix, sign) |c| {
s.push(c);
}
}
_ => {
do int_to_str_bytes_common(d as uint, radix, SignNone) |c| {
s.push(c);
}
}
};
if flags.precision > s.len() {
let mut s_ = vec::with_capacity(flags.precision);
let n = flags.precision - s.len();
s_.grow(n, &('0' as u8));
s_.push_all_move(s);
s = s_;
}
assert!(!s.is_empty(), "string conversion produced empty result");
match op {
FormatDigit => {
if flags.space && !(s[0] == '-' as u8 || s[0] == '+' as u8) {
s.unshift(' ' as u8);
}
}
FormatOctal => {
if flags.alternate && s[0] != '0' as u8 {
s.unshift('0' as u8);
}
}
FormatHex => {
if flags.alternate {
let s_ = util::replace(&mut s, ~['0' as u8, 'x' as u8]);
s.push_all_move(s_);
}
}
FormatHEX => {
s = s.into_ascii().to_upper().into_bytes();
if flags.alternate {
let s_ = util::replace(&mut s, ~['0' as u8, 'X' as u8]);
s.push_all_move(s_);
}
}
FormatString => util::unreachable()
}
s
}
}
}
String(s) => {
match op {
FormatString => {
let mut s = s.as_bytes().to_owned();
if flags.precision > 0 && flags.precision < s.len() {
s.truncate(flags.precision);
}
s
}
_ => {
return Err(fmt!("non-string on stack with %%%c", op.to_char()))
}
}
}
};
if flags.width > s.len() {
let n = flags.width - s.len();
if flags.left {
s.grow(n, &(' ' as u8));
} else {
let mut s_ = vec::with_capacity(flags.width);
s_.grow(n, &(' ' as u8));
s_.push_all_move(s);
s = s_;
}
}
Ok(s)
}

#[cfg(not(stage0))]
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
let mut s = match val {
Number(d) => {
Expand Down
13 changes: 0 additions & 13 deletions src/librustc/back/rpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
os::make_absolute(lib).dir_path()
}

#[cfg(stage0)]
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");

if install_prefix == "" {
fail!("rustc compiled without CFG_PREFIX environment variable");
}

let tlib = filesearch::relative_target_lib_path(target_triple);
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
}

#[cfg(not(stage0))]
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
let install_prefix = env!("CFG_PREFIX");

Expand Down
19 changes: 0 additions & 19 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,25 +578,6 @@ pub fn build_target_config(sopts: @session::options,
return target_cfg;
}

#[cfg(stage0)]
pub fn host_triple() -> ~str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
// actually built. We can't just take LLVM's host triple because they
// normalize all ix86 architectures to i386.
//
// Instead of grabbing the host triple (for the current host), we grab (at
// compile time) the target triple that this rustc is built with and
// calling that (at runtime) the host triple.
let ht = env!("CFG_COMPILER_TRIPLE");
return if ht != "" {
ht.to_owned()
} else {
fail!("rustc built without CFG_COMPILER_TRIPLE")
};
}

#[cfg(not(stage0))]
pub fn host_triple() -> ~str {
// Get the host triple out of the build environment. This ensures that our
// idea of the host triple is the same as for the set of libraries we've
Expand Down
10 changes: 0 additions & 10 deletions src/librustc/metadata/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,6 @@ fn push_if_exists(vec: &mut ~[Path], p: &Path) {

// The name of the directory rustc expects libraries to be located.
// On Unix should be "lib", on windows "bin"
#[cfg(stage0)]
pub fn libdir() -> ~str {
let libdir = env!("CFG_LIBDIR");
if libdir.is_empty() {
fail!("rustc compiled without CFG_LIBDIR environment variable");
}
libdir.to_owned()
}

#[cfg(not(stage0))]
pub fn libdir() -> ~str {
(env!("CFG_LIBDIR")).to_owned()
}
10 changes: 0 additions & 10 deletions src/librustc/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ mod std {
}
*/

#[cfg(stage0)]
pub fn version(argv0: &str) {
let mut vers = ~"unknown version";
let env_vers = env!("CFG_VERSION");
if env_vers.len() != 0 { vers = env_vers.to_owned(); }
printfln!("%s %s", argv0, vers);
printfln!("host: %s", host_triple());
}

#[cfg(not(stage0))]
pub fn version(argv0: &str) {
let vers = match option_env!("CFG_VERSION") {
Some(vers) => vers,
Expand Down
10 changes: 0 additions & 10 deletions src/libstd/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,10 @@ mod tests {
}
}

#[cfg(stage0)]
#[test]
fn test_transmute2() {
unsafe {
assert_eq!(~[76u8, 0u8], transmute(~"L"));
}
}

#[cfg(not(stage0))]
#[test]
fn test_transmute2() {
unsafe {
assert_eq!(~[76u8], transmute(~"L"));
}
}

}
14 changes: 0 additions & 14 deletions src/libstd/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,20 +1707,6 @@ pub fn with_bytes_writer(f: &fn(@Writer)) -> ~[u8] {
(*bytes).clone()
}

#[cfg(stage0)]
pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
let mut v = with_bytes_writer(f);

// Make sure the vector has a trailing null and is proper utf8.
v.push(0);
assert!(str::is_utf8(v));

unsafe {
::cast::transmute(v)
}
}

#[cfg(not(stage0))]
pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
str::from_bytes(with_bytes_writer(f))
}
Expand Down
Loading