Skip to content

Commit 01e8c64

Browse files
committed
---
yaml --- r: 275174 b: refs/heads/stable c: 2e89dee h: refs/heads/master
1 parent 8ce4fd4 commit 01e8c64

File tree

45 files changed

+532
-447
lines changed

Some content is hidden

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

45 files changed

+532
-447
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 9d3bce38b4e7c2fe706d8228d720222ec2781e30
32+
refs/heads/stable: 2e89dee63902fd45ef21397bd15afd371e3cdbf9
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/reference.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3564,8 +3564,9 @@ Each instance of a trait object includes:
35643564
each method of `SomeTrait` that `T` implements, a pointer to `T`'s
35653565
implementation (i.e. a function pointer).
35663566

3567-
The purpose of trait objects is to permit "late binding" of methods. A call to
3568-
a method on a trait object is only resolved to a vtable entry at compile time.
3567+
The purpose of trait objects is to permit "late binding" of methods. Calling a
3568+
method on a trait object results in virtual dispatch at runtime: that is, a
3569+
function pointer is loaded from the trait object vtable and invoked indirectly.
35693570
The actual implementation for each vtable entry can vary on an object-by-object
35703571
basis.
35713572

branches/stable/src/etc/licenseck.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# except according to those terms.
1010

1111
import re
12+
import os
1213

