Skip to content

Commit 11bde96

Browse files
committed
---
yaml --- r: 132847 b: refs/heads/dist-snap c: ed7a3d6 h: refs/heads/master i: 132845: 9eaf1a3 132843: 27ce86e 132839: 07dff3e 132831: f3c9f6f v: v3
1 parent 27fcc0c commit 11bde96

File tree

150 files changed

+1713
-654
lines changed

Some content is hidden

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

150 files changed

+1713
-654
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 958250c0e5144c4fb07e80eb1742d810687bd80e
9+
refs/heads/dist-snap: ed7a3d6f1ebc9db39a45dc6139bbcdc16b32b0a8
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ for the 'std' and 'extra' libraries.
1919
To generate HTML documentation from one source file/crate, do something like:
2020

2121
~~~~
22-
rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
22+
rustdoc --output html-doc/ --output-format html ../src/libstd/path.rs
2323
~~~~
2424

2525
(This, of course, requires a working build of the `rustdoc` tool.)

branches/dist-snap/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/dist-snap/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/dist-snap/src/etc/emacs/rust-mode.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
(defconst rust-mode-keywords
171171
'("as"
172172
"box" "break"
173-
"continue" "crate"
173+
"const" "continue" "crate"
174174
"do"
175175
"else" "enum" "extern"
176176
"false" "fn" "for"
@@ -182,7 +182,8 @@
182182
"self" "static" "struct" "super"
183183
"true" "trait" "type"
184184
"unsafe" "use"
185-
"while"))
185+
"virtual"
186+
"where" "while"))
186187

