Skip to content

Commit a675c41

Browse files
---
yaml --- r: 63339 b: refs/heads/snap-stage3 c: 5de67f9 h: refs/heads/master i: 63337: 42c34ca 63335: 6edd4d6 v: v3
1 parent e26dc60 commit a675c41

File tree

5 files changed

+56
-107
lines changed

5 files changed

+56
-107
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 7d1065e913e6d50ddb1a157f81bb7752caeca329
4+
refs/heads/snap-stage3: 5de67f9cc9674752bb6b9db6c2db790a19ec4e9c
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 38 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,24 @@ pub fn source_name(input: &input) -> @str {
6565
6666
pub fn default_configuration(sess: Session, argv0: @str, input: &input) ->
6767
ast::crate_cfg {
68-
let libc = match sess.targ_cfg.os {
69-
session::os_win32 => @"msvcrt.dll",
70-
session::os_macos => @"libc.dylib",
71-
session::os_linux => @"libc.so.6",
72-
session::os_android => @"libc.so",
73-
session::os_freebsd => @"libc.so.7"
74-
// _ { "libc.so" }
68+
let (libc, tos) = match sess.targ_cfg.os {
69+
session::os_win32 => (@"msvcrt.dll", @"win32"),
70+
session::os_macos => (@"libc.dylib", @"macos"),
71+
session::os_linux => (@"libc.so.6", @"linux"),
72+
session::os_android => (@"libc.so", @"android"),
73+
session::os_freebsd => (@"libc.so.7", @"freebsd")
7574
};
76-
let tos = match sess.targ_cfg.os {
77-
session::os_win32 => @"win32",
78-
session::os_macos => @"macos",
79-
session::os_linux => @"linux",
80-
session::os_android => @"android",
81-
session::os_freebsd => @"freebsd"
82-
// _ { "libc.so" }
83-
};
84-
85-
let mk = attr::mk_name_value_item_str;
8675

8776
// ARM is bi-endian, however using NDK seems to default
8877
// to little-endian unless a flag is provided.
8978
let (end,arch,wordsz) = match sess.targ_cfg.arch {
90-
abi::X86 => (@"little",@"x86",@"32"),
91-
abi::X86_64 => (@"little",@"x86_64",@"64"),
92-
abi::Arm => (@"little",@"arm",@"32"),
93-
abi::Mips => (@"big",@"mips",@"32")
79+
abi::X86 => (@"little", @"x86", @"32"),
80+
abi::X86_64 => (@"little", @"x86_64", @"64"),
81+
abi::Arm => (@"little", @"arm", @"32"),
82+
abi::Mips => (@"big", @"mips", @"32")
9483
};
9584

85+
let mk = attr::mk_name_value_item_str;
9686
return ~[ // Target bindings.
9787
attr::mk_word_item(os::FAMILY.to_managed()),
9888
mk(@"target_os", tos),
@@ -463,36 +453,37 @@ pub fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: &input,
463453
}
464454
465455
pub fn get_os(triple: &str) -> Option<session::os> {
466-
if triple.contains("win32") ||
467-
triple.contains("mingw32") {
468-
Some(session::os_win32)
469-
} else if triple.contains("darwin") {
470-
Some(session::os_macos)
471-
} else if triple.contains("android") {
472-
Some(session::os_android)
473-
} else if triple.contains("linux") {
474-
Some(session::os_linux)
475-
} else if triple.contains("freebsd") {
476-
Some(session::os_freebsd)
477-
} else { None }
456+
for os_names.each |&(name, os)| {
457+
if triple.contains(name) { return Some(os) }
458+
}
459+
None
478460
}
461+
static os_names : &'static [(&'static str, session::os)] = &'static [
462+
("win32", session::os_win32),
463+
("darwin", session::os_macos),
464+
("android", session::os_android),
465+
("linux", session::os_linux),
466+
("freebsd", session::os_freebsd)];
479467

480468
pub fn get_arch(triple: &str) -> Option<abi::Architecture> {
481-
if triple.contains("i386") ||
482-
triple.contains("i486") ||
483-
triple.contains("i586") ||
484-
triple.contains("i686") ||
485-
triple.contains("i786") {
486-
Some(abi::X86)
487-
} else if triple.contains("x86_64") {
488-
Some(abi::X86_64)
489-
} else if triple.contains("arm") ||
490-
triple.contains("xscale") {
491-
Some(abi::Arm)
492-
} else if triple.contains("mips") {
493-
Some(abi::Mips)
494-
} else { None }
469+
for architecture_abis.each |&(arch, abi)| {
470+
if triple.contains(arch) { return Some(abi) }
471+
}
472+
None
495473
}
474+
static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'static [
475+
("i386", abi::X86),
476+
("i486", abi::X86),
477+
("i586", abi::X86),
478+
("i686", abi::X86),
479+
("i786", abi::X86),
480+
481+
("x86_64", abi::X86_64),
482+
483+
("arm", abi::Arm),
484+
("xscale", abi::Arm),
485+
486+
("mips", abi::Mips)];
496487

