Skip to content

Commit efe1a94

Browse files
committed
---
yaml --- r: 98126 b: refs/heads/master c: a5ed0c5 h: refs/heads/master v: v3
1 parent 5d59e2a commit efe1a94

28 files changed

+186
-57
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 29840addd46b6ae01b61ee93247164d5818f09e0
2+
refs/heads/master: a5ed0c58cb9f38af940403c34e283b68c89f5aa2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b6400f998497c3958f40997a71756ead344a776d
55
refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36

trunk/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ export CFG_PREFIX
418418
export CFG_LIBDIR
419419
export CFG_RUSTLIBDIR
420420
export CFG_LIBDIR_RELATIVE
421+
export CFG_DISABLE_INJECT_STD_VERSION
421422

422423
######################################################################
423424
# Subprograms

trunk/configure

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ opt clang 0 "prefer clang to gcc for building the runtime"
381381
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
382382
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
383383
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
384+
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
384385
valopt prefix "/usr/local" "set installation prefix"
385386
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
386387
valopt llvm-root "" "set LLVM root"
@@ -1042,6 +1043,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
10421043
putvar CFG_ANDROID_CROSS_PATH
10431044
putvar CFG_MINGW32_CROSS_PATH
10441045
putvar CFG_MANDIR
1046+
putvar CFG_DISABLE_INJECT_STD_VERSION
10451047

10461048
# Avoid spurious warnings from clang by feeding it original source on
10471049
# ccache-miss rather than preprocessed input.

