about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-20 15:20:16 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-05-22 21:57:08 -0700
commitc10e0cb9c984ece484a5c8c9c4c20369e2be499b (patch)
tree23f4a3a11a7efc8861f9b8878a8d6ec8bfa14260
parent9200237b4d86cba8f3b222ff8957f79d54ecd0e1 (diff)
downloadrust-c10e0cb9c984ece484a5c8c9c4c20369e2be499b.tar.gz
rust-c10e0cb9c984ece484a5c8c9c4c20369e2be499b.zip
syntax: Change syntax extensions to expand to `std::foo` instead of `core::foo`
-rw-r--r--src/libextra/std.rc6
-rw-r--r--src/librustc/rustc.rc3
-rw-r--r--src/libstd/core.rc10
-rw-r--r--src/libsyntax/ext/deriving/clone.rs4
-rw-r--r--src/libsyntax/ext/deriving/cmp/eq.rs2
-rw-r--r--src/libsyntax/ext/deriving/cmp/ord.rs4
-rw-r--r--src/libsyntax/ext/deriving/cmp/totaleq.rs2
-rw-r--r--src/libsyntax/ext/deriving/cmp/totalord.rs8
-rw-r--r--src/libsyntax/ext/deriving/iter_bytes.rs4
-rw-r--r--src/libsyntax/ext/deriving/mod.rs2
-rw-r--r--src/libsyntax/ext/deriving/rand.rs6
-rw-r--r--src/libsyntax/ext/deriving/to_str.rs4
-rw-r--r--src/libsyntax/ext/expand.rs26
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs1
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs44
-rw-r--r--src/libsyntax/syntax.rc2
16 files changed, 75 insertions, 53 deletions
diff --git a/src/libextra/std.rc b/src/libextra/std.rc
index 777f45e84bc..7f9902dfc8c 100644
--- a/src/libextra/std.rc
+++ b/src/libextra/std.rc
@@ -125,6 +125,12 @@ pub mod serialize;
 pub mod std {
     pub use serialize;
     pub use test;
+
+    // For bootstrapping.
+    pub use core::clone;
+    pub use core::condition;
+    pub use core::cmp;
+    pub use core::sys;
 }
 #[doc(hidden)] // FIXME #3538
 pub mod extra {
diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc
index 04375b45793..2b392efaa85 100644
--- a/src/librustc/rustc.rc
+++ b/src/librustc/rustc.rc
@@ -29,7 +29,10 @@ extern mod extra(name = "extra");
 extern mod syntax;
 
 // For deriving(Encodable) purposes...
+#[cfg(stage0)]
 extern mod std(name = "extra", vers = "0.7-pre");
+#[cfg(not(stage0))]
+extern mod std(name = "std", vers = "0.7-pre");
 
 use core::prelude::*;
 
diff --git a/src/libstd/core.rc b/src/libstd/core.rc
index f9c4612d043..0b9e09cfa8d 100644
--- a/src/libstd/core.rc
+++ b/src/libstd/core.rc
@@ -225,4 +225,14 @@ mod core {
     pub use sys;
     pub use pipes;
 }
+#[doc(hidden)]
+mod std {
+    pub use clone;
+    pub use cmp;
+    pub use condition;
+    pub use option;
+    pub use kinds;
+    pub use sys;
+    pub use pipes;
+}
 
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 69e15a8dd67..8d9abb186fd 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -22,7 +22,7 @@ pub fn expand_deriving_clone(cx: @ExtCtxt,
                              in_items: ~[@item])
                           -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "clone", "Clone"]),
+        path: Path::new(~["std", "clone", "Clone"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
@@ -49,7 +49,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
                                  in_items: ~[@item])
     -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "clone", "DeepClone"]),
