Skip to content

Commit 44675ac

Browse files
committed
auto merge of rust-lang#8476 : thestinger/rust/snapshot, r=brson
2 parents d9492d7 + 0cb0ef2 commit 44675ac

File tree

14 files changed

+24
-748
lines changed

14 files changed

+24
-748
lines changed

src/libextra/terminfo/parm.rs

-97
Original file line numberDiff line numberDiff line change
@@ -475,103 +475,6 @@ impl FormatOp {
475475
}
476476
}
477477

478-
#[cfg(stage0)]
479-
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
480-
let mut s = match val {
481-
Number(d) => {
482-
match op {
483-
FormatString => {
484-
return Err(~"non-number on stack with %s")
485-
}
486-
_ => {
487-
let radix = match op {
488-
FormatDigit => 10,
489-
FormatOctal => 8,
490-
FormatHex|FormatHEX => 16,
491-
FormatString => util::unreachable()
492-
};
493-
let mut s = ~[];
494-
match op {
495-
FormatDigit => {
496-
let sign = if flags.sign { SignAll } else { SignNeg };
497-
do int_to_str_bytes_common(d, radix, sign) |c| {
498-
s.push(c);
499-
}
500-
}
501-
_ => {
502-
do int_to_str_bytes_common(d as uint, radix, SignNone) |c| {
503-
s.push(c);
504-
}
505-
}
506-
};
507-
if flags.precision > s.len() {
508-
let mut s_ = vec::with_capacity(flags.precision);
509-
let n = flags.precision - s.len();
510-
s_.grow(n, &('0' as u8));
511-
s_.push_all_move(s);
512-
s = s_;
513-
}
514-
assert!(!s.is_empty(), "string conversion produced empty result");
515-
match op {
516-
FormatDigit => {
517-
if flags.space && !(s[0] == '-' as u8 || s[0] == '+' as u8) {
518-
s.unshift(' ' as u8);
519-
}
520-
}
521-
FormatOctal => {
522-
if flags.alternate && s[0] != '0' as u8 {
523-
s.unshift('0' as u8);
524-
}
525-
}
526-
FormatHex => {
527-
if flags.alternate {
528-
let s_ = util::replace(&mut s, ~['0' as u8, 'x' as u8]);
529-
s.push_all_move(s_);
530-
}
531-
}
532-
FormatHEX => {
533-
s = s.into_ascii().to_upper().into_bytes();
534-
if flags.alternate {
535-
let s_ = util::replace(&mut s, ~['0' as u8, 'X' as u8]);
536-
s.push_all_move(s_);
537-
}
538-
}
539-
FormatString => util::unreachable()
540-
}
541-
s
542-
}
543-
}
544-
}
545-
String(s) => {
546-
match op {
547-
FormatString => {
548-
let mut s = s.as_bytes().to_owned();
549-
if flags.precision > 0 && flags.precision < s.len() {
550-
s.truncate(flags.precision);
551-
}
552-
s
553-
}
554-
_ => {
555-
return Err(fmt!("non-string on stack with %%%c", op.to_char()))
556-
}
557-
}
558-
}
559-
};
560-
if flags.width > s.len() {
561-
let n = flags.width - s.len();
562-
if flags.left {
563-
s.grow(n, &(' ' as u8));
564-
} else {
565-
let mut s_ = vec::with_capacity(flags.width);
566-
s_.grow(n, &(' ' as u8));
567-
s_.push_all_move(s);
568-
s = s_;
569-
}
570-
}
571-
Ok(s)
572-
}
573-
574-
#[cfg(not(stage0))]
575478
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
576479
let mut s = match val {
577480
Number(d) => {

src/librustc/back/rpath.rs

-13
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,6 @@ pub fn get_absolute_rpath(lib: &Path) -> Path {
130130
os::make_absolute(lib).dir_path()
131131
}
132132

133-
#[cfg(stage0)]
134-
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
135-
let install_prefix = env!("CFG_PREFIX");
136-
137-
if install_prefix == "" {
138-
fail!("rustc compiled without CFG_PREFIX environment variable");
139-
}
140-
141-
let tlib = filesearch::relative_target_lib_path(target_triple);
142-
os::make_absolute(&Path(install_prefix).push_rel(&tlib))
143-
}
144-
145-
#[cfg(not(stage0))]
146133
pub fn get_install_prefix_rpath(target_triple: &str) -> Path {
147134
let install_prefix = env!("CFG_PREFIX");
148135

src/librustc/driver/driver.rs

-19
Original file line numberDiff line numberDiff line change
@@ -578,25 +578,6 @@ pub fn build_target_config(sopts: @session::options,
578578
return target_cfg;
579579
}
580580
581-
#[cfg(stage0)]
582-
pub fn host_triple() -> ~str {
583-
// Get the host triple out of the build environment. This ensures that our
584-
// idea of the host triple is the same as for the set of libraries we've
585-
// actually built. We can't just take LLVM's host triple because they
586-
// normalize all ix86 architectures to i386.
587-
//
588-
// Instead of grabbing the host triple (for the current host), we grab (at
589-
// compile time) the target triple that this rustc is built with and
590-
// calling that (at runtime) the host triple.
591-
let ht = env!("CFG_COMPILER_TRIPLE");
592-
return if ht != "" {
593-
ht.to_owned()
594-
} else {
595-
fail!("rustc built without CFG_COMPILER_TRIPLE")
596-
};
597-
}
598-
599-
#[cfg(not(stage0))]
600581
pub fn host_triple() -> ~str {
601582
// Get the host triple out of the build environment. This ensures that our
602583
// idea of the host triple is the same as for the set of libraries we've

src/librustc/metadata/filesearch.rs

-10
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,6 @@ fn push_if_exists(vec: &mut ~[Path], p: &Path) {
200200

201201
// The name of the directory rustc expects libraries to be located.
202202
// On Unix should be "lib", on windows "bin"
203-
#[cfg(stage0)]
204-
pub fn libdir() -> ~str {
205-
let libdir = env!("CFG_LIBDIR");
206-
if libdir.is_empty() {
207-
fail!("rustc compiled without CFG_LIBDIR environment variable");
208-
}
209-
libdir.to_owned()
210-
}
211-
212-
#[cfg(not(stage0))]
213203
pub fn libdir() -> ~str {
214204
(env!("CFG_LIBDIR")).to_owned()
215205
}

src/librustc/rustc.rs

-10
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@ mod std {
117117
}
118118
*/
119119

120-
#[cfg(stage0)]
121-
pub fn version(argv0: &str) {
122-
let mut vers = ~"unknown version";
123-
let env_vers = env!("CFG_VERSION");
124-
if env_vers.len() != 0 { vers = env_vers.to_owned(); }
125-
printfln!("%s %s", argv0, vers);
126-
printfln!("host: %s", host_triple());
127-
}
128-
129-
#[cfg(not(stage0))]
130120
pub fn version(argv0: &str) {
131121
let vers = match option_env!("CFG_VERSION") {
132122
Some(vers) => vers,

src/libstd/cast.rs

-10
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,10 @@ mod tests {
165165
}
166166
}
167167
168-
#[cfg(stage0)]
169-
#[test]
170-
fn test_transmute2() {
171-
unsafe {
172-
assert_eq!(~[76u8, 0u8], transmute(~"L"));
173-
}
174-
}
175-
176-
#[cfg(not(stage0))]
177168
#[test]
178169
fn test_transmute2() {
179170
unsafe {
180171
assert_eq!(~[76u8], transmute(~"L"));
181172
}
182173
}
183-
184174
}

src/libstd/io.rs

-14
Original file line numberDiff line numberDiff line change
@@ -1707,20 +1707,6 @@ pub fn with_bytes_writer(f: &fn(@Writer)) -> ~[u8] {
17071707
(*bytes).clone()
17081708
}
17091709

1710-
#[cfg(stage0)]
1711-
pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
1712-
let mut v = with_bytes_writer(f);
1713-
1714-
// Make sure the vector has a trailing null and is proper utf8.
1715-
v.push(0);
1716-
assert!(str::is_utf8(v));
1717-
1718-
unsafe {
1719-
::cast::transmute(v)
1720-
}
1721-
}
1722-
1723-
#[cfg(not(stage0))]
17241710
pub fn with_str_writer(f: &fn(@Writer)) -> ~str {
17251711
str::from_bytes(with_bytes_writer(f))
17261712
}

0 commit comments

Comments
 (0)