Skip to content

Commit 7e5583b

Browse files
committed
Merge remote-tracking branch 'origin/master' into miri
2 parents 0f6b5b0 + 5f3bd73 commit 7e5583b

File tree

519 files changed

+11741
-3361
lines changed

Some content is hidden

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

519 files changed

+11741
-3361
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
src/etc/installer/gfx/* binary
88
*.woff binary
99
src/vendor/** -text
10+
Cargo.lock -merge

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ will run all the tests on every platform we support. If it all works out,
336336

337337
Speaking of tests, Rust has a comprehensive test suite. More information about
338338
it can be found
339-
[here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md).
339+
[here](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md).
340340

341341
### External Dependencies
342342
[external-dependencies]: #external-dependencies

src/doc/not_found.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ Some things that might be helpful to you though:
1313

1414
# Search
1515

16-
* <form action="https://duckduckgo.com/">
16+
<form action="https://duckduckgo.com/">
1717
<input type="text" id="site-search" name="q" size="80"></input>
18-
<input type="submit" value="Search DuckDuckGo">
19-
</form>
20-
* Rust doc search: <span id="core-search"></span>
18+
<input type="submit" value="Search DuckDuckGo"></form>
19+
20+
Rust doc search: <span id="core-search"></span>
2121

2222
# Reference
2323

24-
* [The Rust official site](https://www.rust-lang.org)
25-
* [The Rust reference](https://doc.rust-lang.org/reference/index.html)
24+
* [The Rust official site](https://www.rust-lang.org)
25+
* [The Rust reference](https://doc.rust-lang.org/reference/index.html)
2626

2727
# Docs
2828

29-
* [The standard library](https://doc.rust-lang.org/std/)
29+
[The standard library](https://doc.rust-lang.org/std/)
3030

3131
<script>
3232
function get_url_fragments() {

src/liballoc/allocator.rs

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,8 @@ impl Layout {
217217
/// On arithmetic overflow, returns `None`.
218218
#[inline]
219219
pub fn repeat(&self, n: usize) -> Option<(Self, usize)> {
220-
let padded_size = match self.size.checked_add(self.padding_needed_for(self.align)) {
221-
None => return None,
222-
Some(padded_size) => padded_size,
223-
};
224-
let alloc_size = match padded_size.checked_mul(n) {
225-
None => return None,
226-
Some(alloc_size) => alloc_size,
227-
};
220+
let padded_size = self.size.checked_add(self.padding_needed_for(self.align))?;
221+
let alloc_size = padded_size.checked_mul(n)?;
228222

229223
// We can assume that `self.align` is a power-of-two that does
230224
// not exceed 2<sup>31</sup>. Furthermore, `alloc_size` has already been
@@ -246,26 +240,14 @@ impl Layout {
246240
/// On arithmetic overflow, returns `None`.
247241
pub fn extend(&self, next: Self) -> Option<(Self, usize)> {
248242
let new_align = cmp::max(self.align, next.align);
249-
let realigned = match Layout::from_size_align(self.size, new_align) {
250-
None => return None,
251-
Some(l) => l,
252-
};
243+
let realigned = Layout::from_size_align(self.size, new_align)?;
253244

254245
let pad = realigned.padding_needed_for(next.align);
255246

256-
let offset = match self.size.checked_add(pad) {
257-
None => return None,
258-
Some(offset) => offset,
259-
};
260-
let new_size = match offset.checked_add(next.size) {
261-
None => return None,
262-
Some(new_size) => new_size,
263-
};
247+
let offset = self.size.checked_add(pad)?;
248+
let new_size = offset.checked_add(next.size)?;
264249

265-
let layout = match Layout::from_size_align(new_size, new_align) {
266-
None => return None,
267-
Some(l) => l,
268-
};
250+
let layout = Layout::from_size_align(new_size, new_align)?;
269251
Some((layout, offset))
270252
}
271253

@@ -282,11 +264,7 @@ impl Layout {
282264
///
283265
/// On arithmetic overflow, returns `None`.
284266
pub fn repeat_packed(&self, n: usize) -> Option<Self> {
285-
let size = match self.size().checked_mul(n) {
286-
None => return None,
287-
Some(scaled) => scaled,
288-
};
289-
267+
let size = self.size().checked_mul(n)?;
290268
Layout::from_size_align(size, self.align)
291269
}
292270

@@ -306,14 +284,8 @@ impl Layout {
306284
///
307285
/// On arithmetic overflow, returns `None`.
308286
pub fn extend_packed(&self, next: Self) -> Option<(Self, usize)> {
309-
let new_size = match self.size().checked_add(next.size()) {
310-
None => return None,
311-
Some(new_size) => new_size,
312-
};
313-
let layout = match Layout::from_size_align(new_size, self.align) {
314-
None => return None,
315-
Some(l) => l,
316-
};
287+
let new_size = self.size().checked_add(next.size())?;
288+
let layout = Layout::from_size_align(new_size, self.align)?;
317289
Some((layout, self.size()))
318290
}
319291

src/liballoc/benches/btree/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use std::iter::Iterator;
1313
use std::vec::Vec;
1414
use std::collections::BTreeMap;
15-
use std::__rand::{Rng, thread_rng};
15+
use rand::{Rng, thread_rng};
1616
use test::{Bencher, black_box};
1717

1818
macro_rules! map_insert_rand_bench {

src/liballoc/benches/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::__rand::{thread_rng};
11+
use rand::{thread_rng};
1212
use std::mem;
1313
use std::ptr;
1414

src/liballoc/btree/set.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,21 +1067,15 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> {
10671067

10681068
fn next(&mut self) -> Option<&'a T> {
10691069
loop {
1070-
let o_cmp = match (self.a.peek(), self.b.peek()) {
1071-
(None, _) => None,
1072-
(_, None) => None,
1073-
(Some(a1), Some(b1)) => Some(a1.cmp(b1)),
1074-
};
1075-
match o_cmp {
1076-
None => return None,
1077-
Some(Less) => {
1070+
match Ord::cmp(self.a.peek()?, self.b.peek()?) {
1071+
Less => {
10781072
self.a.next();
10791073
}
1080-
Some(Equal) => {
1074+
Equal => {
10811075
self.b.next();
10821076
return self.a.next();
10831077
}
1084-
Some(Greater) => {
1078+
Greater => {
10851079
self.b.next();
10861080
}
10871081
}

src/liballoc/linked_list.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,15 @@ impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
10711071
}
10721072
}
10731073

1074+
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
1075+
impl<'a, T, F> Drop for DrainFilter<'a, T, F>
1076+
where F: FnMut(&mut T) -> bool,
1077+
{
1078+
fn drop(&mut self) {
1079+
for _ in self { }
1080+
}
1081+
}
1082+
10741083
#[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")]
10751084
impl<'a, T: 'a + fmt::Debug, F> fmt::Debug for DrainFilter<'a, T, F>
10761085
where F: FnMut(&mut T) -> bool

src/liballoc/string.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,10 +1044,7 @@ impl String {
10441044
#[inline]
10451045
#[stable(feature = "rust1", since = "1.0.0")]
10461046
pub fn pop(&mut self) -> Option<char> {
1047-
let ch = match self.chars().rev().next() {
1048-
Some(ch) => ch,
1049-
None => return None,
1050-
};
1047+
let ch = self.chars().rev().next()?;
10511048
let newlen = self.len() - ch.len_utf8();
10521049
unsafe {
10531050
self.vec.set_len(newlen);

src/liballoc/vec.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,10 +1423,7 @@ impl<T: PartialEq> Vec<T> {
14231423
/// ```
14241424
#[unstable(feature = "vec_remove_item", reason = "recently added", issue = "40062")]
14251425
pub fn remove_item(&mut self, item: &T) -> Option<T> {
1426-
let pos = match self.iter().position(|x| *x == *item) {
1427-
Some(x) => x,
1428-
None => return None,
1429-
};
1426+
let pos = self.iter().position(|x| *x == *item)?;
14301427
Some(self.remove(pos))
14311428
}
14321429
}

0 commit comments

Comments
 (0)