Skip to content

Commit c10e0cb

Browse files
committed
syntax: Change syntax extensions to expand to std::foo instead of core::foo
1 parent 9200237 commit c10e0cb

File tree

16 files changed

+75
-53
lines changed

16 files changed

+75
-53
lines changed

src/libextra/std.rc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ pub mod serialize;
125125
pub mod std {
126126
pub use serialize;
127127
pub use test;
128+
129+
// For bootstrapping.
130+
pub use core::clone;
131+
pub use core::condition;
132+
pub use core::cmp;
133+
pub use core::sys;
128134
}
129135
#[doc(hidden)] // FIXME #3538
130136
pub mod extra {

src/librustc/rustc.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ extern mod extra(name = "extra");
2929
extern mod syntax;
3030

3131
// For deriving(Encodable) purposes...
32+
#[cfg(stage0)]
3233
extern mod std(name = "extra", vers = "0.7-pre");
34+
#[cfg(not(stage0))]
35+
extern mod std(name = "std", vers = "0.7-pre");
3336

3437
use core::prelude::*;
3538

src/libstd/core.rc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,14 @@ mod core {
225225
pub use sys;
226226
pub use pipes;
227227
}
228+
#[doc(hidden)]
229+
mod std {
230+
pub use clone;
231+
pub use cmp;
232+
pub use condition;
233+
pub use option;
234+
pub use kinds;
235+
pub use sys;
236+
pub use pipes;
237+
}
228238

src/libsyntax/ext/deriving/clone.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn expand_deriving_clone(cx: @ExtCtxt,
2222
in_items: ~[@item])
2323
-> ~[@item] {
2424
let trait_def = TraitDef {
25-
path: Path::new(~["core", "clone", "Clone"]),
25+
path: Path::new(~["std", "clone", "Clone"]),
2626
additional_bounds: ~[],
2727
generics: LifetimeBounds::empty(),
2828
methods: ~[
@@ -49,7 +49,7 @@ pub fn expand_deriving_deep_clone(cx: @ExtCtxt,
4949
in_items: ~[@item])
5050
-> ~[@item] {
5151
let trait_def = TraitDef {
52-
path: Path::new(~["core", "clone", "DeepClone"]),
52+
path: Path::new(~["std", "clone", "DeepClone"]),
5353
additional_bounds: ~[],
5454
generics: LifetimeBounds::empty(),
5555
methods: ~[

src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn expand_deriving_eq(cx: @ExtCtxt,
4646
);
4747

4848
let trait_def = TraitDef {
49-
path: Path::new(~["core", "cmp", "Eq"]),
49+
path: Path::new(~["std", "cmp", "Eq"]),
5050
additional_bounds: ~[],
5151
generics: LifetimeBounds::empty(),
5252
methods: ~[

src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ pub fn expand_deriving_ord(cx: @ExtCtxt,
3838

3939

4040
let trait_def = TraitDef {
41-
path: Path::new(~["core", "cmp", "Ord"]),
41+
path: Path::new(~["std", "cmp", "Ord"]),
4242
// XXX: Ord doesn't imply Eq yet
43-
additional_bounds: ~[Literal(Path::new(~["core", "cmp", "Eq"]))],
43+
additional_bounds: ~[Literal(Path::new(~["std", "cmp", "Eq"]))],
4444
generics: LifetimeBounds::empty(),
4545
methods: ~[
4646
md!("lt", true, false),

src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn expand_deriving_totaleq(cx: @ExtCtxt,
2727
}
2828

2929
let trait_def = TraitDef {
30-
path: Path::new(~["core", "cmp", "TotalEq"]),
30+
path: Path::new(~["std", "cmp", "TotalEq"]),
3131
additional_bounds: ~[],
3232
generics: LifetimeBounds::empty(),
3333
methods: ~[

src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
2222
mitem: @meta_item,
2323
in_items: ~[@item]) -> ~[@item] {
2424
let trait_def = TraitDef {
25-
path: Path::new(~["core", "cmp", "TotalOrd"]),
25+
path: Path::new(~["std", "cmp", "TotalOrd"]),
2626
additional_bounds: ~[],
2727
generics: LifetimeBounds::empty(),
2828
methods: ~[
@@ -31,7 +31,7 @@ pub fn expand_deriving_totalord(cx: @ExtCtxt,
3131
generics: LifetimeBounds::empty(),
3232
explicit_self: borrowed_explicit_self(),
3333
args: ~[borrowed_self()],
34-
ret_ty: Literal(Path::new(~["core", "cmp", "Ordering"])),
34+
ret_ty: Literal(Path::new(~["std", "cmp", "Ordering"])),
3535
const_nonmatching: false,
3636
combine_substructure: cs_cmp
3737
}
@@ -51,7 +51,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> @expr {
5151
};
5252
cx.expr_path(
5353
cx.path_global(span,
54-
~[cx.ident_of("core"),
54+
~[cx.ident_of("std"),
5555
cx.ident_of("cmp"),
5656
cx.ident_of(cnst)]))
5757
}
@@ -64,7 +64,7 @@ pub fn cs_cmp(cx: @ExtCtxt, span: span,
6464
false,
6565
|cx, span, old, new| {
6666
cx.expr_call_global(span,
67-
~[cx.ident_of("core"),
67+
~[cx.ident_of("std"),
6868
cx.ident_of("cmp"),
6969
cx.ident_of("lexical_ordering")],
7070
~[old, new])

src/libsyntax/ext/deriving/iter_bytes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
2121
mitem: @meta_item,
2222
in_items: ~[@item]) -> ~[@item] {
2323
let trait_def = TraitDef {
24-
path: Path::new(~["core", "to_bytes", "IterBytes"]),
24+
path: Path::new(~["std", "to_bytes", "IterBytes"]),
2525
additional_bounds: ~[],
2626
generics: LifetimeBounds::empty(),
2727
methods: ~[
@@ -31,7 +31,7 @@ pub fn expand_deriving_iter_bytes(cx: @ExtCtxt,
3131
explicit_self: borrowed_explicit_self(),
3232
args: ~[
3333
Literal(Path::new(~["bool"])),
34-
Literal(Path::new(~["core", "to_bytes", "Cb"]))
34+
Literal(Path::new(~["std", "to_bytes", "Cb"]))
3535
],
3636
ret_ty: Literal(Path::new(~["bool"])),
3737
const_nonmatching: false,

src/libsyntax/ext/deriving/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The compiler code necessary to implement the #[deriving] extensions.
1313
1414
1515
FIXME (#2810)--Hygiene. Search for "__" strings (in other files too).
16-
We also assume "extra" is the standard library, and "core" is the core
16+
We also assume "extra" is the standard library, and "std" is the core
1717
library.
1818
1919
*/

0 commit comments

Comments
 (0)