about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/doc/index.md1
-rw-r--r--src/doc/tutorial.md14
-rw-r--r--src/libextra/lib.rs6
-rw-r--r--src/libnum/bigint.rs (renamed from src/libextra/num/bigint.rs)15
-rw-r--r--src/libnum/complex.rs (renamed from src/libextra/num/complex.rs)4
-rw-r--r--src/libnum/lib.rs22
-rw-r--r--src/libnum/rational.rs (renamed from src/libextra/num/rational.rs)11
-rw-r--r--src/librustc/driver/driver.rs2
-rw-r--r--src/libsyntax/ext/expand.rs21
-rw-r--r--src/libsyntax/parse/token.rs1
-rw-r--r--src/test/bench/shootout-pidigits.rs4
-rw-r--r--src/test/compile-fail/keyword-do-as-identifier.rs13
-rw-r--r--src/test/run-pass/phase-use-ignored.rs19
-rw-r--r--src/test/run-pass/temporary-lifetime-for-conditions.rs6
14 files changed, 95 insertions, 44 deletions
diff --git a/src/doc/index.md b/src/doc/index.md
index 44b81d0a568..ebc5a1a3c46 100644
--- a/src/doc/index.md
+++ b/src/doc/index.md
@@ -38,6 +38,7 @@ li {list-style-type: none; }
 * [The Rust compiler, `librustc`](rustc/index.html)
 
 * [The `arena` allocation library](arena/index.html)
+* [The `num` arbitrary precision numerics library](num/index.html)
 * [The `collections` library](collections/index.html)
 * [The `flate` compression library](flate/index.html)
 * [The `fourcc` four-character code library](fourcc/index.html)
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index 73fec54fbcb..f94aa5b9104 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -3026,12 +3026,12 @@ In Rust terminology, we need a way to refer to other crates.
 For that, Rust offers you the `extern mod` declaration:
 
 ~~~
-extern mod extra;
-// extra ships with Rust, you'll find more details further down.
+extern mod num;
+// `num` ships with Rust (much like `extra`; more details further down).
 
 fn main() {
     // The rational number '1/2':
-    let one_half = ::extra::rational::Ratio::new(1, 2);
+    let one_half = ::num::rational::Ratio::new(1, 2);
 }
 ~~~
 
@@ -3056,10 +3056,10 @@ of both `use` and local declarations.
 Which can result in something like this:
 
 ~~~
-extern mod extra;
+extern mod num;
 
 use farm::dog;