+        path: Path::new(~["std", "clone", "DeepClone"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs
index 81434e8ec62..67107b4218a 100644
--- a/src/libsyntax/ext/deriving/cmp/eq.rs
+++ b/src/libsyntax/ext/deriving/cmp/eq.rs
@@ -46,7 +46,7 @@ pub fn expand_deriving_eq(cx: @ExtCtxt,
     );
 
     let trait_def = TraitDef {
-        path: Path::new(~["core", "cmp", "Eq"]),
+        path: Path::new(~["std", "cmp", "Eq"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs
index 7e549c25665..8b8ee37691c 100644
--- a/src/libsyntax/ext/deriving/cmp/ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/ord.rs
@@ -38,9 +38,9 @@ pub fn expand_deriving_ord(cx: @ExtCtxt,
 
 
     let trait_def = TraitDef {
-        path: Path::new(~["core", "cmp", "Ord"]),
+        path: Path::new(~["std", "cmp", "Ord"]),
         // XXX: Ord doesn't imply Eq yet
-        additional_bounds: ~[Literal(Path::new(~["core", "cmp", "Eq"]))],
+        additional_bounds: ~[Literal(Path::new(~["std", "cmp", "Eq"]))],
         generics: LifetimeBounds::empty(),
         methods: ~[
             md!("lt", true,  false),
diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs
index 39764a72ece..f07c8949438 100644
--- a/src/libsyntax/ext/deriving/cmp/totaleq.rs
+++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs
@@ -27,7 +27,7 @@ pub fn expand_deriving_totaleq(cx: @ExtCtxt,
     }
 
     let trait_def = TraitDef {
-        path: Path::new(~["core", "cmp", "TotalEq"]),
+        path: Path::new(~["std", "cmp", "TotalEq"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs
index 561a1577e7e..4c1c940927b 100644
--- a/src/libsyntax/ext/deriving/cmp/totalord.rs
+++ b/src/libsyntax/ext/deriving/cmp/totalord.rs
@@ -22,7 +22,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
                                 mitem: @meta_item,
                                 in_items: ~[@item]) -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "cmp", "TotalOrd"]),
+        path: Path::new(~["std", "cmp", "TotalOrd"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
@@ -31,7 +31,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
                 generics: LifetimeBounds::empty(),
                 explicit_self: borrowed_explicit_self(),
                 args: ~[borrowed_self()],
-                ret_ty: Literal(Path::new(~["core", "cmp", "Ordering"])),
+                ret_ty: Literal(Path::new(~["std", "cmp", "Ordering"])),
                 const_nonmatching: false,
                 combine_substructure: cs_cmp
             }
@@ -51,7 +51,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> @expr {
     };
     cx.expr_path(
         cx.path_global(span,
-                       ~[cx.ident_of("core"),
+                       ~[cx.ident_of("std"),
                          cx.ident_of("cmp"),
                          cx.ident_of(cnst)]))
 }
@@ -64,7 +64,7 @@ pub fn cs_cmp(cx: @ExtCtxt, span: span,
         false,
         |cx, span, old, new| {
             cx.expr_call_global(span,
-                                ~[cx.ident_of("core"),
+                                ~[cx.ident_of("std"),
                                   cx.ident_of("cmp"),
                                   cx.ident_of("lexical_ordering")],
                                 ~[old, new])
diff --git a/src/libsyntax/ext/deriving/iter_bytes.rs b/src/libsyntax/ext/deriving/iter_bytes.rs
index 7a818a4e04f..401b91227fc 100644
--- a/src/libsyntax/ext/deriving/iter_bytes.rs
+++ b/src/libsyntax/ext/deriving/iter_bytes.rs
@@ -21,7 +21,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
                                   mitem: @meta_item,
                                   in_items: ~[@item]) -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "to_bytes", "IterBytes"]),
+        path: Path::new(~["std", "to_bytes", "IterBytes"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
@@ -31,7 +31,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
                 explicit_self: borrowed_explicit_self(),
                 args: ~[
                     Literal(Path::new(~["bool"])),
-                    Literal(Path::new(~["core", "to_bytes", "Cb"]))
+                    Literal(Path::new(~["std", "to_bytes", "Cb"]))
                 ],
                 ret_ty: Literal(Path::new(~["bool"])),
                 const_nonmatching: false,
diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs
index 63ef8716149..3159b6db0af 100644
--- a/src/libsyntax/ext/deriving/mod.rs
+++ b/src/libsyntax/ext/deriving/mod.rs
@@ -13,7 +13,7 @@ The compiler code necessary to implement the #[deriving] extensions.
 
 
 FIXME (#2810)--Hygiene. Search for "__" strings (in other files too).
-We also assume "extra" is the standard library, and "core" is the core
+We also assume "extra" is the standard library, and "std" is the core
 library.
 
 */
diff --git a/src/libsyntax/ext/deriving/rand.rs b/src/libsyntax/ext/deriving/rand.rs
index df92693d324..d62e4972fd1 100644
--- a/src/libsyntax/ext/deriving/rand.rs
+++ b/src/libsyntax/ext/deriving/rand.rs
@@ -23,7 +23,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt,
                             in_items: ~[@item])
     -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "rand", "Rand"]),
+        path: Path::new(~["std", "rand", "Rand"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
@@ -32,7 +32,7 @@ pub fn expand_deriving_rand(cx: @ExtCtxt,
                 generics: LifetimeBounds {
                     lifetimes: ~[],
                     bounds: ~[("R",
-                               ~[ Path::new(~["core", "rand", "Rng"]) ])]
+                               ~[ Path::new(~["std", "rand", "Rng"]) ])]
                 },
                 explicit_self: None,
                 args: ~[
@@ -55,7 +55,7 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
         _ => cx.bug("Incorrect number of arguments to `rand` in `deriving(Rand)`")
     };
     let rand_ident = ~[
-        cx.ident_of("core"),
+        cx.ident_of("std"),
         cx.ident_of("rand"),
         cx.ident_of("Rand"),
         cx.ident_of("rand")
diff --git a/src/libsyntax/ext/deriving/to_str.rs b/src/libsyntax/ext/deriving/to_str.rs
index 2e00bba27b3..52efabd4b9b 100644
--- a/src/libsyntax/ext/deriving/to_str.rs
+++ b/src/libsyntax/ext/deriving/to_str.rs
@@ -22,7 +22,7 @@ pub fn expand_deriving_to_str(cx: @ExtCtxt,
                               in_items: ~[@item])
     -> ~[@item] {
     let trait_def = TraitDef {
-        path: Path::new(~["core", "to_str", "ToStr"]),
+        path: Path::new(~["std", "to_str", "ToStr"]),
         additional_bounds: ~[],
         generics: LifetimeBounds::empty(),
         methods: ~[
@@ -46,7 +46,7 @@ fn to_str_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr
         [self_obj] => {
             let self_addr = cx.expr_addr_of(span, self_obj);
             cx.expr_call_global(span,
-                                ~[cx.ident_of("core"),
+                                ~[cx.ident_of("std"),
                                   cx.ident_of("sys"),
                                   cx.ident_of("log_str")],
                                 ~[self_addr])
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index c74a4dfb5cd..7fa235fc334 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -438,28 +438,28 @@ pub fn core_macros() -> ~str {
             fail!(\"explicit failure\")
         );
         ($msg:expr) => (
-            ::core::sys::FailWithCause::fail_with($msg, file!(), line!())
+            ::std::sys::FailWithCause::fail_with($msg, file!(), line!())
         );
         ($( $arg:expr ),+) => (
-            ::core::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!())
+            ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!())
         )
     )
 
     macro_rules! assert(
         ($cond:expr) => {
             if !$cond {
-                ::core::sys::FailWithCause::fail_with(
+                ::std::sys::FailWithCause::fail_with(
                     ~\"assertion failed: \" + stringify!($cond), file!(), line!())
             }
         };
         ($cond:expr, $msg:expr) => {
             if !$cond {
-                ::core::sys::FailWithCause::fail_with($msg, file!(), line!())
+                ::std::sys::FailWithCause::fail_with($msg, file!(), line!())
             }
         };
         ($cond:expr, $( $arg:expr ),+) => {
             if !$cond {
-                ::core::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!())
+                ::std::sys::FailWithCause::fail_with(fmt!( $($arg),+ ), file!(), line!())
             }
         }
     )
@@ -480,7 +480,7 @@ pub fn core_macros() -> ~str {
     macro_rules! assert_approx_eq (
         ($given:expr , $expected:expr) => (
             {
-                use core::cmp::ApproxEq;
+                use std::cmp::ApproxEq;
 
                 let given_val = $given;
                 let expected_val = $expected;
@@ -496,7 +496,7 @@ pub fn core_macros() -> ~str {
         );
         ($given:expr , $expected:expr , $epsilon:expr) => (
             {
-                use core::cmp::ApproxEq;
+                use std::cmp::ApproxEq;
 
                 let given_val = $given;
                 let expected_val = $expected;
@@ -518,11 +518,11 @@ pub fn core_macros() -> ~str {
         { pub $c:ident: $in:ty -> $out:ty; } => {
 
             pub mod $c {
-                fn key(_x: @::core::condition::Handler<$in,$out>) { }
+                fn key(_x: @::std::condition::Handler<$in,$out>) { }
 
                 pub static cond :
-                    ::core::condition::Condition<'static,$in,$out> =
-                    ::core::condition::Condition {
+                    ::std::condition::Condition<'static,$in,$out> =
+                    ::std::condition::Condition {
                         name: stringify!($c),
                         key: key
                     };
@@ -533,11 +533,11 @@ pub fn core_macros() -> ~str {
 
             // FIXME (#6009): remove mod's `pub` below once variant above lands.
             pub mod $c {
-                fn key(_x: @::core::condition::Handler<$in,$out>) { }
+                fn key(_x: @::std::condition::Handler<$in,$out>) { }
 
                 pub static cond :
-                    ::core::condition::Condition<'static,$in,$out> =
-                    ::core::condition::Condition {
+                    ::std::condition::Condition<'static,$in,$out> =
+                    ::std::condition::Condition {
                         name: stringify!($c),
                         key: key
                     };
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 6d6db23a378..545b5338ab1 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -63,3 +63,4 @@ impl append_types for @ast::Path {
         }
     }
 }
+
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index 7ed375efc54..1a7b7e55ace 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -77,10 +77,10 @@ impl gen_send for message {
                 };
 
                 body += ~"let mut b = pipe.reuse_buffer();\n";
-                body += fmt!("let %s = ::core::pipes::SendPacketBuffered(\
+                body += fmt!("let %s = ::std::pipes::SendPacketBuffered(\
                               &mut (b.buffer.data.%s));\n",
                              sp, next.name);
-                body += fmt!("let %s = ::core::pipes::RecvPacketBuffered(\
+                body += fmt!("let %s = ::std::pipes::RecvPacketBuffered(\
                               &mut (b.buffer.data.%s));\n",
                              rp, next.name);
             }
@@ -92,7 +92,7 @@ impl gen_send for message {
                   (recv, recv) => "(c, s)"
                 };
 
-                body += fmt!("let %s = ::core::pipes::entangle();\n", pat);
+                body += fmt!("let %s = ::std::pipes::entangle();\n", pat);
             }
             body += fmt!("let message = %s(%s);\n",
                          name,
@@ -101,14 +101,14 @@ impl gen_send for message {
                              ~"s"), ", "));
 
             if !try {
-                body += fmt!("::core::pipes::send(pipe, message);\n");
+                body += fmt!("::std::pipes::send(pipe, message);\n");
                 // return the new channel
                 body += ~"c }";
             }
             else {
-                body += fmt!("if ::core::pipes::send(pipe, message) {\n \
-                                  ::core::pipes::rt::make_some(c) \
-                              } else { ::core::pipes::rt::make_none() } }");
+                body += fmt!("if ::std::pipes::send(pipe, message) {\n \
+                                  ::std::pipes::rt::make_some(c) \
+                              } else { ::std::pipes::rt::make_none() } }");
             }
 
             let body = cx.parse_expr(body);
@@ -160,14 +160,14 @@ impl gen_send for message {
                 body += fmt!("let message = %s%s;\n", name, message_args);
 
                 if !try {
-                    body += fmt!("::core::pipes::send(pipe, message);\n");
+                    body += fmt!("::std::pipes::send(pipe, message);\n");
                     body += ~" }";
                 } else {
-                    body += fmt!("if ::core::pipes::send(pipe, message) \
+                    body += fmt!("if ::std::pipes::send(pipe, message) \
                                         { \
-                                      ::core::pipes::rt::make_some(()) \
+                                      ::std::pipes::rt::make_some(()) \
                                   } else { \
-                                    ::core::pipes::rt::make_none() \
+                                    ::std::pipes::rt::make_none() \
                                   } }");
                 }
 
@@ -270,7 +270,7 @@ impl to_type_decls for state {
                     self.span,
                     self.data_name(),
                     cx.ty_path(
-                        path_global(~[cx.ident_of("core"),
+                        path_global(~[cx.ident_of("std"),
                                       cx.ident_of("pipes"),
                                       cx.ident_of(dir.to_str() + "Packet")],
                              dummy_sp())
@@ -288,7 +288,7 @@ impl to_type_decls for state {
                     self.span,
                     self.data_name(),
                     cx.ty_path(
-                        path_global(~[cx.ident_of("core"),
+                        path_global(~[cx.ident_of("std"),
                                       cx.ident_of("pipes"),
                                       cx.ident_of(dir.to_str()
                                                   + "PacketBuffered")],
@@ -315,10 +315,10 @@ impl gen_init for protocol {
 
         let body = if !self.is_bounded() {
             match start_state.dir {
-              send => quote_expr!( ::core::pipes::entangle() ),
+              send => quote_expr!( ::std::pipes::entangle() ),
               recv => {
                 quote_expr!({
-                    let (s, c) = ::core::pipes::entangle();
+                    let (s, c) = ::std::pipes::entangle();
                     (c, s)
                 })
               }
@@ -338,7 +338,7 @@ impl gen_init for protocol {
         };
 
         cx.parse_item(fmt!("pub fn init%s() -> (client::%s, server::%s)\
-                            { pub use core::pipes::HasBuffer; %s }",
+                            { pub use std::pipes::HasBuffer; %s }",
                            start_state.generics.to_source(cx),
                            start_state.to_ty(cx).to_source(cx),
                            start_state.to_ty(cx).to_source(cx),
@@ -355,7 +355,7 @@ impl gen_init for protocol {
                 ext_cx.field_imm(dummy_sp(),
                                  ext_cx.ident_of(s.name),
                                  quote_expr!(
-                                     ::core::pipes::mk_packet::<$fty>()
+                                     ::std::pipes::mk_packet::<$fty>()
                                  ))
             }))
     }
@@ -363,8 +363,8 @@ impl gen_init for protocol {
     fn gen_init_bounded(&self, ext_cx: @ExtCtxt) -> @ast::expr {
         debug!("gen_init_bounded");
         let buffer_fields = self.gen_buffer_init(ext_cx);
-        let buffer = quote_expr!(~::core::pipes::Buffer {
-            header: ::core::pipes::BufferHeader(),
+        let buffer = quote_expr!(~::std::pipes::Buffer {
+            header: ::std::pipes::BufferHeader(),
             data: $buffer_fields,
         });
 
@@ -376,12 +376,12 @@ impl gen_init for protocol {
                         fmt!("data.%s.set_buffer(buffer)",
                              s.name))),
                 Some(ext_cx.parse_expr(fmt!(
-                    "::core::ptr::to_mut_unsafe_ptr(&mut (data.%s))",
+                    "::std::ptr::to_mut_unsafe_ptr(&mut (data.%s))",
                     self.states[0].name)))));
 
         quote_expr!({
             let buffer = $buffer;
-            do ::core::pipes::entangle_buffer(buffer) |buffer, data| {
+            do ::std::pipes::entangle_buffer(buffer) |buffer, data| {
                 $entangle_body
             }
         })
@@ -416,7 +416,7 @@ impl gen_init for protocol {
             }
 
             let ty = s.to_ty(cx);
-            let fty = quote_ty!( ::core::pipes::Packet<$ty> );
+            let fty = quote_ty!( ::std::pipes::Packet<$ty> );
 
             @spanned {
                 node: ast::struct_field_ {
diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc
index 8ec281a6bc1..cb1c2269c1e 100644
--- a/src/libsyntax/syntax.rc
+++ b/src/libsyntax/syntax.rc
@@ -32,6 +32,8 @@ extern mod extra(name = "extra");
 // For deriving(Encodable) purposes...
 #[cfg(stage0)]
 extern mod std(name = "extra");
+#[cfg(not(stage0))]
+extern mod std(name = "std");
 
 use core::prelude::*;