Skip to content

Commit 801f0db

Browse files
committed
---
yaml --- r: 128891 b: refs/heads/try c: 8c9bdda h: refs/heads/master i: 128889: d0f2ce8 128887: e3e24a8 v: v3
1 parent f8b6539 commit 801f0db

File tree

143 files changed

+725
-1649
lines changed

Some content is hidden

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

143 files changed

+725
-1649
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: 0d8738f9b52b62991e9c7b44a9d01a13c1398475
5+
refs/heads/try: 8c9bdda89b93bcb4c3b0ffb1b91b9c73318c5304
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/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 html-doc/ --output-format html ../src/libstd/path.rs
22+
rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
2323
~~~~
2424

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,11 @@ extern crate core;
537537
use core::prelude::*;
538538
539539
use core::mem;
540+
use core::raw::Slice;
540541
541542
#[no_mangle]
542543
pub extern fn dot_product(a: *const u32, a_len: u32,
543544
b: *const u32, b_len: u32) -> u32 {
544-
use core::raw::Slice;
545-
546545
// Convert the provided arrays into Rust slices.
547546
// The core::raw module guarantees that the Slice
548547
// structure has the same memory layout as a &[T]

branches/try/src/doc/rust.md

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

932930
A _use declaration_ creates one or more local name bindings synonymous
@@ -945,18 +943,14 @@ Use declarations support a number of convenient shortcuts:
945943
* Simultaneously binding a list of paths differing only in their final element,
946944
using the glob-like brace syntax `use a::b::{c,d,e,f};`
947945
* 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};`
950946

951947
An example of `use` declarations:
952948

953949
~~~~
954950
use std::iter::range_step;
955951
use std::option::{Some, None};
956-
use std::collections::hashmap::{mod, HashMap};
957952
958953
# fn foo<T>(_: T){}
959-
# fn bar(map: HashMap<String, uint>, set: hashmap::HashSet<String>){}
960954
961955
fn main() {
962956
// Equivalent to 'std::iter::range_step(0u, 10u, 2u);'
@@ -965,11 +959,6 @@ fn main() {
965959
// Equivalent to 'foo(vec![std::option::Some(1.0f64),
966960
// std::option::None]);'
967961
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);
973962
}
974963
~~~~
975964

branches/try/src/etc/emacs/rust-mode.el

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

188187
(defconst rust-special-types
189188
'("u8" "i8"

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

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

branches/try/src/etc/kate/rust.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<item> as </item>
2020
<item> break </item>
2121
<item> box </item>
22-
<item> const </item>
2322
<item> continue </item>
2423
<item> crate </item>
2524
<item> do </item>
@@ -45,8 +44,6 @@
4544
<item> trait </item>
4645
<item> unsafe </item>
4746
<item> use </item>
48-
<item> virtual </item>
49-
<item> where </item>
5047
<item> while </item>
5148
</list>
5249
<list name="traits">

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ 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-
6959
if has('conceal') && exists('g:rust_conceal')
7060
let b:rust_set_conceallevel=1
7161
setlocal conceallevel=2
@@ -118,10 +108,6 @@ let b:undo_ftplugin = "
118108
\|else
119109
\|unlet! b:delimitMate_excluded_regions
120110
\|endif
121-
\|if exists('b:rust_set_foldmethod')
122-
\|setlocal foldmethod< foldlevel<
123-
\|unlet b:rust_set_foldmethod
124-
\|endif
125111
\|if exists('b:rust_set_conceallevel')
126112
\|setlocal conceallevel<
127113
\|unlet b:rust_set_conceallevel

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ 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+
1425
" Syntax definitions {{{1
1526
" Basic keywords {{{2
1627
syn keyword rustConditional match if else
@@ -26,7 +37,7 @@ syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite skipempty
2637
syn keyword rustKeyword for in if impl let
2738
syn keyword rustKeyword loop once proc pub
2839
syn keyword rustKeyword return super
29-
syn keyword rustKeyword unsafe virtual where while
40+
syn keyword rustKeyword unsafe virtual while
3041
syn keyword rustKeyword use nextgroup=rustModPath,rustModPathInUse skipwhite skipempty
3142
" FIXME: Scoped impl's name is also fallen in this category
3243
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty
@@ -84,7 +95,7 @@ syn keyword rustEnumVariant Ok Err
8495
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr
8596
syn keyword rustTrait IntoBytes
8697
syn keyword rustTrait ToCStr
87-
syn keyword rustTrait Char UnicodeChar
98+
syn keyword rustTrait Char
8899
syn keyword rustTrait Clone
89100
syn keyword rustTrait PartialEq PartialOrd Eq Ord Equiv
90101
syn keyword rustEnum Ordering
@@ -102,18 +113,18 @@ syn keyword rustTrait Box
102113
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
103114
syn keyword rustTrait RawPtr
104115
syn keyword rustTrait Buffer Writer Reader Seek
105-
syn keyword rustTrait Str StrVector StrSlice
106-
syn keyword rustTrait IntoMaybeOwned StrAllocating UnicodeStrSlice
116+
syn keyword rustTrait Str StrVector StrSlice OwnedStr
117+
syn keyword rustTrait IntoMaybeOwned StrAllocating
107118
syn keyword rustTrait ToString IntoStr
108119
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
109120
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
110121
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
111122
syn keyword rustTrait CloneableVector ImmutableCloneableVector
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
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
117128
syn keyword rustTrait String
118129
syn keyword rustTrait Vec
119130

branches/try/src/libcollections/bitv.rs

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,33 @@ use core::default::Default;
6868
use core::fmt;
6969
use core::iter::Take;
7070
use core::iter;
71+
use core::ops::Index;
7172
use core::slice;
7273
use core::uint;
7374
use std::hash;
7475

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

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

7999
static TRUE: bool = true;
80100
static FALSE: bool = false;
@@ -969,7 +989,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
969989
/// assert!(bv.eq_vec([true, true, false, true,
970990
/// false, false, false, false]));
971991
/// ```
972-
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
992+
#[deriving(Clone)]
973993
pub struct BitvSet(Bitv);
974994

