Skip to content

Commit 4da73cf

Browse files
committed
---
yaml --- r: 139055 b: refs/heads/try2 c: f54adca h: refs/heads/master i: 139053: 0bdaf7e 139051: ba3210c 139047: 04172ad 139039: 9d52971 v: v3
1 parent 7907d5d commit 4da73cf

File tree

93 files changed

+706
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+706
-205
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 246573d5ae1024193914de8c9be9230860781410
8+
refs/heads/try2: f54adca7c984c75334d9cb73ec85bf3b5c326ed9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Version 0.6 (March 2013)
1010
* Remove `static` keyword
1111
* Static method syntax
1212
* `as Trait`
13-
* `copy` removed?
13+
* `copy` removed, replaced with `Clone`?
14+
* `std::map` removed, replaced with `core::hashmap`
1415

1516
* Syntax changes
1617
* The self type parameter in traits is now spelled `Self`
@@ -38,7 +39,8 @@ Version 0.6 (March 2013)
3839
* Trait implementations no longer support visibility modifiers
3940

4041
* Semantic changes
41-
* Linear types move by default, eliminating the `move` keyword
42+
* Types with owned pointers or custom destructors move by default,
43+
eliminating the `move` keyword
4244
* All foreign functions are considered unsafe
4345
* &mut is now unaliasable
4446
* Writes to borrowed @mut pointers are prevented dynamically
@@ -57,16 +59,19 @@ Version 0.6 (March 2013)
5759
improve inference and eliminate unsoundness
5860

5961
* Libraries
60-
* Lots of effort to organize the container API's around `core::container`
61-
* `core::send_map` renamed to `core::hashmap`
6262
* Added big integers to `std::bigint`
6363
* Removed `core::oldcomm` module
6464
* Added pipe-based `core::comm` module
65-
* Reimplemented `std::treemap`
6665
* Numeric traits have been reorganized under `core::num`
67-
* `core::dvec` removed. Use `@mut ~[T]` or other language types
6866
* `vec::slice` finally returns a slice
6967
* `debug!` and friends don't require a format string, e.g. `debug!(Foo)`
68+
* Containers reorganized around traits in `core::container`
69+
* `core::dvec` removed, `~[T]` is a drop-in replacement
70+
* `core::send_map` renamed to `core::hashmap`
71+
* `std::treemap` reimplemented as an owned balanced tree
72+
* `std::deque` and `std::smallintmap` reimplemented as owned containers
73+
* `core::trie` added as a fast ordered map for integer keys
74+
* Set types added to `core::hashmap`, `core::trie` and `std::treemap`
7075

7176
* Tools
7277
* Replaced the 'cargo' package manager with 'rustpkg'

branches/try2/mk/rt.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) \
132132

133133
rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1))
134134
@$$(call E, link: $$@)
135-
$$(Q)ar rcs $$@ $$<
135+
$$(Q)$(AR_$(1)) rcs $$@ $$<
136136

137137
rt/$(1)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
138138
$$(RUNTIME_DEF_$(1)) \