187188
(defconst rust-special-types
188189
'("u8" "i8"

branches/dist-snap/src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
<keyword>trait</keyword>
7272
<keyword>unsafe</keyword>
7373
<keyword>use</keyword>
74+
<keyword>virtual</keyword>
75+
<keyword>where</keyword>
7476
<keyword>while</keyword>
7577
</context>
7678

branches/dist-snap/src/etc/kate/rust.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<item> as </item>
2020
<item> break </item>
2121
<item> box </item>
22+
<item> const </item>
2223
<item> continue </item>
2324
<item> crate </item>
2425
<item> do </item>
@@ -44,6 +45,8 @@
4445
<item> trait </item>
4546
<item> unsafe </item>
4647
<item> use </item>
48+
<item> virtual </item>
49+
<item> where </item>
4750
<item> while </item>
4851
</list>
4952
<list name="traits">

branches/dist-snap/src/etc/vim/ftplugin/rust.vim

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ if exists("g:loaded_delimitMate")
5656
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
5757
endif
5858

59+
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
60+
let b:rust_set_foldmethod=1
61+
setlocal foldmethod=syntax
62+
if g:rust_fold == 2
63+
setlocal foldlevel<
64+
else
65+
setlocal foldlevel=99
66+
endif
67+
endif
68+
5969
if has('conceal') && exists('g:rust_conceal')
6070
let b:rust_set_conceallevel=1
6171
setlocal conceallevel=2
@@ -108,6 +118,10 @@ let b:undo_ftplugin = "
108118
\|else
109119
\|unlet! b:delimitMate_excluded_regions
110120
\|endif
121+
\|if exists('b:rust_set_foldmethod')
122+
\|setlocal foldmethod< foldlevel<
123+
\|unlet b:rust_set_foldmethod
124+
\|endif
111125
\|if exists('b:rust_set_conceallevel')
112126
\|setlocal conceallevel<
113127
\|unlet b:rust_set_conceallevel

branches/dist-snap/src/etc/vim/syntax/rust.vim

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ elseif exists("b:current_syntax")
1111
finish
1212
endif
1313

14-
" Fold settings {{{1
15-
16-
if has("folding") && exists('g:rust_fold') && g:rust_fold != 0
17-
setlocal foldmethod=syntax
18-
if g:rust_fold == 2
19-
setlocal foldlevel<
20-
else
21-
setlocal foldlevel=99
22-
endif
23-
endif
24-
2514
" Syntax definitions {{{1
2615
" Basic keywords {{{2
2716
syn keyword rustConditional match if else
@@ -37,7 +26,7 @@ syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
3726
syn keyword rustKeyword for in if impl let
3827
syn keyword rustKeyword loop once proc pub
3928
syn keyword rustKeyword return super
40-
syn keyword rustKeyword unsafe virtual while
29+
syn keyword rustKeyword unsafe virtual where while
4130
syn keyword rustKeyword use nextgroup=rustModPath,rustModPathInUse skipwhite skipempty
4231
" FIXME: Scoped impl's name is also fallen in this category
4332
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
@@ -95,7 +84,7 @@ syn keyword rustEnumVariant Ok Err
9584
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr
9685
syn keyword rustTrait IntoBytes
9786
syn keyword rustTrait ToCStr
98-
syn keyword rustTrait Char
87+
syn keyword rustTrait Char UnicodeChar
9988
syn keyword rustTrait Clone
10089
syn keyword rustTrait PartialEq PartialOrd Eq Ord Equiv
10190
syn keyword rustEnum Ordering
@@ -113,18 +102,18 @@ syn keyword rustTrait Box
113102
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
114103
syn keyword rustTrait RawPtr
115104
syn keyword rustTrait Buffer Writer Reader Seek
116-
syn keyword rustTrait Str StrVector StrSlice OwnedStr
117-
syn keyword rustTrait IntoMaybeOwned StrAllocating
105+
syn keyword rustTrait Str StrVector StrSlice
106+
syn keyword rustTrait IntoMaybeOwned StrAllocating UnicodeStrSlice
118107
syn keyword rustTrait ToString IntoStr
119108
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
120109
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
121110
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
122111
syn keyword rustTrait CloneableVector ImmutableCloneableVector
123-
syn keyword rustTrait MutableCloneableVector MutableOrdVector
124-
syn keyword rustTrait ImmutableVector MutableVector
125-
syn keyword rustTrait ImmutableEqVector ImmutableOrdVector
126-
syn keyword rustTrait Vector VectorVector
127-
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
128117
syn keyword rustTrait String
129118
syn keyword rustTrait Vec
130119

branches/dist-snap/src/libcollections/bitv.rs

Lines changed: 116 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,32 @@ 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

78+
// Take two BitV's, and return iterators of their words, where the shorter one
79+
// has been padded with 0's
80+
macro_rules! match_words(
81+
($a_expr:expr, $b_expr:expr) => ({
82+
let a = $a_expr;
83+
let b = $b_expr;
84+
let a_len = a.storage.len();
85+
let b_len = b.storage.len();
86+
87+
// have to uselessly pretend to pad the longer one for type matching
88+
if a_len < b_len {
89+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(b_len).skip(a_len)),
90+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)))
91+
} else {
92+
(a.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(0).skip(0)),
93+
b.mask_words(0).chain(iter::Repeat::new(0u).enumerate().take(a_len).skip(b_len)))
94+
}
95+
})
96+
)
7997

8098
static TRUE: bool = true;
8199
static FALSE: bool = false;
@@ -970,7 +988,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
970988
/// assert!(bv.eq_vec([true, true, false, true,
971989
/// false, false, false, false]));
972990
/// ```
973-
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
991+
#[deriving(Clone)]
974992
pub struct BitvSet(Bitv);
975993

976994
impl Default for BitvSet {
@@ -993,6 +1011,32 @@ impl Extendable<bool> for BitvSet {
9931011
}
9941012
}
9951013

