Skip to content

Commit 339f574

Browse files
committedMay 6, 2020
Auto merge of rust-lang#71949 - Dylan-DPC:rollup-0gg02wd, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#71510 (Btreemap iter intertwined) - rust-lang#71727 (SipHasher with keys initialized to 0 should just use new()) - rust-lang#71889 (Explain our RwLock implementation) - rust-lang#71905 (Add command aliases from Cargo to x.py commands) - rust-lang#71914 (Backport 1.43.1 release notes to master) - rust-lang#71921 (explain the types used in the open64 call) Failed merges: r? @ghost
2 parents 8da5869 + b86620a commit 339f574

File tree

9 files changed

+195
-117
lines changed

9 files changed

+195
-117
lines changed
 

‎RELEASES.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Version 1.43.1 (2020-05-07)
2+
===========================
3+
4+
* [Updated openssl-src to 1.1.1g for CVE-2020-1967.][71430]
5+
* [Fixed the stabilization of AVX-512 features.][71473]
6+
* [Fixed `cargo package --list` not working with unpublished dependencies.][cargo/8151]
7+
8+
[71430]: https://github.com/rust-lang/rust/pull/71430
9+
[71473]: https://github.com/rust-lang/rust/issues/71473
10+
[cargo/8151]: https://github.com/rust-lang/cargo/issues/8151
11+
12+
113
Version 1.43.0 (2020-04-23)
214
==========================
315