1314
license_re = re.compile(
1415
u"""(#|//) Copyright .* The Rust Project Developers. See the COPYRIGHT
@@ -40,8 +41,9 @@
4041
]
4142

4243
def check_license(name, contents):
44+
name = os.path.normpath(name)
4345
# Whitelist check
44-
if any(name.endswith(e) for e in exceptions):
46+
if any(name.endswith(os.path.normpath(e)) for e in exceptions):
4547
return True
4648

4749
# Xfail check

branches/stable/src/etc/tidy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def interesting_file(f):
122122
'src/liblibc',
123123
}
124124

125-
if any(d in dirpath for d in skippable_dirs):
125+
dirpath = os.path.normpath(dirpath)
126+
if any(os.path.normpath(d) in dirpath for d in skippable_dirs):
126127
continue
127128

128129
file_names = [os.path.join(dirpath, f) for f in filenames

branches/stable/src/libcollections/borrow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ pub enum Cow<'a, B: ?Sized + 'a>
9595
{
9696
/// Borrowed data.
9797
#[stable(feature = "rust1", since = "1.0.0")]
98-
Borrowed(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] &'a B),
98+
Borrowed(#[stable(feature = "rust1", since = "1.0.0")] &'a B),
9999

100100
/// Owned data.
101101
#[stable(feature = "rust1", since = "1.0.0")]
102102
Owned(
103-
#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] <B as ToOwned>::Owned
103+
#[stable(feature = "rust1", since = "1.0.0")] <B as ToOwned>::Owned
104104
),
105105
}
106106

branches/stable/src/libcollections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ pub enum Entry<'a, K: 'a, V: 'a> {
238238
/// A vacant Entry
239239
#[stable(feature = "rust1", since = "1.0.0")]
240240
Vacant(
241-
#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] VacantEntry<'a, K, V>
241+
#[stable(feature = "rust1", since = "1.0.0")] VacantEntry<'a, K, V>
242242
),
243243

244244
/// An occupied Entry
245245
#[stable(feature = "rust1", since = "1.0.0")]
246246
Occupied(
247-
#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] OccupiedEntry<'a, K, V>
247+
#[stable(feature = "rust1", since = "1.0.0")] OccupiedEntry<'a, K, V>
248248
),
249249
}
250250

branches/stable/src/libcollections/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<T> [T] {
407407
}
408408

409409
/// Returns an iterator over `size` elements of the slice at a
410-
/// time. The chunks do not overlap. If `size` does not divide the
410+
/// time. The chunks are slices and do not overlap. If `size` does not divide the
411411
/// length of the slice, then the last chunk will not have length
412412
/// `size`.
413413
///
@@ -433,7 +433,7 @@ impl<T> [T] {
433433
}
434434

435435
/// Returns an iterator over `chunk_size` elements of the slice at a time.
436-
/// The chunks are mutable and do not overlap. If `chunk_size` does
436+
/// The chunks are mutable slices, and do not overlap. If `chunk_size` does
437437
/// not divide the length of the slice, then the last chunk will not
438438
/// have length `chunk_size`.
439439
///

branches/stable/src/libcore/intrinsics.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,5 @@ extern "rust-intrinsic" {
586586
/// platforms this is a `*mut *mut T` which is filled in by the compiler and
587587
/// on MSVC it's `*mut [usize; 2]`. For more information see the compiler's
588588
/// source as well as std's catch implementation.
589-
#[cfg(not(stage0))]
590589
pub fn try(f: fn(*mut u8), data: *mut u8, local_ptr: *mut u8) -> i32;
591-
#[cfg(stage0)]
592-
pub fn try(f: fn(*mut u8), data: *mut u8) -> *mut u8;
593590
}

branches/stable/src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pub enum Option<T> {
169169
None,
170170
/// Some value `T`
171171
#[stable(feature = "rust1", since = "1.0.0")]
172-
Some(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] T)
172+
Some(#[stable(feature = "rust1", since = "1.0.0")] T)
173173
}
174174

175175
/////////////////////////////////////////////////////////////////////////////

branches/stable/src/libcore/result.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ use option::Option::{self, None, Some};
250250
pub enum Result<T, E> {
251251
/// Contains the success value
252252
#[stable(feature = "rust1", since = "1.0.0")]
253-
Ok(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] T),
253+
Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
254254

255255
/// Contains the error value
256256
#[stable(feature = "rust1", since = "1.0.0")]
257-
Err(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] E)
257+
Err(#[stable(feature = "rust1", since = "1.0.0")] E)
258258
}
259259

260260
/////////////////////////////////////////////////////////////////////////////

branches/stable/src/liblibc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 1b1eea2cdd77c63d73ba0b09b905a91910d1c992
1+
Subproject commit 16f1c190afbc7605ed50a40f802189e436de68f6

branches/stable/src/librustc_data_structures/bitvec.rs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,45 @@ impl BitVector {
5050
let extra_words = self.data.len() - num_words;
5151
self.data.extend((0..extra_words).map(|_| 0));
5252
}
53+
54+
/// Iterates over indexes of set bits in a sorted order
55+
pub fn iter<'a>(&'a self) -> BitVectorIter<'a> {
56+
BitVectorIter {
57+
iter: self.data.iter(),
58+
current: 0,
59+
idx: 0
60+
}
61+
}
62+
}
63+
64+
pub struct BitVectorIter<'a> {
65+
iter: ::std::slice::Iter<'a, u64>,
66+
current: u64,
67+
idx: usize
68+
}
69+
70+
impl<'a> Iterator for BitVectorIter<'a> {
71+
type Item = usize;
72+
fn next(&mut self) -> Option<usize> {
73+
while self.current == 0 {
74+
self.current = if let Some(&i) = self.iter.next() {
75+
if i == 0 {
76+
self.idx += 64;
77+
continue;
78+
} else {
79+
self.idx = u64s(self.idx) * 64;
80+
i
81+
}
82+
} else {
83+
return None;
84+
}
85+
}
86+
let offset = self.current.trailing_zeros() as usize;
87+
self.current >>= offset;
88+
self.current >>= 1; // shift otherwise overflows for 0b1000_0000_…_0000
89+
self.idx += offset + 1;
90+
return Some(self.idx - 1);
91+
}
5392
}
5493

5594
/// A "bit matrix" is basically a square matrix of booleans
@@ -153,6 +192,46 @@ fn word_mask(index: usize) -> (usize, u64) {
153192
(word, mask)
154193
}
155194

195+
#[test]
196+
fn bitvec_iter_works() {
197+
let mut bitvec = BitVector::new(100);
198+
bitvec.insert(1);
199+
bitvec.insert(10);
200+
bitvec.insert(19);
201+
bitvec.insert(62);
202+
bitvec.insert(63);
203+
bitvec.insert(64);
204+
bitvec.insert(65);
205+
bitvec.insert(66);
206+
bitvec.insert(99);
207+
assert_eq!(bitvec.iter().collect::<Vec<_>>(), [1, 10, 19, 62, 63, 64, 65, 66, 99]);
208+
}
209+
210+
#[test]
211+
fn bitvec_iter_works_2() {
212+
let mut bitvec = BitVector::new(300);
213+
bitvec.insert(1);
214+
bitvec.insert(10);
215+
bitvec.insert(19);
216+
bitvec.insert(62);
217+
bitvec.insert(66);
218+
bitvec.insert(99);
219+
bitvec.insert(299);
220+
assert_eq!(bitvec.iter().collect::<Vec<_>>(), [1, 10, 19, 62, 66, 99, 299]);
221+
222+
}
223+
224+
#[test]
225+
fn bitvec_iter_works_3() {
226+
let mut bitvec = BitVector::new(319);
227+
bitvec.insert(0);
228+
bitvec.insert(127);
229+
bitvec.insert(191);
230+
bitvec.insert(255);
231+
bitvec.insert(319);
232+
assert_eq!(bitvec.iter().collect::<Vec<_>>(), [0, 127, 191, 255, 319]);
233+
}
234+
156235
#[test]
157236
fn union_two_vecs() {
158237
let mut vec1 = BitVector::new(65);

branches/stable/src/librustc_mir/transform/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ pub mod simplify_cfg;
1313
pub mod erase_regions;
1414
pub mod no_landing_pads;
1515
pub mod type_check;
16-
mod util;

branches/stable/src/librustc_mir/transform/simplify_cfg.rs

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use rustc_data_structures::bitvec::BitVector;
1112
use rustc::middle::const_eval::ConstVal;
1213
use rustc::middle::infer;
1314
use rustc::mir::repr::*;
14-
use transform::util;
1515
use rustc::mir::transform::MirPass;
1616

1717
pub struct SimplifyCfg;
@@ -22,23 +22,21 @@ impl SimplifyCfg {
2222
}
2323

2424
fn remove_dead_blocks(&self, mir: &mut Mir) {
25-
let mut seen = vec![false; mir.basic_blocks.len()];
26-
25+
let mut seen = BitVector::new(mir.basic_blocks.len());
2726
// These blocks are always required.
28-
seen[START_BLOCK.index()] = true;
29-
seen[END_BLOCK.index()] = true;
27+
seen.insert(START_BLOCK.index());
28+
seen.insert(END_BLOCK.index());
3029

31-
let mut worklist = vec![START_BLOCK];
30+
let mut worklist = Vec::with_capacity(4);
31+
worklist.push(START_BLOCK);
3232
while let Some(bb) = worklist.pop() {
3333
for succ in mir.basic_block_data(bb).terminator().successors().iter() {
34-
if !seen[succ.index()] {
35-
seen[succ.index()] = true;
34+
if seen.insert(succ.index()) {
3635
worklist.push(*succ);
3736
}
3837
}
3938
}
40-
41-
util::retain_basic_blocks(mir, &seen);
39+
retain_basic_blocks(mir, &seen);
4240
}
4341

4442
fn remove_goto_chains(&self, mir: &mut Mir) -> bool {
@@ -90,12 +88,12 @@ impl SimplifyCfg {
9088
for bb in mir.all_basic_blocks() {
9189
let basic_block = mir.basic_block_data_mut(bb);
9290
let mut terminator = basic_block.terminator_mut();
93-
9491
*terminator = match *terminator {
9592
Terminator::If { ref targets, .. } if targets.0 == targets.1 => {
9693
changed = true;
9794
Terminator::Goto { target: targets.0 }
9895
}
96+
9997
Terminator::If { ref targets, cond: Operand::Constant(Constant {
10098
literal: Literal::Value {
10199
value: ConstVal::Bool(cond)
@@ -108,6 +106,7 @@ impl SimplifyCfg {
108106
Terminator::Goto { target: targets.1 }
109107
}
110108
}
109+
111110
Terminator::SwitchInt { ref targets, .. } if targets.len() == 1 => {
112111
Terminator::Goto { target: targets[0] }
113112
}
@@ -131,3 +130,27 @@ impl MirPass for SimplifyCfg {
131130
mir.basic_blocks.shrink_to_fit();
132131
}
133132
}
133+
134+
/// Mass removal of basic blocks to keep the ID-remapping cheap.
135+
fn retain_basic_blocks(mir: &mut Mir, keep: &BitVector) {
136+
let num_blocks = mir.basic_blocks.len();
137+
138+
let mut replacements: Vec<_> = (0..num_blocks).map(BasicBlock::new).collect();
139+
let mut used_blocks = 0;
140+
for alive_index in keep.iter() {
141+
replacements[alive_index] = BasicBlock::new(used_blocks);
142+
if alive_index != used_blocks {
143+
// Swap the next alive block data with the current available slot. Since alive_index is
144+
// non-decreasing this is a valid operation.
145+
mir.basic_blocks.swap(alive_index, used_blocks);
146+
}
147+
used_blocks += 1;
148+
}
149+
mir.basic_blocks.truncate(used_blocks);
150+
151+
for bb in mir.all_basic_blocks() {
152+
for target in mir.basic_block_data_mut(bb).terminator_mut().successors_mut() {
153+
*target = replacements[target.index()];
154+
}
155+
}
156+
}

branches/stable/src/librustc_mir/transform/util.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

branches/stable/src/libstd/collections/hash/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,13 +1402,13 @@ pub enum Entry<'a, K: 'a, V: 'a> {
14021402
/// An occupied Entry.
14031403
#[stable(feature = "rust1", since = "1.0.0")]
14041404
Occupied(
1405-
#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] OccupiedEntry<'a, K, V>
1405+
#[stable(feature = "rust1", since = "1.0.0")] OccupiedEntry<'a, K, V>
14061406
),
14071407

14081408
/// A vacant Entry.
14091409
#[stable(feature = "rust1", since = "1.0.0")]
14101410
Vacant(
1411-
#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] VacantEntry<'a, K, V>
1411+
#[stable(feature = "rust1", since = "1.0.0")] VacantEntry<'a, K, V>
14121412
),
14131413
}
14141414

0 commit comments

Comments
 (0)