1014+
impl PartialOrd for BitvSet {
1015+
#[inline]
1016+
fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> {
1017+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1018+
iter::order::partial_cmp(a_iter, b_iter)
1019+
}
1020+
}
1021+
1022+
impl Ord for BitvSet {
1023+
#[inline]
1024+
fn cmp(&self, other: &BitvSet) -> Ordering {
1025+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1026+
iter::order::cmp(a_iter, b_iter)
1027+
}
1028+
}
1029+
1030+
impl cmp::PartialEq for BitvSet {
1031+
#[inline]
1032+
fn eq(&self, other: &BitvSet) -> bool {
1033+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1034+
iter::order::eq(a_iter, b_iter)
1035+
}
1036+
}
1037+
1038+
impl cmp::Eq for BitvSet {}
1039+
9961040
impl BitvSet {
9971041
/// Create a new bit vector set with initially no contents.
9981042
///
@@ -1142,10 +1186,18 @@ impl BitvSet {
11421186
// Unwrap Bitvs
11431187
let &BitvSet(ref mut self_bitv) = self;
11441188
let &BitvSet(ref other_bitv) = other;
1189+
11451190
// Expand the vector if necessary
11461191
self_bitv.reserve(other_bitv.capacity());
1147-
// Apply values
1148-
for (i, w) in other_bitv.mask_words(0) {
1192+
1193+
// virtually pad other with 0's for equal lengths
1194+
let self_len = self_bitv.storage.len();
1195+
let other_len = other_bitv.storage.len();
1196+
let mut other_words = other_bitv.mask_words(0)
1197+
.chain(iter::Repeat::new(0u).enumerate().take(self_len).skip(other_len));
1198+
1199+
// Apply values found in other
1200+
for (i, w) in other_words {
11491201
let old = self_bitv.storage[i];
11501202
let new = f(old, w);
11511203
*self_bitv.storage.get_mut(i) = new;
@@ -1272,7 +1324,7 @@ impl BitvSet {
12721324
/// let a = BitvSet::from_bitv(bitv::from_bytes([0b01101000]));
12731325
/// let b = BitvSet::from_bitv(bitv::from_bytes([0b10100000]));
12741326
///
1275-
/// // Print 2, 4 in arbitrary order
1327+
/// // Print 1, 4 in arbitrary order
12761328
/// for x in a.difference(&b) {
12771329
/// println!("{}", x);
12781330
/// }
@@ -2214,6 +2266,64 @@ mod tests {
22142266
assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 }
22152267
}
22162268

2269+
#[test]
2270+
fn test_bitv_set_intersect_with() {
2271+
// Explicitly 0'ed bits
2272+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2273+
let mut b = BitvSet::from_bitv(from_bytes([0b00000000]));
2274+
let c = a.clone();
2275+
a.intersect_with(&b);
2276+
b.intersect_with(&c);
2277+
assert!(a.is_empty());
2278+
assert!(b.is_empty());
2279+
2280+
// Uninitialized bits should behave like 0's
2281+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2282+
let mut b = BitvSet::new();
2283+
let c = a.clone();
2284+
a.intersect_with(&b);
2285+
b.intersect_with(&c);
2286+
assert!(a.is_empty());
2287+
assert!(b.is_empty());
2288+
2289+
// Standard
2290+
let mut a = BitvSet::from_bitv(from_bytes([0b10100010]));
2291+
let mut b = BitvSet::from_bitv(from_bytes([0b01100010]));
2292+
let c = a.clone();
2293+
a.intersect_with(&b);
2294+
b.intersect_with(&c);
2295+
assert_eq!(a.len(), 2);
2296+
assert_eq!(b.len(), 2);
2297+
}
2298+
2299+
#[test]
2300+
fn test_bitv_set_eq() {
2301+
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2302+
let b = BitvSet::from_bitv(from_bytes([0b00000000]));
2303+
let c = BitvSet::new();
2304+
2305+
assert!(a == a);
2306+
assert!(a != b);
2307+
assert!(a != c);
2308+
assert!(b == b);
2309+
assert!(b == c);
2310+
assert!(c == c);
2311+
}
2312+
2313+
#[test]
2314+
fn test_bitv_set_cmp() {
2315+
let a = BitvSet::from_bitv(from_bytes([0b10100010]));
2316+
let b = BitvSet::from_bitv(from_bytes([0b00000000]));
2317+
let c = BitvSet::new();
2318+
2319+
assert_eq!(a.cmp(&b), Greater);
2320+
assert_eq!(a.cmp(&c), Greater);
2321+
assert_eq!(b.cmp(&a), Less);
2322+
assert_eq!(b.cmp(&c), Equal);
2323+
assert_eq!(c.cmp(&a), Less);
2324+
assert_eq!(c.cmp(&b), Equal);
2325+
}
2326+
22172327
#[test]
22182328
fn test_bitv_remove() {
22192329
let mut a = BitvSet::new();

0 commit comments

Comments
 (0)