@@ -14,7 +26,7 @@ Language
1426
- [Merge `fn` syntax + cleanup item parsing.][68728]
1527
- [`item` macro fragments can be interpolated into `trait`s, `impl`s, and `extern` blocks.][69366]
1628
For example, you may now write:
17-
```rust
29+
```rust
1830
macro_rules! mac_trait {
1931
($i:item) => {
2032
trait T { $i }
@@ -82,7 +94,7 @@ Misc
8294
- [Certain checks in the `const_err` lint were deemed unrelated to const
8395
evaluation][69185], and have been moved to the `unconditional_panic` and
8496
`arithmetic_overflow` lints.
85-
97+
8698
Compatibility Notes
8799
-------------------
88100

@@ -173,7 +185,7 @@ Language
173185
(e.g. `type Foo: Ord;`).
174186
- `...` (the C-variadic type) may occur syntactically directly as the type of
175187
any function parameter.
176-
188+
177189
These are still rejected *semantically*, so you will likely receive an error
178190
but these changes can be seen and parsed by procedural macros and
179191
conditional compilation.
@@ -465,7 +477,7 @@ Compatibility Notes
465477
- [Using `#[inline]` on function prototypes and consts now emits a warning under
466478
`unused_attribute` lint.][65294] Using `#[inline]` anywhere else inside traits
467479
or `extern` blocks now correctly emits a hard error.
468-
480+
469481
[65294]: https://github.com/rust-lang/rust/pull/65294/
470482
[66103]: https://github.com/rust-lang/rust/pull/66103/
471483
[65843]: https://github.com/rust-lang/rust/pull/65843/

‎src/bootstrap/flags.rs

+17-13
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ impl Flags {
106106
Usage: x.py <subcommand> [options] [<paths>...]
107107
108108
Subcommands:
109-
build Compile either the compiler or libraries
110-
check Compile either the compiler or libraries, using cargo check
109+
build, b Compile either the compiler or libraries
110+
check, c Compile either the compiler or libraries, using cargo check
111111
clippy Run clippy (uses rustup/cargo-installed clippy binary)
112112
fix Run cargo fix
113113
fmt Run rustfmt
114-
test Build and run some test suites
114+
test, t Build and run some test suites
115115
bench Build and run some benchmarks
116116
doc Build documentation
117117
clean Clean out build directories
118118
dist Build distribution artifacts
119119
install Install distribution artifacts
120-
run Run tools contained in this repository
120+
run, r Run tools contained in this repository
121121
122122
To learn more about a subcommand, run `./x.py <subcommand> -h`",
123123
);
@@ -184,17 +184,21 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
184184
// there on out.
185185
let subcommand = args.iter().find(|&s| {
186186
(s == "build")
187+
|| (s == "b")
187188
|| (s == "check")
189+
|| (s == "c")
188190
|| (s == "clippy")
189191
|| (s == "fix")
190192
|| (s == "fmt")
191193
|| (s == "test")
194+
|| (s == "t")
192195
|| (s == "bench")
193196
|| (s == "doc")
194197
|| (s == "clean")
195198
|| (s == "dist")
196199
|| (s == "install")
197200
|| (s == "run")
201+
|| (s == "r")
198202
});
199203
let subcommand = match subcommand {
200204
Some(s) => s,
@@ -210,7 +214,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
210214

211215
// Some subcommands get extra options
212216
match subcommand.as_str() {
213-
"test" => {
217+
"test" | "t" => {
214218
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
215219
opts.optmulti("", "test-args", "extra arguments", "ARGS");
216220
opts.optmulti(
@@ -285,7 +289,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
285289
}
286290
// Extra help text for some commands
287291
match subcommand.as_str() {
288-
"build" => {
292+
"build" | "b" => {
289293
subcommand_help.push_str(
290294
"\n
291295
Arguments:
@@ -312,7 +316,7 @@ Arguments:
312316
Once this is done, build/$ARCH/stage1 contains a usable compiler.",
313317
);
314318
}
315-
"check" => {
319+
"check" | "c" => {
316320
subcommand_help.push_str(
317321
"\n
318322
Arguments:
@@ -362,7 +366,7 @@ Arguments:
362366
./x.py fmt --check",
363367
);
364368
}
365-
"test" => {
369+
"test" | "t" => {
366370
subcommand_help.push_str(
367371
"\n
368372
Arguments:
@@ -407,7 +411,7 @@ Arguments:
407411
./x.py doc --stage 1",
408412
);
409413
}
410-
"run" => {
414+
"run" | "r" => {
411415
subcommand_help.push_str(
412416
"\n
413417
Arguments:
@@ -453,11 +457,11 @@ Arguments:
453457
}
454458

455459
let cmd = match subcommand.as_str() {
456-
"build" => Subcommand::Build { paths },
457-
"check" => Subcommand::Check { paths },
460+
"build" | "b" => Subcommand::Build { paths },
461+
"check" | "c" => Subcommand::Check { paths },
458462
"clippy" => Subcommand::Clippy { paths },
459463
"fix" => Subcommand::Fix { paths },
460-
"test" => Subcommand::Test {
464+
"test" | "t" => Subcommand::Test {
461465
paths,
462466
bless: matches.opt_present("bless"),
463467
compare_mode: matches.opt_str("compare-mode"),
@@ -487,7 +491,7 @@ Arguments:
487491
"fmt" => Subcommand::Format { check: matches.opt_present("check") },
488492
"dist" => Subcommand::Dist { paths },
489493
"install" => Subcommand::Install { paths },
490-
"run" => {
494+
"run" | "r" => {
491495
if paths.is_empty() {
492496
println!("\nrun requires at least a path!\n");
493497
usage(1, &opts, &subcommand_help, &extra_help);

‎src/liballoc/benches/btree/map.rs

+72-46
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::collections::BTreeMap;
22
use std::iter::Iterator;
3-
use std::ops::Bound::{Excluded, Unbounded};
3+
use std::ops::RangeBounds;
44
use std::vec::Vec;
55

66
use rand::{seq::SliceRandom, thread_rng, Rng};
@@ -117,7 +117,7 @@ map_find_rand_bench! {find_rand_10_000, 10_000, BTreeMap}
117117
map_find_seq_bench! {find_seq_100, 100, BTreeMap}
118118
map_find_seq_bench! {find_seq_10_000, 10_000, BTreeMap}
119119

120-
fn bench_iter(b: &mut Bencher, size: i32) {
120+
fn bench_iteration(b: &mut Bencher, size: i32) {
121121
let mut map = BTreeMap::<i32, i32>::new();
122122
let mut rng = thread_rng();
123123

@@ -133,21 +133,21 @@ fn bench_iter(b: &mut Bencher, size: i32) {
133133
}
134134

135135
#[bench]
136-
pub fn iter_20(b: &mut Bencher) {
137-
bench_iter(b, 20);
136+
pub fn iteration_20(b: &mut Bencher) {
137+
bench_iteration(b, 20);
138138
}
139139

140140
#[bench]
141-
pub fn iter_1000(b: &mut Bencher) {
142-
bench_iter(b, 1000);
141+
pub fn iteration_1000(b: &mut Bencher) {
142+
bench_iteration(b, 1000);
143143
}
144144

145145
#[bench]
146-
pub fn iter_100000(b: &mut Bencher) {
147-
bench_iter(b, 100000);
146+
pub fn iteration_100000(b: &mut Bencher) {
147+
bench_iteration(b, 100000);
148148
}
149149

150-
fn bench_iter_mut(b: &mut Bencher, size: i32) {
150+
fn bench_iteration_mut(b: &mut Bencher, size: i32) {
151151
let mut map = BTreeMap::<i32, i32>::new();
152152
let mut rng = thread_rng();
153153

@@ -163,18 +163,18 @@ fn bench_iter_mut(b: &mut Bencher, size: i32) {
163163
}
164164

165165
#[bench]
166-
pub fn iter_mut_20(b: &mut Bencher) {
167-
bench_iter_mut(b, 20);
166+
pub fn iteration_mut_20(b: &mut Bencher) {
167+
bench_iteration_mut(b, 20);
168168
}
169169

170170
#[bench]
171-
pub fn iter_mut_1000(b: &mut Bencher) {
172-
bench_iter_mut(b, 1000);
171+
pub fn iteration_mut_1000(b: &mut Bencher) {
172+
bench_iteration_mut(b, 1000);
173173
}
174174

175175
#[bench]
176-
pub fn iter_mut_100000(b: &mut Bencher) {
177-
bench_iter_mut(b, 100000);
176+
pub fn iteration_mut_100000(b: &mut Bencher) {
177+
bench_iteration_mut(b, 100000);
178178
}
179179

180180
fn bench_first_and_last(b: &mut Bencher, size: i32) {
@@ -202,57 +202,83 @@ pub fn first_and_last_10k(b: &mut Bencher) {
202202
bench_first_and_last(b, 10_000);
203203
}
204204

205-
#[bench]
206-
pub fn range_excluded_excluded(b: &mut Bencher) {
207-
let size = 144;
208-
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
205+
const BENCH_RANGE_SIZE: i32 = 145;
206+
const BENCH_RANGE_COUNT: i32 = BENCH_RANGE_SIZE * (BENCH_RANGE_SIZE - 1) / 2;
207+
208+
fn bench_range<F, R>(b: &mut Bencher, f: F)
209+
where
210+
F: Fn(i32, i32) -> R,
211+
R: RangeBounds<i32>,
212+
{
213+
let map: BTreeMap<_, _> = (0..BENCH_RANGE_SIZE).map(|i| (i, i)).collect();
209214
b.iter(|| {
210-
for first in 0..size {
211-
for last in first + 1..size {
212-
black_box(map.range((Excluded(first), Excluded(last))));
215+
let mut c = 0;
216+
for i in 0..BENCH_RANGE_SIZE {
217+
for j in i + 1..BENCH_RANGE_SIZE {
218+
black_box(map.range(f(i, j)));
219+
c += 1;
213220
}
214221
}
222+
debug_assert_eq!(c, BENCH_RANGE_COUNT);
215223
});
216224
}
217225

218226
#[bench]
219-
pub fn range_excluded_unbounded(b: &mut Bencher) {
220-
let size = 144;
221-
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
222-
b.iter(|| {
223-
for first in 0..size {
224-
black_box(map.range((Excluded(first), Unbounded)));
225-
}
226-
});
227+
pub fn range_included_excluded(b: &mut Bencher) {
228+
bench_range(b, |i, j| i..j);
227229
}
228230

229231
#[bench]
230232
pub fn range_included_included(b: &mut Bencher) {
231-
let size = 144;
232-
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
233-
b.iter(|| {
234-
for first in 0..size {
235-
for last in first..size {
236-
black_box(map.range(first..=last));
237-
}
238-
}
239-
});
233+
bench_range(b, |i, j| i..=j);
240234
}
241235

242236
#[bench]
243237
pub fn range_included_unbounded(b: &mut Bencher) {
244-
let size = 144;
238+
bench_range(b, |i, _| i..);
239+
}
240+
241+
#[bench]
242+
pub fn range_unbounded_unbounded(b: &mut Bencher) {
243+
bench_range(b, |_, _| ..);
244+
}
245+
246+
fn bench_iter(b: &mut Bencher, repeats: i32, size: i32) {
245247
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
246248
b.iter(|| {
247-
for first in 0..size {
248-
black_box(map.range(first..));
249+
for _ in 0..repeats {
250+
black_box(map.iter());
249251
}
250252
});
251253
}
252254

255+
/// Contrast range_unbounded_unbounded with `iter()`.
253256
#[bench]
254-
pub fn range_unbounded_unbounded(b: &mut Bencher) {
255-
let size = 144;
256-
let map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
257-
b.iter(|| map.range(..));
257+
pub fn range_unbounded_vs_iter(b: &mut Bencher) {
258+
bench_iter(b, BENCH_RANGE_COUNT, BENCH_RANGE_SIZE);
259+
}
260+
261+
#[bench]
262+
pub fn iter_0(b: &mut Bencher) {
263+
bench_iter(b, 1_000, 0);
264+
}
265+
266+
#[bench]
267+
pub fn iter_1(b: &mut Bencher) {
268+
bench_iter(b, 1_000, 1);
269+
}
270+
271+
#[bench]
272+
pub fn iter_100(b: &mut Bencher) {
273+
bench_iter(b, 1_000, 100);
274+
}
275+
276+
#[bench]
277+
pub fn iter_10k(b: &mut Bencher) {
278+
bench_iter(b, 1_000, 10_000);
279+
}
280+
281+
#[bench]
282+
pub fn iter_1m(b: &mut Bencher) {
283+
bench_iter(b, 1_000, 1_000_000);
258284
}

0 commit comments

Comments
 (0)
Please sign in to comment.