Skip to content

Commit 63aee98

Browse files
committed
---
yaml --- r: 128882 b: refs/heads/try c: dc65307 h: refs/heads/master v: v3
1 parent 5b899b9 commit 63aee98

File tree

117 files changed

+1276
-528
lines changed

Some content is hidden

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

117 files changed

+1276
-528
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: d1c5db326f8daf453d71e9afcbd508832347aac3
5+
refs/heads/try: dc65307e3be587aa1bee9d17a539822626198f9d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/guide-unsafe.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,12 @@ extern crate core;
537537
use core::prelude::*;
538538
539539
use core::mem;
540-
use core::raw::Slice;
541540
542541
#[no_mangle]
543542
pub extern fn dot_product(a: *const u32, a_len: u32,
544543
b: *const u32, b_len: u32) -> u32 {
544+
use core::raw::Slice;
545+
545546
// Convert the provided arrays into Rust slices.
546547
// The core::raw module guarantees that the Slice
547548
// structure has the same memory layout as a &[T]

branches/try/src/doc/rust.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,9 @@ use_decl : "pub" ? "use" [ path "as" ident
924924
925925
path_glob : ident [ "::" [ path_glob
926926
| '*' ] ] ?
927-
| '{' ident [ ',' ident ] * '}' ;
927+
| '{' path_item [ ',' path_item ] * '}' ;
928+
929+
path_item : ident | "mod" ;
928930
~~~~
929931

930932
A _use declaration_ creates one or more local name bindings synonymous
@@ -943,14 +945,18 @@ Use declarations support a number of convenient shortcuts:
943945
* Simultaneously binding a list of paths differing only in their final element,
944946
using the glob-like brace syntax `use a::b::{c,d,e,f};`
945947
* Binding all paths matching a given prefix, using the asterisk wildcard syntax `use a::b::*;`
948+
* Simultaneously binding a list of paths differing only in their final element
949+
and their immediate parent module, using the `mod` keyword, such as `use a::b::{mod, c, d};`
946950

947951
An example of `use` declarations:
948952

949953
~~~~
950954
use std::iter::range_step;
951955
use std::option::{Some, None};
956+
use std::collections::hashmap::{mod, HashMap};
952957
953958
# fn foo<T>(_: T){}
959+
# fn bar(map: HashMap<String, uint>, set: hashmap::HashSet<String>){}
954960
955961
fn main() {
956962
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
@@ -959,6 +965,11 @@ fn main() {
959965
// Equivalent to 'foo(vec![std::option::Some(1.0f64),
960966
// std::option::None]);'
961967
foo(vec![Some(1.0f64), None]);
968+
969+
// Both `hash` and `HashMap` are in scope.
970+
let map = HashMap::new();
971+
let set = hashmap::HashSet::new();
972+
bar(map, set);
962973
}
963974
~~~~
964975

branches/try/src/etc/vim/syntax/rust.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ syn keyword rustEnumVariant Ok Err
8484
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr
8585
syn keyword rustTrait IntoBytes
8686
syn keyword rustTrait ToCStr
87-
syn keyword rustTrait Char
87+
syn keyword rustTrait Char UnicodeChar
8888
syn keyword rustTrait Clone
8989
syn keyword rustTrait PartialEq PartialOrd Eq Ord Equiv
9090
syn keyword rustEnum Ordering
@@ -102,18 +102,18 @@ syn keyword rustTrait Box
102102
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
103103
syn keyword rustTrait RawPtr
104104
syn keyword rustTrait Buffer Writer Reader Seek
105-
syn keyword rustTrait Str StrVector StrSlice OwnedStr
106-
syn keyword rustTrait IntoMaybeOwned StrAllocating
105+
syn keyword rustTrait Str StrVector StrSlice
106+
syn keyword rustTrait IntoMaybeOwned StrAllocating UnicodeStrSlice
107107
syn keyword rustTrait ToString IntoStr
108108
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
109109
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
110110
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
111111
syn keyword rustTrait CloneableVector ImmutableCloneableVector
112-
syn keyword rustTrait MutableCloneableVector MutableOrdVector
113-
syn keyword rustTrait ImmutableVector MutableVector
114-
syn keyword rustTrait ImmutableEqVector ImmutableOrdVector
115-
syn keyword rustTrait Vector VectorVector
116-
syn keyword rustTrait MutableVectorAllocating
112+
syn keyword rustTrait MutableCloneableSlice MutableOrdSlice
113+
syn keyword rustTrait ImmutableSlice MutableSlice
114+
syn keyword rustTrait ImmutablePartialEqSlice ImmutableOrdSlice
115+
syn keyword rustTrait Slice VectorVector
116+
syn keyword rustTrait MutableSliceAllocating
117117
syn keyword rustTrait String
118118
syn keyword rustTrait Vec
119119

branches/try/src/libcollections/bitv.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ use core::default::Default;
6868
use core::fmt;
6969
use core::iter::Take;
7070
use core::iter;
71-
use core::ops::Index;
7271
use core::slice;
7372
use core::uint;
7473
use std::hash;
7574

76-
use {Collection, Mutable, Set, MutableSet, MutableSeq};
75+
use {Mutable, Set, MutableSet, MutableSeq};
7776
use vec::Vec;
7877

7978

branches/try/src/libcollections/btree.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
// btree.rs
1212
//
1313

14+
// NB. this is not deprecated for removal, just deprecating the
15+
// current implementation. If the major pain-points are addressed
16+
// (overuse of by-value self and .clone), this can be removed.
17+
#![deprecated = "the current implementation is extremely inefficient, \
18+
prefer a HashMap, TreeMap or TrieMap"]
19+
#![allow(deprecated)]
20+
1421
//! Starting implementation of a btree for rust.
1522
//! Structure inspired by github user davidhalperin's gist.
1623
@@ -24,7 +31,7 @@ use alloc::boxed::Box;
2431
use core::fmt;
2532
use core::fmt::Show;
2633

27-
use {Collection, MutableSeq};
34+
use MutableSeq;
2835
use vec::Vec;
2936

3037
#[allow(missing_doc)]

branches/try/src/libcollections/dlist.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use core::mem;
3131
use core::ptr;
3232
use std::hash::{Writer, Hash};
3333

34-
use {Collection, Mutable, Deque, MutableSeq};
34+
use {Mutable, Deque, MutableSeq};
3535

3636
/// A doubly-linked list.
3737
pub struct DList<T> {

branches/try/src/libcollections/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
html_playground_url = "http://play.rust-lang.org/")]
2323

2424
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
25-
#![feature(unsafe_destructor)]
25+
#![feature(unsafe_destructor, import_shadowing)]
2626
#![no_std]
2727

28+
// NOTE(stage0, pcwalton): Remove after snapshot.
29+
#![allow(unknown_features)]
30+
2831
#[phase(plugin, link)] extern crate core;
2932
extern crate unicode;
3033
extern crate alloc;
@@ -36,11 +39,11 @@ extern crate alloc;
3639
#[cfg(test)] #[phase(plugin, link)] extern crate std;
3740
#[cfg(test)] #[phase(plugin, link)] extern crate log;
3841

39-
use core::prelude::*;
42+
use core::prelude::Option;
4043

41-
pub use core::collections::Collection;
4244
pub use bitv::{Bitv, BitvSet};
4345
pub use btree::BTree;
46+
pub use core::prelude::Collection;
4447
pub use dlist::DList;
4548
pub use enum_set::EnumSet;
4649
pub use priority_queue::PriorityQueue;

branches/try/src/libcollections/priority_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ use core::default::Default;
154154
use core::mem::{zeroed, replace, swap};
155155
use core::ptr;
156156

157-
use {Collection, Mutable, MutableSeq};
157+
use {Mutable, MutableSeq};
158158
use slice;
159159
use vec::Vec;
160160

branches/try/src/libcollections/ringbuf.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ use core::prelude::*;
1818
use core::cmp;
1919
use core::default::Default;
2020
use core::fmt;
21-
use core::iter::RandomAccessIterator;
2221
use core::iter;
2322
use std::hash::{Writer, Hash};
2423

25-
use {Deque, Collection, Mutable, MutableSeq};
24+
use {Deque, Mutable, MutableSeq};
2625
use vec::Vec;
2726

2827
static INITIAL_CAPACITY: uint = 8u; // 2^3

branches/try/src/libcollections/slice.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,22 @@ for &x in numbers.iter() {
8686

8787
#![doc(primitive = "slice")]
8888

89-
use core::prelude::*;
90-
9189
use core::cmp;
9290
use core::mem::size_of;
9391
use core::mem;
92+
use core::prelude::{Clone, Collection, Greater, Iterator, Less, None, Option};
93+
use core::prelude::{Ord, Ordering, RawPtr, Some, range};
9494
use core::ptr;
9595
use core::iter::{range_step, MultiplicativeIterator};
9696

97-
use {Collection, MutableSeq};
97+
use MutableSeq;
9898
use vec::Vec;
9999

100-
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
101100
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutablePartialEqSlice};
102101
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
103-
pub use core::slice::{MutSplits, MutChunks};
104-
pub use core::slice::{bytes, MutableCloneableSlice};
105-
pub use core::slice::{BinarySearchResult, Found, NotFound};
102+
pub use core::slice::{MutSplits, MutChunks, Splits};
103+
pub use core::slice::{bytes, ref_slice, MutableCloneableSlice};
104+
pub use core::slice::{Found, NotFound};
106105

107106
// Functional utilities
108107

branches/try/src/libcollections/smallintmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::iter;
2121
use core::iter::{Enumerate, FilterMap};
2222
use core::mem::replace;
2323

24-
use {Collection, Mutable, Map, MutableMap, MutableSeq};
24+
use {Mutable, Map, MutableMap, MutableSeq};
2525
use {vec, slice};
2626
use vec::Vec;
2727
use hash;

branches/try/src/libcollections/str.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,17 @@ is the same as `&[u8]`.
6969

7070
#![doc(primitive = "str")]
7171

72-
use core::prelude::*;
73-
7472
use core::default::Default;
7573
use core::fmt;
7674
use core::cmp;
7775
use core::iter::AdditiveIterator;
7876
use core::mem;
77+
use core::prelude::{Char, Clone, Collection, Eq, Equiv, ImmutableSlice};
78+
use core::prelude::{Iterator, MutableSlice, None, Option, Ord, Ordering};
79+
use core::prelude::{PartialEq, PartialOrd, Result, Slice, Some, Tuple2};
80+
use core::prelude::{range};
7981

80-
use {Collection, Deque, MutableSeq};
82+
use {Deque, MutableSeq};
8183
use hash;
8284
use ringbuf::RingBuf;
8385
use string::String;
@@ -1680,7 +1682,7 @@ mod tests {
16801682
fn test_chars_decoding() {
16811683
let mut bytes = [0u8, ..4];
16821684
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
1683-
let len = c.encode_utf8(bytes);
1685+
let len = c.encode_utf8(bytes).unwrap_or(0);
16841686
let s = ::core::str::from_utf8(bytes.slice_to(len)).unwrap();
16851687
if Some(c) != s.chars().next() {
16861688
fail!("character {:x}={} does not decode correctly", c as u32, c);
@@ -1692,7 +1694,7 @@ mod tests {
16921694
fn test_chars_rev_decoding() {
16931695
let mut bytes = [0u8, ..4];
16941696
for c in range(0u32, 0x110000).filter_map(|c| ::core::char::from_u32(c)) {
1695-
let len = c.encode_utf8(bytes);
1697+
let len = c.encode_utf8(bytes).unwrap_or(0);
16961698
let s = ::core::str::from_utf8(bytes.slice_to(len)).unwrap();
16971699
if Some(c) != s.chars().rev().next() {
16981700
fail!("character {:x}={} does not decode correctly", c as u32, c);

branches/try/src/libcollections/string.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ use core::mem;
2020
use core::ptr;
2121
// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
2222
use RawSlice = core::raw::Slice;
23-
use core::slice::Slice;
2423

25-
use {Collection, Mutable, MutableSeq};
24+
use {Mutable, MutableSeq};
2625
use hash;
2726
use str;
2827
use str::{CharRange, StrAllocating, MaybeOwned, Owned};
@@ -503,7 +502,7 @@ impl String {
503502
data: self.vec.as_ptr().offset(cur_len as int),
504503
len: 4,
505504
};
506-
let used = ch.encode_utf8(mem::transmute(slice));
505+
let used = ch.encode_utf8(mem::transmute(slice)).unwrap_or(0);
507506
self.vec.set_len(cur_len + used);
508507
}
509508
}

branches/try/src/libcollections/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use core::mem::{replace, swap};
4040
use core::ptr;
4141
use std::hash::{Writer, Hash};
4242

43-
use {Collection, Mutable, Set, MutableSet, MutableMap, Map, MutableSeq};
43+
use {Mutable, Set, MutableSet, MutableMap, Map, MutableSeq};
4444
use vec::Vec;
4545

4646
/// This is implemented as an AA tree, which is a simplified variation of

branches/try/src/libcollections/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use core::uint;
2323
use core::iter;
2424
use std::hash::{Writer, Hash};
2525

26-
use {Collection, Mutable, Map, MutableMap, Set, MutableSet};
26+
use {Mutable, Map, MutableMap, Set, MutableSet};
2727
use slice::{Items, MutItems};
2828
use slice;
2929

branches/try/src/libcollections/vec.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ use core::prelude::*;
1414

1515
use alloc::heap::{allocate, reallocate, deallocate};
1616
use RawSlice = core::raw::Slice;
17-
use core::slice::Slice;
1817
use core::cmp::max;
1918
use core::default::Default;
2019
use core::fmt;
2120
use core::mem;
22-
use core::num::{CheckedMul, CheckedAdd};
2321
use core::num;
2422
use core::ptr;
2523
use core::uint;
2624

27-
use {Collection, Mutable, MutableSeq};
25+
use {Mutable, MutableSeq};
2826
use slice::{MutableOrdSlice, MutableSliceAllocating, CloneableVector};
2927
use slice::{Items, MutItems};
3028

0 commit comments

Comments
 (0)