Skip to content

Commit e79b8e6

Browse files
committed
---
yaml --- r: 85339 b: refs/heads/dist-snap c: 36882b3 h: refs/heads/master i: 85337: 17afcc3 85335: a26bc58 v: v3
1 parent 7b8094f commit e79b8e6

File tree

30 files changed

+844
-982
lines changed

30 files changed

+844
-982
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 0983ebe5310d4eb6d289f636f7ed0536c08bbc0e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a2ed09a006b5ae3cb671feb52e6ee2ea0e4f0a3a
9+
refs/heads/dist-snap: 36882b3d54043efc9f78459da39471fb8d5e6239
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/configure

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ opt docs 1 "build documentation"
371371
opt optimize 1 "build optimized rust code"
372372
opt optimize-cxx 1 "build optimized C++ code"
373373
opt optimize-llvm 1 "build optimized LLVM"
374+
opt optimize-tests 1 "build tests with optimizations"
374375
opt llvm-assertions 1 "build LLVM with assertions"
375376
opt debug 0 "build with extra debug fun"
376377
opt ratchet-bench 0 "ratchet benchmarks"

branches/dist-snap/mk/tests.mk

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,15 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
552552

553553
# The tests select when to use debug configuration on their own;
554554
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
555-
CTEST_RUSTC_FLAGS = $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
555+
CTEST_RUSTC_FLAGS := $$(subst --cfg debug,,$$(CFG_RUSTC_FLAGS))
556+
557+
# The tests can not be optimized while the rest of the compiler is optimized, so
558+
# filter out the optimization (if any) from rustc and then figure out if we need
559+
# to be optimized
560+
CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
561+
ifndef CFG_DISABLE_OPTIMIZE_TESTS
562+
CTEST_RUSTC_FLAGS += -O
563+
endif
556564

557565
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
558566
--compile-lib-path $$(HLIB$(1)_H_$(3)) \

branches/dist-snap/src/libextra/terminfo/parm.rs

Lines changed: 0 additions & 97 deletions
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) => {

branches/dist-snap/src/librustc/back/rpath.rs

Lines changed: 0 additions & 13 deletions
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

branches/dist-snap/src/librustc/driver/driver.rs

Lines changed: 0 additions & 19 deletions
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

branches/dist-snap/src/librustc/metadata/filesearch.rs

Lines changed: 0 additions & 10 deletions
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
}

branches/dist-snap/src/librustc/middle/check_const.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ pub fn check_expr(sess: Session,
160160
expr_field(*) |
161161
expr_index(*) |
162162
expr_tup(*) |
163-
expr_repeat(*) |
164163
expr_struct(*) => { }
165164
expr_addr_of(*) => {
166165
sess.span_err(

branches/dist-snap/src/librustc/middle/const_eval.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ pub fn classify(e: &expr,
153153
lookup_constness(tcx, e)
154154
}
155155

156-
ast::expr_repeat(*) => general_const,
157-
158156
_ => non_const
159157
};
160158
tcx.ccache.insert(did, cn);

branches/dist-snap/src/librustc/middle/trans/consts.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use middle::trans::type_::Type;
3232

3333
use std::c_str::ToCStr;
3434
use std::libc::c_uint;
35-
use std::vec;
3635
use syntax::{ast, ast_util, ast_map};
3736

3837
pub fn const_lit(cx: &mut CrateContext, e: &ast::expr, lit: ast::lit)
@@ -541,23 +540,6 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: &ast::expr) -> ValueRef {
541540
_ => cx.sess.span_bug(e.span, "bad const-slice expr")
542541
}
543542
}
544-
ast::expr_repeat(elem, count, _) => {
545-
let vec_ty = ty::expr_ty(cx.tcx, e);
546-
let unit_ty = ty::sequence_element_type(cx.tcx, vec_ty);
547-
let llunitty = type_of::type_of(cx, unit_ty);
548-
let n = match const_eval::eval_const_expr(cx.tcx, count) {
549-
const_eval::const_int(i) => i as uint,
550-
const_eval::const_uint(i) => i as uint,
551-
_ => cx.sess.span_bug(count.span, "count must be integral const expression.")
552-
};
553-
let vs = vec::from_elem(n, const_expr(cx, elem));
554-
let v = if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
555-
C_struct(vs)
556-
} else {
557-
C_array(llunitty, vs)
558-
};
559-
v
560-
}
561543
ast::expr_path(ref pth) => {
562544
assert_eq!(pth.types.len(), 0);
563545
let tcx = cx.tcx;

branches/dist-snap/src/librustc/rustc.rs

Lines changed: 0 additions & 10 deletions
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,

branches/dist-snap/src/libstd/cast.rs

Lines changed: 0 additions & 10 deletions
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
}

branches/dist-snap/src/libstd/char.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ use unicode::{derived_property, general_category};
2020
#[cfg(not(test))] use cmp::{Eq, Ord};
2121
#[cfg(not(test))] use num::Zero;
2222

23+
// UTF-8 ranges and tags for encoding characters
24+
static TAG_CONT: uint = 128u;
25+
static MAX_ONE_B: uint = 128u;
26+
static TAG_TWO_B: uint = 192u;
27+
static MAX_TWO_B: uint = 2048u;
28+
static TAG_THREE_B: uint = 224u;
29+
static MAX_THREE_B: uint = 65536u;
30+
static TAG_FOUR_B: uint = 240u;
31+
2332
/*
2433
Lu Uppercase_Letter an uppercase letter
2534
Ll Lowercase_Letter a lowercase letter
@@ -278,6 +287,12 @@ pub trait Char {
278287
fn escape_unicode(&self, f: &fn(char));
279288
fn escape_default(&self, f: &fn(char));
280289
fn len_utf8_bytes(&self) -> uint;
290+
291+
/// Encodes this character as utf-8 into the provided byte-buffer. The
292+
/// buffer must be at least 4 bytes long or a runtime failure will occur.
293+
///
294+
/// This will then return the number of characters written to the slice.
295+
fn encode_utf8(&self, dst: &mut [u8]) -> uint;
281296
}
282297

283298
impl Char for char {
@@ -308,6 +323,29 @@ impl Char for char {
308323
fn escape_default(&self, f: &fn(char)) { escape_default(*self, f) }
309324

310325
fn len_utf8_bytes(&self) -> uint { len_utf8_bytes(*self) }
326+
327+
fn encode_utf8<'a>(&self, dst: &'a mut [u8]) -> uint {
328+
let code = *self as uint;
329+
if code < MAX_ONE_B {
330+
dst[0] = code as u8;
331+
return 1;
332+
} else if code < MAX_TWO_B {
333+
dst[0] = (code >> 6u & 31u | TAG_TWO_B) as u8;
334+
dst[1] = (code & 63u | TAG_CONT) as u8;
335+
return 2;
336+
} else if code < MAX_THREE_B {
337+
dst[0] = (code >> 12u & 15u | TAG_THREE_B) as u8;
338+
dst[1] = (code >> 6u & 63u | TAG_CONT) as u8;
339+
dst[2] = (code & 63u | TAG_CONT) as u8;
340+
return 3;
341+
} else {
342+
dst[0] = (code >> 18u & 7u | TAG_FOUR_B) as u8;
343+
dst[1] = (code >> 12u & 63u | TAG_CONT) as u8;
344+
dst[2] = (code >> 6u & 63u | TAG_CONT) as u8;
345+
dst[3] = (code & 63u | TAG_CONT) as u8;
346+
return 4;
347+
}
348+
}
311349
}
312350

313351
#[cfg(not(test))]

0 commit comments

Comments
 (0)