Skip to content

Commit 032d93d

Browse files
committed
---
yaml --- r: 143927 b: refs/heads/try2 c: 9f37932 h: refs/heads/master i: 143925: cbcd2cf 143923: 8fde6dc 143919: a3844c2 v: v3
1 parent 1b0f6f3 commit 032d93d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1156
-1525
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4fd5318594621df3e9a460fa583bc2d291ba4b3a
8+
refs/heads/try2: 9f379329db48e613f910167a8840fd2c13581dd9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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/try2/doc/rustpkg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ When building a package that is in a `git` repository,
103103
When building a package that is not under version control,
104104
or that has no tags, `rustpkg` assumes the intended version is 0.1.
105105

106+
> **Note:** A future version of rustpkg will support semantic versions.
107+
> Also, a future version will add the option to specify a version with a metadata
108+
> attribute like `#[link(vers = "3.1415")]` inside the crate module,
109+
> though this attribute will never be mandatory.
110+
106111
# Dependencies
107112

108113
rustpkg infers dependencies from `extern mod` directives.

branches/try2/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/try2/src/libextra/crypto/sha1.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Sha1 {
159159
}
160160

161161
impl Digest for Sha1 {
162-
pub fn reset(&mut self) {
162+
fn reset(&mut self) {
163163
self.length_bits = 0;
164164
self.h[0] = 0x67452301u32;
165165
self.h[1] = 0xEFCDAB89u32;
@@ -169,9 +169,9 @@ impl Digest for Sha1 {
169169
self.buffer.reset();
170170
self.computed = false;
171171
}
172-
pub fn input(&mut self, msg: &[u8]) { add_input(self, msg); }
173-
pub fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); }
174-
pub fn output_bits(&self) -> uint { 160 }
172+
fn input(&mut self, msg: &[u8]) { add_input(self, msg); }
173+
fn result(&mut self, out: &mut [u8]) { return mk_result(self, out); }
174+
fn output_bits(&self) -> uint { 160 }
175175
}
176176

177177
#[cfg(test)]

branches/try2/src/libextra/dlist.rs

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::cast;
2626
use std::ptr;
2727
use std::util;
2828
use std::iterator::{FromIterator, Extendable, Invert};
29+
use std::iterator;
2930

3031
use container::Deque;
3132