-use extra::rational::Ratio;
+use num::rational::Ratio;
 
 mod farm {
     pub fn dog() { println!("woof"); }
@@ -3224,9 +3224,9 @@ See the [API documentation][stddoc] for details.
 
 ## The extra library
 
-Rust also ships with the [extra library], an accumulation of useful things,
+Rust ships with crates such as the [extra library], an accumulation of useful things,
 that are however not important enough to deserve a place in the standard
-library.  You can use them by linking to `extra` with an `extern mod extra;`.
+library.  You can link to a library such as `extra` with an `extern mod extra;`.
 
 [extra library]: extra/index.html
 
diff --git a/src/libextra/lib.rs b/src/libextra/lib.rs
index 109bf2e489b..70a21da6816 100644
--- a/src/libextra/lib.rs
+++ b/src/libextra/lib.rs
@@ -62,12 +62,6 @@ pub mod time;
 pub mod base64;
 pub mod workcache;
 pub mod enum_set;
-#[path="num/bigint.rs"]
-pub mod bigint;
-#[path="num/rational.rs"]
-pub mod rational;
-#[path="num/complex.rs"]
-pub mod complex;
 pub mod stats;
 pub mod hex;
 
diff --git a/src/libextra/num/bigint.rs b/src/libnum/bigint.rs
index cfbc17ca61a..56385c6f43b 100644
--- a/src/libextra/num/bigint.rs
+++ b/src/libnum/bigint.rs
@@ -16,9 +16,6 @@ A `BigUint` is represented as an array of `BigDigit`s.
 A `BigInt` is a combination of `BigUint` and `Sign`.
 */
 
-#[allow(missing_doc)];
-#[allow(non_uppercase_statics)];
-
 use std::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
 use std::num;
 use std::num::{Zero, One, ToStrRadix, FromStrRadix, Orderable};
@@ -48,7 +45,7 @@ pub type BigDigit = u32;
 pub static ZERO_BIG_DIGIT: BigDigit = 0;
 
 pub mod BigDigit {
-    use bigint::BigDigit;
+    use super::BigDigit;
 
     #[cfg(target_word_size = "32")]
     pub static bits: uint = 16;
@@ -1433,8 +1430,8 @@ impl BigInt {
 
 #[cfg(test)]
 mod biguint_tests {
-    use super::*;
-    use super::RandBigInt;
+    use super::{BigDigit, BigUint, ToBigUint};
+    use super::{Plus, BigInt, RandBigInt, ToBigInt};
 
     use std::cmp::{Less, Equal, Greater};
     use std::i64;
@@ -2090,8 +2087,8 @@ mod biguint_tests {
 
 #[cfg(test)]
 mod bigint_tests {
-    use super::*;
-    use super::RandBigInt;
+    use super::{BigDigit, BigUint, ToBigUint};
+    use super::{Sign, Minus, Zero, Plus, BigInt, RandBigInt, ToBigInt};
 
     use std::cmp::{Less, Equal, Greater};
     use std::i64;
@@ -2591,7 +2588,7 @@ mod bigint_tests {
 
 #[cfg(test)]
 mod bench {
-    use super::*;
+    use super::{BigInt, BigUint};
     use std::iter;
     use std::mem::replace;
     use std::num::{FromPrimitive, Zero, One};
diff --git a/src/libextra/num/complex.rs b/src/libnum/complex.rs
index 47a2e35f028..a832834b8e4 100644
--- a/src/libextra/num/complex.rs
+++ b/src/libnum/complex.rs
@@ -191,7 +191,7 @@ impl<T: ToStrRadix + Num + Ord> ToStrRadix for Cmplx<T> {
 mod test {
     #[allow(non_uppercase_statics)];
 
-    use super::*;
+    use super::{Complex64, Cmplx};
     use std::num::{Zero,One,Real};
 
     pub static _0_0i : Complex64 = Cmplx { re: 0.0, im: 0.0 };
@@ -285,7 +285,7 @@ mod test {
     }
 
     mod arith {
-        use super::*;
+        use super::{_0_0i, _1_0i, _1_1i, _0_1i, _neg1_1i, _05_05i, all_consts};
         use std::num::Zero;
 
         #[test]
diff --git a/src/libnum/lib.rs b/src/libnum/lib.rs
new file mode 100644
index 00000000000..5a5e717363a
--- /dev/null
+++ b/src/libnum/lib.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[feature(macro_rules)];
+
+#[crate_id = "num#0.10-pre"];
+#[crate_type = "rlib"];
+#[crate_type = "dylib"];
+#[license = "MIT/ASL2"];
+
+extern mod extra;
+
+pub mod bigint;
+pub mod rational;
+pub mod complex;
diff --git a/src/libextra/num/rational.rs b/src/libnum/rational.rs
index c5b405a45aa..698a109a756 100644
--- a/src/libextra/num/rational.rs
+++ b/src/libnum/rational.rs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -10,11 +10,10 @@
 
 //! Rational numbers
 
-
 use std::cmp;
 use std::from_str::FromStr;
 use std::num::{Zero,One,ToStrRadix,FromStrRadix,Round};
-use super::bigint::{BigInt, BigUint, Sign, Plus, Minus};
+use bigint::{BigInt, BigUint, Sign, Plus, Minus};
 
 /// Represents the ratio between 2 numbers.
 #[deriving(Clone)]
@@ -349,7 +348,7 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
 #[cfg(test)]
 mod test {
 
-    use super::*;
+    use super::{Ratio, Rational, BigRational};
     use std::num::{Zero,One,FromStrRadix,FromPrimitive};
     use std::from_str::FromStr;
 
@@ -449,8 +448,8 @@ mod test {
 
 
     mod arith {
-        use super::*;
-        use super::super::*;
+        use super::{_0, _1, _2, _1_2, _3_2, _neg1_2, to_big};
+        use super::super::{Ratio, Rational, BigRational};
 
 
         #[test]
diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs
index a23348bb0ff..fb261eb7310 100644
--- a/src/librustc/driver/driver.rs
+++ b/src/librustc/driver/driver.rs
@@ -1085,7 +1085,7 @@ pub fn build_output_filenames(input: &Input,
             // We want to toss everything after the final '.'
             let dirpath = match *odir {
                 Some(ref d) => d.clone(),
-                None => os::getcwd(),
+                None => Path::new(".")
             };
 
             let mut stem = match *input {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index cfad88e2482..69611829c7c 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -394,15 +394,20 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander)
 pub fn expand_view_item(vi: &ast::ViewItem,
                         fld: &mut MacroExpander)
                         -> ast::ViewItem {
-    let should_load = vi.attrs.iter().any(|attr| {
-        attr.name().get() == "phase" &&
-            attr.meta_item_list().map_or(false, |phases| {
-                attr::contains_name(phases, "syntax")
-            })
-    });
+    match vi.node {
+        ast::ViewItemExternMod(..) => {
+            let should_load = vi.attrs.iter().any(|attr| {
+                attr.name().get() == "phase" &&
+                    attr.meta_item_list().map_or(false, |phases| {
+                        attr::contains_name(phases, "syntax")
+                    })
+            });
 
-    if should_load {
-        load_extern_macros(vi, fld);
+            if should_load {
+                load_extern_macros(vi, fld);
+            }
+        }
+        ast::ViewItemUse(_) => {}
     }
 
     noop_fold_view_item(vi, fld)
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index d32411b4f05..1e9eab1573b 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -492,6 +492,7 @@ declare_special_idents_and_keywords! {
         (53,                         Typeof,     "typeof");
         (54,                         Unsized,    "unsized");
         (55,                         Yield,      "yield");
+        (56,                         Do,         "do");
     }
 }
 
diff --git a/src/test/bench/shootout-pidigits.rs b/src/test/bench/shootout-pidigits.rs
index ba9bd40e08e..33f20cf0d1f 100644
--- a/src/test/bench/shootout-pidigits.rs
+++ b/src/test/bench/shootout-pidigits.rs
@@ -8,13 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-extern mod extra;
+extern mod num;
 
 use std::from_str::FromStr;
 use std::num::One;
 use std::num::Zero;
 use std::num::FromPrimitive;
-use extra::bigint::BigInt;
+use num::bigint::BigInt;
 
 struct Context {
     numer: BigInt,
diff --git a/src/test/compile-fail/keyword-do-as-identifier.rs b/src/test/compile-fail/keyword-do-as-identifier.rs
new file mode 100644
index 00000000000..90f73f8a9f4
--- /dev/null
+++ b/src/test/compile-fail/keyword-do-as-identifier.rs
@@ -0,0 +1,13 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+    let do = "bar"; //~ error: ident
+}
diff --git a/src/test/run-pass/phase-use-ignored.rs b/src/test/run-pass/phase-use-ignored.rs
new file mode 100644
index 00000000000..6819ab347b0
--- /dev/null
+++ b/src/test/run-pass/phase-use-ignored.rs
@@ -0,0 +1,19 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//xfail-fast
+
+#[feature(phase)];
+
+#[phase(syntax)]
+use std::mem;
+
+fn main() {}
+
diff --git a/src/test/run-pass/temporary-lifetime-for-conditions.rs b/src/test/run-pass/temporary-lifetime-for-conditions.rs
index 1985970b107..0716ea5cdeb 100644
--- a/src/test/run-pass/temporary-lifetime-for-conditions.rs
+++ b/src/test/run-pass/temporary-lifetime-for-conditions.rs
@@ -23,7 +23,7 @@ impl Drop for Temporary {
 }
 
 impl Temporary {
-    fn do(&self) -> bool {true}
+    fn do_stuff(&self) -> bool {true}
 }
 
 fn borrow() -> ~Temporary { ~Temporary }
@@ -35,7 +35,7 @@ pub fn main() {
     // This loop's condition
     // should call `Temporary`'s
     // `drop` 6 times.
-    while borrow().do() {
+    while borrow().do_stuff() {
         i += 1;
         if i > 5 {
             break;
@@ -44,7 +44,7 @@ pub fn main() {
 
     // This if condition should
     // call it 1 time
-    if borrow().do() {
+    if borrow().do_stuff() {
         unsafe { assert_eq!(DROPPED, 7) }
     }
 }