branches/try2/src/libcore/cleanup.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ unsafe fn each_live_alloc(f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
145145

146146
#[cfg(unix)]
147147
fn debug_mem() -> bool {
148-
use os;
149-
use libc;
150-
do os::as_c_charp("RUST_DEBUG_MEM") |p| {
151-
unsafe { libc::getenv(p) != null() }
152-
}
148+
::rt::env::get().debug_mem
153149
}
154150

155151
#[cfg(windows)]

branches/try2/src/libcore/clone.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ impl Clone for () {
2020
fn clone(&self) -> () { () }
2121
}
2222

23+
impl<T:Clone> Clone for ~T {
24+
#[inline(always)]
25+
fn clone(&self) -> ~T { ~(**self).clone() }
26+
}
27+
2328
macro_rules! clone_impl(
2429
($t:ty) => {
2530
impl Clone for $t {

branches/try2/src/libcore/container.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ pub trait Map<K, V>: Mutable {
3535
/// Visit all values
3636
pure fn each_value(&self, f: &fn(&V) -> bool);
3737

38+
/// Iterate over the map and mutate the contained values
39+
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
40+
3841
/// Return the value corresponding to the key in the map
3942
pure fn find(&self, key: &K) -> Option<&self/V>;
4043

branches/try2/src/libcore/core.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Implicitly, all crates behave as if they included the following prologue:
5656

5757
// On Linux, link to the runtime with -lrt.
5858
#[cfg(target_os = "linux")]
59+
#[doc(hidden)]
5960
pub mod linkhack {
6061
#[link_args="-lrustrt -lrt"]
6162
#[link_args = "-lpthread"]
@@ -252,7 +253,7 @@ pub mod rt;
252253
// A curious inner-module that's not exported that contains the binding
253254
// 'core' so that macro-expanded references to core::error and such
254255
// can be resolved within libcore.
255-
#[doc(hidden)] // FIXME #3538
256+
#[doc(hidden)]
256257
pub mod core {
257258
#[cfg(stage0)]
258259
pub const error : u32 = 1_u32;

branches/try2/src/libcore/hashmap.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,19 @@ pub mod linear {
325325
self.each(|&(_, v)| blk(v))
326326
}
327327
328+
/// Iterate over the map and mutate the contained values
329+
fn mutate_values(&mut self, blk: &fn(&'self K,
330+
&'self mut V) -> bool) {
331+
for uint::range(0, self.buckets.len()) |i| {
332+
match self.buckets[i] {
333+
Some(Bucket{key: ref key, value: ref mut value, _}) => {
334+
if !blk(key, value) { return }
335+
}
336+
None => ()
337+
}
338+
}
339+
}
340+
328341
/// Return the value corresponding to the key in the map
329342
pure fn find(&self, k: &K) -> Option<&self/V> {
330343
match self.bucket_for_key(k) {

branches/try2/src/libcore/iter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ pub trait ReverseIter<A>: BaseIter<A> {
3131
pure fn each_reverse(&self, blk: &fn(&A) -> bool);
3232
}
3333

34+
pub trait MutableIter<A>: BaseIter<A> {
35+
fn each_mut(&mut self, blk: &fn(&mut A) -> bool);
36+
}
37+
3438
pub trait ExtendedIter<A> {
3539
pure fn eachi(&self, blk: &fn(uint, v: &A) -> bool);
3640
pure fn all(&self, blk: &fn(&A) -> bool) -> bool;

branches/try2/src/libcore/option.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use ops::Add;
4646
use kinds::Copy;
4747
use util;
4848
use num::Zero;
49-
use iter::BaseIter;
49+
use iter::{BaseIter, MutableIter};
5050

5151
#[cfg(test)] use ptr;
5252
#[cfg(test)] use str;
@@ -323,6 +323,13 @@ impl<T> BaseIter<T> for Option<T> {
323323
}
324324
}
325325
326+
impl<T> MutableIter<T> for Option<T> {
327+
#[inline(always)]
328+
fn each_mut(&mut self, f: &fn(&'self mut T) -> bool) {
329+
match *self { None => (), Some(ref mut t) => { f(t); } }
330+
}
331+
}
332+
326333
pub impl<T> Option<T> {
327334
/// Returns true if the option equals `none`
328335
#[inline(always)]

branches/try2/src/libcore/prelude.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ pub use clone::Clone;
2727
pub use cmp::{Eq, Ord, TotalOrd, Ordering, Less, Equal, Greater};
2828
pub use container::{Container, Mutable, Map, Set};
2929
pub use hash::Hash;
30-
pub use iter::{BaseIter, ReverseIter, ExtendedIter, EqIter, CopyableIter};
31-
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
30+
pub use iter::{BaseIter, ReverseIter, MutableIter, ExtendedIter, EqIter};
31+
pub use iter::{CopyableIter, CopyableOrderedIter, CopyableNonstrictIter};
32+
pub use iter::Times;
3233
pub use num::NumCast;
3334
pub use path::GenericPath;
3435
pub use path::Path;
@@ -43,6 +44,10 @@ pub use vec::{CopyableVector, ImmutableVector};
4344
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
4445
pub use vec::{OwnedVector, OwnedCopyableVector};
4546

47+
/* Reexported runtime types */
48+
pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};
49+
pub use task::spawn;
50+
4651
/* Reexported modules */
4752

4853
pub use at_vec;

branches/try2/src/libcore/rt/env.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! Runtime environment settings
12+
13+
use libc::{size_t, c_char, c_int};
14+
15+
pub struct Environment {
16+
/// The number of threads to use by default
17+
num_sched_threads: size_t,
18+
/// The minimum size of a stack segment
19+
min_stack_size: size_t,
20+
/// The maximum amount of total stack per task before aborting
21+
max_stack_size: size_t,
22+
/// The default logging configuration
23+
logspec: *c_char,
24+
/// Record and report detailed information about memory leaks
25+
detailed_leaks: bool,
26+
/// Seed the random number generator
27+
rust_seed: *c_char,
28+
/// Poison allocations on free
29+
poison_on_free: bool,
30+
/// The argc value passed to main
31+
argc: c_int,
32+
/// The argv value passed to main
33+
argv: **c_char,
34+
/// Print GC debugging info
35+
debug_mem: bool
36+
}
37+
38+
/// Get the global environment settings
39+
/// # Safety Note
40+
/// This will abort the process if run outside of task context
41+
pub fn get() -> &Environment {
42+
unsafe { rust_get_rt_env() }
43+
}
44+
45+
extern {
46+
fn rust_get_rt_env() -> &Environment;
47+
}

branches/try2/src/libcore/rt/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ mod work_queue;
4545
mod stack;
4646
mod context;
4747
mod thread;
48+
pub mod env;

branches/try2/src/libcore/rt/thread_local_storage.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type pthread_key_t = c_ulong;
4040

4141
#[cfg(target_os="linux")]
4242
#[cfg(target_os="freebsd")]
43+
#[cfg(target_os="android")]
4344
#[allow(non_camel_case_types)] // foreign type
4445
type pthread_key_t = c_uint;
4546

branches/try2/src/libcore/str.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use at_vec;
2121
use cast;
2222
use char;
23+
use clone::Clone;
2324
use cmp::{Equiv, TotalOrd, Ordering, Less, Equal, Greater};
2425
use libc;
2526
use option::{None, Option, Some};
@@ -2273,6 +2274,7 @@ pub trait StrSlice {
22732274
pure fn to_owned(&self) -> ~str;
22742275
pure fn to_managed(&self) -> @str;
22752276
pure fn char_at(&self, i: uint) -> char;
2277+
fn to_bytes(&self) -> ~[u8];
22762278
}
22772279
22782280
/// Extension methods for strings
@@ -2416,6 +2418,8 @@ impl StrSlice for &self/str {
24162418
24172419
#[inline]
24182420
pure fn char_at(&self, i: uint) -> char { char_at(*self, i) }
2421+
2422+
fn to_bytes(&self) -> ~[u8] { to_bytes(*self) }
24192423
}
24202424
24212425
pub trait OwnedStr {
@@ -2433,6 +2437,13 @@ impl OwnedStr for ~str {
24332437
}
24342438
}
24352439
2440+
impl Clone for ~str {
2441+
#[inline(always)]
2442+
fn clone(&self) -> ~str {
2443+
self.to_str() // hilarious
2444+
}
2445+
}
2446+
24362447
#[cfg(test)]
24372448
mod tests {
24382449
use char;

0 commit comments

Comments
 (0)