@@ -589,12 +590,27 @@ impl<A, T: Iterator<A>> Extendable<A, T> for DList<A> {
589590
impl<A: Eq> Eq for DList<A> {
590591
fn eq(&self, other: &DList<A>) -> bool {
591592
self.len() == other.len() &&
592-
self.iter().zip(other.iter()).all(|(a, b)| a.eq(b))
593+
iterator::order::eq(self.iter(), other.iter())
593594
}
594595

595-
#[inline]
596596
fn ne(&self, other: &DList<A>) -> bool {
597-
!self.eq(other)
597+
self.len() != other.len() &&
598+
iterator::order::ne(self.iter(), other.iter())
599+
}
600+
}
601+
602+
impl<A: Eq + Ord> Ord for DList<A> {
603+
fn lt(&self, other: &DList<A>) -> bool {
604+
iterator::order::lt(self.iter(), other.iter())
605+
}
606+
fn le(&self, other: &DList<A>) -> bool {
607+
iterator::order::le(self.iter(), other.iter())
608+
}
609+
fn gt(&self, other: &DList<A>) -> bool {
610+
iterator::order::gt(self.iter(), other.iter())
611+
}
612+
fn ge(&self, other: &DList<A>) -> bool {
613+
iterator::order::ge(self.iter(), other.iter())
598614
}
599615
}
600616

@@ -964,6 +980,48 @@ mod tests {
964980
assert_eq!(&n, &m);
965981
}
966982

983+
#[test]
984+
fn test_ord() {
985+
let n: DList<int> = list_from([]);
986+
let m = list_from([1,2,3]);
987+
assert!(n < m);
988+
assert!(m > n);
989+
assert!(n <= n);
990+
assert!(n >= n);
991+
}
992+
993+
#[test]
994+
fn test_ord_nan() {
995+
let nan = 0.0/0.0;
996+
let n = list_from([nan]);
997+
let m = list_from([nan]);
998+
assert!(!(n < m));
999+
assert!(!(n > m));
1000+
assert!(!(n <= m));
1001+
assert!(!(n >= m));
1002+
1003+
let n = list_from([nan]);
1004+
let one = list_from([1.0]);
1005+
assert!(!(n < one));
1006+
assert!(!(n > one));
1007+
assert!(!(n <= one));
1008+
assert!(!(n >= one));
1009+
1010+
let u = list_from([1.0,2.0,nan]);
1011+
let v = list_from([1.0,2.0,3.0]);
1012+
assert!(!(u < v));
1013+
assert!(!(u > v));
1014+
assert!(!(u <= v));
1015+
assert!(!(u >= v));
1016+
1017+
let s = list_from([1.0,2.0,4.0,2.0]);
1018+
let t = list_from([1.0,2.0,3.0,2.0]);
1019+
assert!(!(s < t));
1020+
assert!(s > one);
1021+
assert!(!(s <= one));
1022+
assert!(s >= one);
1023+
}
1024+
9671025
#[test]
9681026
fn test_fuzz() {
9691027
do 25.times {

branches/try2/src/libextra/enum_set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub struct EnumSet<E> {
2121
/// An iterface for casting C-like enum to uint and back.
2222
pub trait CLike {
2323
/// Converts C-like enum to uint.
24-
pub fn to_uint(&self) -> uint;
24+
fn to_uint(&self) -> uint;
2525
/// Converts uint to C-like enum.
26-
pub fn from_uint(uint) -> Self;
26+
fn from_uint(uint) -> Self;
2727
}
2828

2929
fn bit<E:CLike>(e: E) -> uint {
@@ -142,11 +142,11 @@ mod test {
142142
}
143143

144144
impl CLike for Foo {
145-
pub fn to_uint(&self) -> uint {
145+
fn to_uint(&self) -> uint {
146146
*self as uint
147147
}
148148

149-
pub fn from_uint(v: uint) -> Foo {
149+
fn from_uint(v: uint) -> Foo {
150150
unsafe { cast::transmute(v) }
151151
}
152152
}

branches/try2/src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ impl ToStrRadix for BigUint {
537537
impl FromStrRadix for BigUint {
538538
/// Creates and initializes an BigUint.
539539
540-
pub fn from_str_radix(s: &str, radix: uint)
540+
fn from_str_radix(s: &str, radix: uint)
541541
-> Option<BigUint> {
542542
BigUint::parse_bytes(s.as_bytes(), radix)
543543
}

branches/try2/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/try2/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub struct Metric {
104104
pub struct MetricMap(TreeMap<~str,Metric>);
105105

106106
impl Clone for MetricMap {
107-
pub fn clone(&self) -> MetricMap {
107+
fn clone(&self) -> MetricMap {
108108
MetricMap((**self).clone())
109109
}
110110
}

branches/try2/src/libextra/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl<K: TotalOrd, V, T: Iterator<(K, V)>> Extendable<(K, V), T> for TreeMap<K, V
853853
}
854854

855855
impl<T: TotalOrd, Iter: Iterator<T>> FromIterator<T, Iter> for TreeSet<T> {
856-
pub fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
856+
fn from_iterator(iter: &mut Iter) -> TreeSet<T> {
857857
let mut set = TreeSet::new();
858858
set.extend(iter);
859859
set

branches/try2/src/libextra/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ pub fn to_str(url: &Url) -> ~str {
701701
}
702702

703703
impl ToStr for Url {
704-
pub fn to_str(&self) -> ~str {
704+
fn to_str(&self) -> ~str {
705705
to_str(self)
706706
}
707707
}

branches/try2/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/try2/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/try2/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
}

0 commit comments

Comments
 (0)