975995
impl Default for BitvSet {
@@ -992,6 +1012,32 @@ impl Extendable<bool> for BitvSet {
9921012
}
9931013
}
9941014

1015+
impl PartialOrd for BitvSet {
1016+
#[inline]
1017+
fn partial_cmp(&self, other: &BitvSet) -> Option<Ordering> {
1018+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1019+
iter::order::partial_cmp(a_iter, b_iter)
1020+
}
1021+
}
1022+
1023+
impl Ord for BitvSet {
1024+
#[inline]
1025+
fn cmp(&self, other: &BitvSet) -> Ordering {
1026+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1027+
iter::order::cmp(a_iter, b_iter)
1028+
}
1029+
}
1030+
1031+
impl cmp::PartialEq for BitvSet {
1032+
#[inline]
1033+
fn eq(&self, other: &BitvSet) -> bool {
1034+
let (a_iter, b_iter) = match_words!(self.get_ref(), other.get_ref());
1035+
iter::order::eq(a_iter, b_iter)
1036+
}
1037+
}
1038+
1039+
impl cmp::Eq for BitvSet {}
1040+
9951041
impl BitvSet {
9961042
/// Create a new bit vector set with initially no contents.
9971043
///
@@ -1141,10 +1187,18 @@ impl BitvSet {
11411187
// Unwrap Bitvs
11421188
let &BitvSet(ref mut self_bitv) = self;
11431189
let &BitvSet(ref other_bitv) = other;
1190+
11441191
// Expand the vector if necessary
11451192
self_bitv.reserve(other_bitv.capacity());
1146-
// Apply values
1147-
for (i, w) in other_bitv.mask_words(0) {
1193+
1194+
// virtually pad other with 0's for equal lengths
1195+
let self_len = self_bitv.storage.len();
1196+
let other_len = other_bitv.storage.len();
1197+
let mut other_words = other_bitv.mask_words(0)
1198+
.chain(iter::Repeat::new(0u).enumerate().take(self_len).skip(other_len));
1199+
1200+
// Apply values found in other
1201+
for (i, w) in other_words {
11481202
let old = self_bitv.storage[i];
11491203
let new = f(old, w);
11501204
*self_bitv.storage.get_mut(i) = new;
@@ -1271,7 +1325,7 @@ impl BitvSet {
12711325
/// let a = BitvSet::from_bitv(bitv::from_bytes([0b01101000]));
12721326
/// let b = BitvSet::from_bitv(bitv::from_bytes([0b10100000]));
12731327
///
1274-
/// // Print 1, 4 in arbitrary order
1328+
/// // Print 2, 4 in arbitrary order
12751329
/// for x in a.difference(&b) {
12761330
/// println!("{}", x);
12771331
/// }
@@ -2213,6 +2267,64 @@ mod tests {
22132267
assert!(set1.is_subset(&set2)); // { 2 } { 2, 4 }
22142268
}
22152269

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

0 commit comments

Comments
 (0)