497488
pub fn build_target_config(sopts: @session::options,
498489
demitter: diagnostic::Emitter)

branches/snap-stage3/src/libstd/core.rc

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,49 @@
1010

1111
/*!
1212

13-
# The Rust standard library
13+
# The Rust core library
1414

15-
The Rust standard library provides runtime features required by the language,
15+
The Rust core library provides runtime features required by the language,
1616
including the task scheduler and memory allocators, as well as library
1717
support for Rust built-in types, platform abstractions, and other commonly
1818
used features.
1919

20-
`std` includes modules corresponding to each of the integer types, each of
20+
`core` includes modules corresponding to each of the integer types, each of
2121
the floating point types, the `bool` type, tuples, characters, strings
2222
(`str`), vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`),
23-
and unsafe and borrowed pointers (`ptr`). Additionally, `std` provides
23+
and unsafe and borrowed pointers (`ptr`). Additionally, `core` provides
2424
pervasive types (`option` and `result`), task creation and communication
2525
primitives (`task`, `comm`), platform abstractions (`os` and `path`), basic
2626
I/O abstractions (`io`), common traits (`kinds`, `ops`, `cmp`, `num`,
2727
`to_str`), and complete bindings to the C standard library (`libc`).
2828

29-
# Standard library injection and the Rust prelude
29+
# Core injection and the Rust prelude
3030

31-
`std` is imported at the topmost level of every crate by default, as
31+
`core` is imported at the topmost level of every crate by default, as
3232
if the first line of each crate was
3333

34-
extern mod std;
34+
extern mod core;
3535

36-
This means that the contents of std can be accessed from any context
37-
with the `std::` path prefix, as in `use std::vec`, `use std::task::spawn`,
36+
This means that the contents of core can be accessed from any context
37+
with the `core::` path prefix, as in `use core::vec`, `use core::task::spawn`,
3838
etc.
3939

40-
Additionally, `std` contains a `prelude` module that reexports many of the
41-
most common std modules, types and traits. The contents of the prelude are
40+
Additionally, `core` contains a `prelude` module that reexports many of the
41+
most common core modules, types and traits. The contents of the prelude are
4242
imported into every *module* by default. Implicitly, all modules behave as if
4343
they contained the following prologue:
4444

45-
use std::prelude::*;
45+
use core::prelude::*;
4646

4747
*/
4848

4949

5050
#[link(name = "std",
5151
vers = "0.7-pre",
5252
uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8",
53-
url = "https://github.com/mozilla/rust/tree/master/src/libstd")];
53+
url = "https://github.com/mozilla/rust/tree/master/src/libcore")];
5454

55-
#[comment = "The Rust standard library"];
55+
#[comment = "The Rust core library"];
5656
#[license = "MIT/ASL2"];
5757
#[crate_type = "lib"];
5858

branches/snap-stage3/src/libsyntax/ext/deriving/rand.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,18 @@ fn rand_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
7979
let variant_count = cx.expr_uint(span, variants.len());
8080

8181
// need to specify the uint-ness of the random number
82-
let uint_ty = cx.ty_ident(span, cx.ident_of("uint"));
82+
let u32_ty = cx.ty_ident(span, cx.ident_of("uint"));
8383
let r_ty = cx.ty_ident(span, cx.ident_of("R"));
84-
let rand_name = cx.path_all(span, true, copy rand_ident, None, ~[ uint_ty, r_ty ]);
84+
let rand_name = cx.path_all(span, false, copy rand_ident, None, ~[ u32_ty, r_ty ]);
8585
let rand_name = cx.expr_path(rand_name);
8686

87-
// ::std::rand::Rand::rand::<uint>(rng)
8887
let rv_call = cx.expr_call(span,
8988
rand_name,
9089
~[ rng[0].duplicate(cx) ]);
9190

9291
// rand() % variants.len()
9392
let rand_variant = cx.expr_binary(span, ast::rem,
94-
rv_call, variant_count);
93+
rv_call, variant_count);
9594

9695
let mut arms = do variants.mapi |i, id_sum| {
9796
let i_expr = cx.expr_uint(span, i);

branches/snap-stage3/src/test/run-pass/deriving-global.rs

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)