trunk/doc/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
[Macros](guide-macros.html)
2020
[Packaging](guide-rustpkg.html)
2121
[Testing](guide-testing.html)
22-
[Conditions](guide-conditions.html)
22+
[Conditions](guide-conditions.html)
2323
[Rust's Runtime](guide-runtime.html)
2424

2525
# Libraries

trunk/src/libextra/comm.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Higher level communication abstractions.
1616

1717
#[allow(missing_doc)];
1818

19+
use std::comm;
20+
1921
/// An extension of `pipes::stream` that allows both sending and receiving.
2022
pub struct DuplexStream<T, U> {
2123
priv chan: Chan<T>,
@@ -40,7 +42,7 @@ impl<T:Send,U:Send> DuplexStream<T, U> {
4042
pub fn recv(&self) -> U {
4143
self.port.recv()
4244
}
43-
pub fn try_recv(&self) -> Option<U> {
45+
pub fn try_recv(&self) -> comm::TryRecvResult<U> {
4446
self.port.try_recv()
4547
}
4648
pub fn recv_opt(&self) -> Option<U> {
@@ -77,11 +79,11 @@ impl<T: Send> SyncPort<T> {
7779
})
7880
}
7981

80-
pub fn try_recv(&self) -> Option<T> {
81-
self.duplex_stream.try_recv().map(|val| {
82-
self.duplex_stream.try_send(());
83-
val
84-
})
82+
pub fn try_recv(&self) -> comm::TryRecvResult<T> {
83+
match self.duplex_stream.try_recv() {
84+
comm::Data(t) => { self.duplex_stream.try_send(()); comm::Data(t) }
85+
state => state,
86+
}
8587
}
8688
}
8789

trunk/src/libextra/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Rust extras are part of the standard Rust distribution.
2020
2121
*/
2222

23-
#[crate_id = "extra#0.10-pre"];
23+
// NOTE: upgrade to 0.10-pre after the next snapshot
24+
#[crate_id = "extra#0.9"];
2425
#[comment = "Rust extras"];
2526
#[license = "MIT/ASL2"];
2627
#[crate_type = "rlib"];

trunk/src/libextra/sync.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020

2121
use std::borrow;
22+
use std::comm;
2223
use std::unstable::sync::Exclusive;
2324
use std::sync::arc::UnsafeArc;
2425
use std::sync::atomics;
@@ -49,7 +50,7 @@ impl WaitQueue {
4950
// Signals one live task from the queue.
5051
fn signal(&self) -> bool {
5152
match self.head.try_recv() {
52-
Some(ch) => {
53+
comm::Data(ch) => {
5354
// Send a wakeup signal. If the waiter was killed, its port will
5455
// have closed. Keep trying until we get a live task.
5556
if ch.try_send_deferred(()) {
@@ -58,20 +59,20 @@ impl WaitQueue {
5859
self.signal()
5960
}
6061
}
61-
None => false
62+
_ => false
6263
}
6364
}
6465

6566
fn broadcast(&self) -> uint {
6667
let mut count = 0;
6768
loop {
6869
match self.head.try_recv() {
69-
None => break,
70-
Some(ch) => {
70+
comm::Data(ch) => {
7171
if ch.try_send_deferred(()) {
7272
count += 1;
7373
}
7474
}
75+
_ => break
7576
}
7677
}
7778
count

trunk/src/libextra/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ mod tests {
14591459
}
14601460
14611461
#[test]
1462-
#[ignore(cfg(android))] // FIXME #10958
1462+
#[ignore(cfg(target_os = "android"))] // FIXME #10958
14631463
fn run_tests() {
14641464
// The tests race on tzset. So instead of having many independent
14651465
// tests, we will just call the functions now.

trunk/src/libgreen/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#[macro_escape];
1414

1515
use std::fmt;
16-
use std::libc;
1716

1817
// Indicates whether we should perform expensive sanity checks, including rtassert!
1918
// XXX: Once the runtime matures remove the `true` below to turn off rtassert, etc.
@@ -124,6 +123,7 @@ memory and partly incapable of presentation to others.",
124123
abort();
125124

126125
fn abort() -> ! {
127-
unsafe { libc::abort() }
126+
use std::unstable::intrinsics;
127+
unsafe { intrinsics::abort() }
128128
}
129129
}

trunk/src/libgreen/sched.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ fn new_sched_rng() -> XorShiftRng {
958958

959959
#[cfg(test)]
960960
mod test {
961+
use std::comm;
961962
use std::task::TaskOpts;
962963
use std::rt::Runtime;
963964
use std::rt::task::Task;
@@ -1376,7 +1377,7 @@ mod test {
13761377
// This task should not be able to starve the sender;
13771378
// The sender should get stolen to another thread.
13781379
do spawn {
1379-
while port.try_recv().is_none() { }
1380+
while port.try_recv() != comm::Data(()) { }
13801381
}
13811382

13821383
chan.send(());
@@ -1393,7 +1394,7 @@ mod test {
13931394
// This task should not be able to starve the other task.
13941395
// The sends should eventually yield.
13951396
do spawn {
1396-
while port.try_recv().is_none() {
1397+
while port.try_recv() != comm::Data(()) {
13971398
chan2.send(());
13981399
}
13991400
}

trunk/src/librustc/front/std_inject.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ use syntax::fold;
2121
use syntax::opt_vec;
2222
use syntax::util::small_vector::SmallVector;
2323

24+
// NOTE: upgrade to 0.10-pre after the next snapshot
25+
pub static VERSION: &'static str = "0.9";
26+
2427
pub fn maybe_inject_libstd_ref(sess: Session, crate: ast::Crate)
2528
-> ast::Crate {
2629
if use_std(&crate) {
@@ -53,11 +56,21 @@ struct StandardLibraryInjector {
5356
sess: Session,
5457
}
5558

59+
pub fn with_version(crate: &str) -> Option<(@str, ast::StrStyle)> {
60+
match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
61+
Some("1") => None,
62+
_ => {
63+
Some((format!("{}\\#{}", crate, VERSION).to_managed(),
64+
ast::CookedStr))
65+
}
66+
}
67+
}
68+
5669
impl fold::Folder for StandardLibraryInjector {
5770
fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
5871
let mut vis = ~[ast::ViewItem {
5972
node: ast::ViewItemExternMod(self.sess.ident_of("std"),
60-
None,
73+
with_version("std"),
6174
ast::DUMMY_NODE_ID),
6275
attrs: ~[],
6376
vis: ast::Private,
@@ -67,15 +80,15 @@ impl fold::Folder for StandardLibraryInjector {
6780
if use_uv(&crate) && !self.sess.building_library.get() {
6881
vis.push(ast::ViewItem {
6982
node: ast::ViewItemExternMod(self.sess.ident_of("green"),
70-
None,
83+
with_version("green"),
7184
ast::DUMMY_NODE_ID),
7285
attrs: ~[],
7386
vis: ast::Private,
7487
span: DUMMY_SP
7588
});
7689
vis.push(ast::ViewItem {
7790
node: ast::ViewItemExternMod(self.sess.ident_of("rustuv"),
78-
None,
91+
with_version("rustuv"),
7992
ast::DUMMY_NODE_ID),
8093
attrs: ~[],
8194
vis: ast::Private,

trunk/src/librustc/front/test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use driver::session;
1515
use front::config;
16+
use front::std_inject::with_version;
1617

1718
use std::cell::RefCell;
1819
use std::vec;
@@ -292,7 +293,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
292293
ast::DUMMY_NODE_ID))])
293294
} else {
294295
ast::ViewItemExternMod(id_extra,
295-
None,
296+
with_version("extra"),
296297
ast::DUMMY_NODE_ID)
297298
};
298299
ast::ViewItem {

trunk/src/libstd/at_vec.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub fn append<T:Clone>(lhs: @[T], rhs: &[T]) -> @[T] {
6868

6969

7070
/// Apply a function to each element of a vector and return the results
71+
#[inline]
7172
pub fn map<T, U>(v: &[T], f: |x: &T| -> U) -> @[U] {
7273
build(Some(v.len()), |push| {
7374
for elem in v.iter() {
@@ -82,6 +83,7 @@ pub fn map<T, U>(v: &[T], f: |x: &T| -> U) -> @[U] {
8283
* Creates an immutable vector of size `n_elts` and initializes the elements
8384
* to the value returned by the function `op`.
8485
*/
86+
#[inline]
8587
pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> @[T] {
8688
build(Some(n_elts), |push| {
8789
let mut i: uint = 0u;
@@ -95,6 +97,7 @@ pub fn from_fn<T>(n_elts: uint, op: |uint| -> T) -> @[T] {
9597
* Creates an immutable vector of size `n_elts` and initializes the elements
9698
* to the value `t`.
9799
*/
100+
#[inline]
98101
pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> @[T] {
99102
build(Some(n_elts), |push| {
100103
let mut i: uint = 0u;
@@ -109,6 +112,7 @@ pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> @[T] {
109112
* Creates and initializes an immutable managed vector by moving all the
110113
* elements from an owned vector.
111114
*/
115+
#[inline]
112116
pub fn to_managed_move<T>(v: ~[T]) -> @[T] {
113117
let mut av = @[];
114118
unsafe {
@@ -124,6 +128,7 @@ pub fn to_managed_move<T>(v: ~[T]) -> @[T] {
124128
* Creates and initializes an immutable managed vector by copying all the
125129
* elements of a slice.
126130
*/
131+
#[inline]
127132
pub fn to_managed<T:Clone>(v: &[T]) -> @[T] {
128133
from_fn(v.len(), |i| v[i].clone())
129134
}
@@ -135,6 +140,7 @@ impl<T> Clone for @[T] {
135140
}
136141

137142
impl<A> FromIterator<A> for @[A] {
143+
#[inline]
138144
fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> @[A] {
139145
let (lower, _) = iterator.size_hint();
140146
build(Some(lower), |push| {
@@ -216,6 +222,7 @@ pub mod raw {
216222
move_val_init(&mut(*p), initval);
217223
}
218224

225+
#[inline]
219226
unsafe fn push_slow<T>(v: &mut @[T], initval: T) {
220227
reserve_at_least(v, v.len() + 1u);
221228
push_fast(v, initval);
@@ -232,6 +239,7 @@ pub mod raw {
232239
* * v - A vector
233240
* * n - The number of elements to reserve space for
234241
*/
242+
#[inline]
235243
pub unsafe fn reserve<T>(v: &mut @[T], n: uint) {
236244
// Only make the (slow) call into the runtime if we have to
237245
if capacity(*v) < n {
@@ -243,6 +251,7 @@ pub mod raw {
243251

244252
// Implementation detail. Shouldn't be public
245253
#[allow(missing_doc)]
254+
#[inline]
246255
pub fn reserve_raw(ty: *TyDesc, ptr: *mut *mut Box<Vec<()>>, n: uint) {
247256
// check for `uint` overflow
248257
unsafe {
@@ -257,6 +266,7 @@ pub mod raw {
257266
}
258267
}
259268

269+
#[inline]
260270
fn local_realloc(ptr: *(), size: uint) -> *() {
261271
use rt::local::Local;
262272
use rt::task::Task;
@@ -281,6 +291,7 @@ pub mod raw {
281291
* * v - A vector
282292
* * n - The number of elements to reserve space for
283293
*/
294+
#[inline]
284295
pub unsafe fn reserve_at_least<T>(v: &mut @[T], n: uint) {
285296
reserve(v, uint::next_power_of_two(n));
286297
}

0 commit comments

Comments
 (0)