Skip to content
Permalink
Browse files

Auto merge of #66917 - Centril:rollup-xj2enik, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #66503 (More useful test error messages on should_panic(expected=...) mismatch)
 - #66662 (Miri: run panic-catching tests in liballoc)
 - #66679 (Improve lifetime errors with implicit trait object lifetimes)
 - #66726 (Use recursion_limit for const eval stack limit)
 - #66790 (Do `min_const_fn` checks for `SetDiscriminant`s target)
 - #66832 (const_prop: detect and avoid catching Miri errors that require allocation)
 - #66880 (Add long error code explanation message for E0203)
 - #66890 (Format liballoc with rustfmt)
 - #66896 (pass Queries to compiler callbacks)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Dec 1, 2019
2 parents 135ccba + bed4c09 commit 4007d4ef26eab44bdabc2b7574d032152264d3ad
Showing with 657 additions and 631 deletions.
  1. +3 −3 src/liballoc/alloc/tests.rs
  2. +19 −19 src/liballoc/benches/btree/map.rs
  3. +32 −31 src/liballoc/benches/slice.rs
  4. +19 −16 src/liballoc/benches/str.rs
  5. +1 −1 src/liballoc/benches/vec_deque.rs
  6. +1 −4 src/liballoc/benches/vec_deque_append.rs
  7. +1 −1 src/liballoc/collections/btree/mod.rs
  8. +22 −20 src/liballoc/collections/btree/search.rs
  9. +8 −9 src/liballoc/collections/linked_list/tests.rs
  10. +3 −9 src/liballoc/collections/vec_deque/tests.rs
  11. +10 −12 src/liballoc/fmt.rs
  12. +8 −4 src/liballoc/prelude/v1.rs
  13. +7 −2 src/liballoc/raw_vec/tests.rs
  14. +92 −81 src/liballoc/slice.rs
  15. +3 −3 src/liballoc/tests.rs
  16. +14 −25 src/liballoc/tests/arc.rs
  17. +4 −1 src/liballoc/tests/binary_heap.rs
  18. +1 −1 src/liballoc/tests/boxed.rs
  19. +1 −6 src/liballoc/tests/btree/mod.rs
  20. +30 −45 src/liballoc/tests/linked_list.rs
  21. +15 −26 src/liballoc/tests/rc.rs
  22. +18 −10 src/liballoc/tests/slice.rs
  23. +2 −3 src/liballoc/tests/vec.rs
  24. +83 −83 src/liballoc/tests/vec_deque.rs
  25. +13 −7 src/librustc/mir/interpret/error.rs
  26. +0 −4 src/librustc/session/mod.rs
  27. +1 −1 src/librustc/ty/sty.rs
  28. +19 −7 src/librustc_driver/lib.rs
  29. +1 −2 src/librustc_error_codes/error_codes.rs
  30. +18 −0 src/librustc_error_codes/error_codes/E0203.md
  31. +1 −0 src/librustc_interface/lib.rs
  32. +3 −12 src/librustc_mir/borrow_check/nll/region_infer/error_reporting/outlives_suggestion.rs
  33. +34 −49 src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
  34. +1 −1 src/librustc_mir/interpret/eval_context.rs
  35. +1 −2 src/librustc_mir/transform/check_consts/validation.rs
  36. +25 −7 src/librustc_mir/transform/const_prop.rs
  37. +1 −1 src/librustc_mir/transform/qualify_min_const_fn.rs
  38. +20 −12 src/libtest/test_result.rs
  39. +39 −8 src/libtest/tests.rs
  40. +2 −2 src/test/ui/async-await/issues/issue-63388-1.nll.stderr
  41. +1 −0 src/test/ui/maybe-bounds-where.stderr
  42. +3 −3 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr
  43. +11 −10 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr
  44. +18 −24 src/test/ui/self/elision/lt-ref-self-async.nll.stderr
  45. +18 −24 src/test/ui/self/elision/ref-mut-self-async.nll.stderr
  46. +15 −20 src/test/ui/self/elision/ref-mut-struct-async.nll.stderr
  47. +15 −20 src/test/ui/self/elision/ref-struct-async.nll.stderr
@@ -1,15 +1,15 @@
use super::*;

extern crate test;
use test::Bencher;
use crate::boxed::Box;
use test::Bencher;

#[test]
fn allocate_zeroed() {
unsafe {
let layout = Layout::from_size_align(1024, 1).unwrap();
let ptr = Global.alloc_zeroed(layout.clone())
.unwrap_or_else(|_| handle_alloc_error(layout));
let ptr =
Global.alloc_zeroed(layout.clone()).unwrap_or_else(|_| handle_alloc_error(layout));

let mut i = ptr.cast::<u8>().as_ptr();
let end = i.add(layout.size());
@@ -1,12 +1,12 @@
use std::collections::BTreeMap;
use std::iter::Iterator;
use std::vec::Vec;
use std::collections::BTreeMap;

use rand::{Rng, seq::SliceRandom, thread_rng};
use test::{Bencher, black_box};
use rand::{seq::SliceRandom, thread_rng, Rng};
use test::{black_box, Bencher};

macro_rules! map_insert_rand_bench {
($name: ident, $n: expr, $map: ident) => (
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let n: usize = $n;
@@ -27,11 +27,11 @@ macro_rules! map_insert_rand_bench {
});
black_box(map);
}
)
};
}

macro_rules! map_insert_seq_bench {
($name: ident, $n: expr, $map: ident) => (
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
@@ -50,11 +50,11 @@ macro_rules! map_insert_seq_bench {
});
black_box(map);
}
)
};
}

macro_rules! map_find_rand_bench {
($name: ident, $n: expr, $map: ident) => (
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
@@ -78,11 +78,11 @@ macro_rules! map_find_rand_bench {
black_box(t);
})
}
)
};
}

macro_rules! map_find_seq_bench {
($name: ident, $n: expr, $map: ident) => (
($name: ident, $n: expr, $map: ident) => {
#[bench]
pub fn $name(b: &mut Bencher) {
let mut map = $map::new();
@@ -101,20 +101,20 @@ macro_rules! map_find_seq_bench {
black_box(x);
})
}
)
};
}

map_insert_rand_bench!{insert_rand_100, 100, BTreeMap}
map_insert_rand_bench!{insert_rand_10_000, 10_000, BTreeMap}
map_insert_rand_bench! {insert_rand_100, 100, BTreeMap}
map_insert_rand_bench! {insert_rand_10_000, 10_000, BTreeMap}

map_insert_seq_bench!{insert_seq_100, 100, BTreeMap}
map_insert_seq_bench!{insert_seq_10_000, 10_000, BTreeMap}
map_insert_seq_bench! {insert_seq_100, 100, BTreeMap}
map_insert_seq_bench! {insert_seq_10_000, 10_000, BTreeMap}

map_find_rand_bench!{find_rand_100, 100, BTreeMap}
map_find_rand_bench!{find_rand_10_000, 10_000, BTreeMap}
map_find_rand_bench! {find_rand_100, 100, BTreeMap}
map_find_rand_bench! {find_rand_10_000, 10_000, BTreeMap}

map_find_seq_bench!{find_seq_100, 100, BTreeMap}
map_find_seq_bench!{find_seq_10_000, 10_000, BTreeMap}
map_find_seq_bench! {find_seq_100, 100, BTreeMap}
map_find_seq_bench! {find_seq_10_000, 10_000, BTreeMap}

fn bench_iter(b: &mut Bencher, size: i32) {
let mut map = BTreeMap::<i32, i32>::new();
@@ -1,9 +1,9 @@
use std::{mem, ptr};

use rand::distributions::{Alphanumeric, Standard};
use rand::{thread_rng, Rng, SeedableRng};
use rand::distributions::{Standard, Alphanumeric};
use rand_xorshift::XorShiftRng;
use test::{Bencher, black_box};
use test::{black_box, Bencher};

#[bench]
fn iterator(b: &mut Bencher) {
@@ -239,7 +239,7 @@ macro_rules! sort {
b.iter(|| v.clone().$f());
b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
}
}
};
}

macro_rules! sort_strings {
@@ -251,7 +251,7 @@ macro_rules! sort_strings {
b.iter(|| v.clone().$f());
b.bytes = $len * mem::size_of::<&str>() as u64;
}
}
};
}

macro_rules! sort_expensive {
@@ -273,7 +273,7 @@ macro_rules! sort_expensive {
});
b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
}
}
};
}

macro_rules! sort_lexicographic {
@@ -284,7 +284,7 @@ macro_rules! sort_lexicographic {
b.iter(|| v.clone().$f(|x| x.to_string()));
b.bytes = $len * mem::size_of_val(&$gen(1)[0]) as u64;
}
}
};
}

sort!(sort, sort_small_ascending, gen_ascending, 10);
@@ -325,57 +325,58 @@ macro_rules! reverse {
fn $name(b: &mut Bencher) {
// odd length and offset by 1 to be as unaligned as possible
let n = 0xFFFFF;
let mut v: Vec<_> =
(0..1+(n / mem::size_of::<$ty>() as u64))
.map($f)
.collect();
let mut v: Vec<_> = (0..1 + (n / mem::size_of::<$ty>() as u64)).map($f).collect();
b.iter(|| black_box(&mut v[1..]).reverse());
b.bytes = n;
}
}
};
}

reverse!(reverse_u8, u8, |x| x as u8);
reverse!(reverse_u16, u16, |x| x as u16);
reverse!(reverse_u8x3, [u8;3], |x| [x as u8, (x>>8) as u8, (x>>16) as u8]);
reverse!(reverse_u8x3, [u8; 3], |x| [x as u8, (x >> 8) as u8, (x >> 16) as u8]);
reverse!(reverse_u32, u32, |x| x as u32);
reverse!(reverse_u64, u64, |x| x as u64);
reverse!(reverse_u128, u128, |x| x as u128);
#[repr(simd)] struct F64x4(f64, f64, f64, f64);
reverse!(reverse_simd_f64x4, F64x4, |x| { let x = x as f64; F64x4(x,x,x,x) });
#[repr(simd)]
struct F64x4(f64, f64, f64, f64);
reverse!(reverse_simd_f64x4, F64x4, |x| {
let x = x as f64;
F64x4(x, x, x, x)
});

macro_rules! rotate {
($name:ident, $gen:expr, $len:expr, $mid:expr) => {
#[bench]
fn $name(b: &mut Bencher) {
let size = mem::size_of_val(&$gen(1)[0]);
let mut v = $gen($len * 8 / size);
b.iter(|| black_box(&mut v).rotate_left(($mid*8+size-1)/size));
b.iter(|| black_box(&mut v).rotate_left(($mid * 8 + size - 1) / size));
b.bytes = (v.len() * size) as u64;
}
}
};
}

rotate!(rotate_tiny_by1, gen_random, 16, 1);
rotate!(rotate_tiny_half, gen_random, 16, 16/2);
rotate!(rotate_tiny_half_plus_one, gen_random, 16, 16/2+1);
rotate!(rotate_tiny_half, gen_random, 16, 16 / 2);
rotate!(rotate_tiny_half_plus_one, gen_random, 16, 16 / 2 + 1);

rotate!(rotate_medium_by1, gen_random, 9158, 1);
rotate!(rotate_medium_by727_u64, gen_random, 9158, 727);
rotate!(rotate_medium_by727_bytes, gen_random_bytes, 9158, 727);
rotate!(rotate_medium_by727_strings, gen_strings, 9158, 727);
rotate!(rotate_medium_half, gen_random, 9158, 9158/2);
rotate!(rotate_medium_half_plus_one, gen_random, 9158, 9158/2+1);
rotate!(rotate_medium_half, gen_random, 9158, 9158 / 2);
rotate!(rotate_medium_half_plus_one, gen_random, 9158, 9158 / 2 + 1);

// Intended to use more RAM than the machine has cache
rotate!(rotate_huge_by1, gen_random, 5*1024*1024, 1);
rotate!(rotate_huge_by9199_u64, gen_random, 5*1024*1024, 9199);
rotate!(rotate_huge_by9199_bytes, gen_random_bytes, 5*1024*1024, 9199);
rotate!(rotate_huge_by9199_strings, gen_strings, 5*1024*1024, 9199);
rotate!(rotate_huge_by9199_big, gen_big_random, 5*1024*1024, 9199);
rotate!(rotate_huge_by1234577_u64, gen_random, 5*1024*1024, 1234577);
rotate!(rotate_huge_by1234577_bytes, gen_random_bytes, 5*1024*1024, 1234577);
rotate!(rotate_huge_by1234577_strings, gen_strings, 5*1024*1024, 1234577);
rotate!(rotate_huge_by1234577_big, gen_big_random, 5*1024*1024, 1234577);
rotate!(rotate_huge_half, gen_random, 5*1024*1024, 5*1024*1024/2);
rotate!(rotate_huge_half_plus_one, gen_random, 5*1024*1024, 5*1024*1024/2+1);
rotate!(rotate_huge_by1, gen_random, 5 * 1024 * 1024, 1);
rotate!(rotate_huge_by9199_u64, gen_random, 5 * 1024 * 1024, 9199);
rotate!(rotate_huge_by9199_bytes, gen_random_bytes, 5 * 1024 * 1024, 9199);
rotate!(rotate_huge_by9199_strings, gen_strings, 5 * 1024 * 1024, 9199);
rotate!(rotate_huge_by9199_big, gen_big_random, 5 * 1024 * 1024, 9199);
rotate!(rotate_huge_by1234577_u64, gen_random, 5 * 1024 * 1024, 1234577);
rotate!(rotate_huge_by1234577_bytes, gen_random_bytes, 5 * 1024 * 1024, 1234577);
rotate!(rotate_huge_by1234577_strings, gen_strings, 5 * 1024 * 1024, 1234577);
rotate!(rotate_huge_by1234577_big, gen_big_random, 5 * 1024 * 1024, 1234577);
rotate!(rotate_huge_half, gen_random, 5 * 1024 * 1024, 5 * 1024 * 1024 / 2);
rotate!(rotate_huge_half_plus_one, gen_random, 5 * 1024 * 1024, 5 * 1024 * 1024 / 2 + 1);
@@ -1,4 +1,4 @@
use test::{Bencher, black_box};
use test::{black_box, Bencher};

#[bench]
fn char_iterator(b: &mut Bencher) {
@@ -12,7 +12,9 @@ fn char_iterator_for(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";

b.iter(|| {
for ch in s.chars() { black_box(ch); }
for ch in s.chars() {
black_box(ch);
}
});
}

@@ -40,7 +42,9 @@ fn char_iterator_rev_for(b: &mut Bencher) {
let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";

b.iter(|| {
for ch in s.chars().rev() { black_box(ch); }
for ch in s.chars().rev() {
black_box(ch);
}
});
}

@@ -79,7 +83,9 @@ fn split_ascii(b: &mut Bencher) {
fn split_extern_fn(b: &mut Bencher) {
let s = "Mary had a little lamb, Little lamb, little-lamb.";
let len = s.split(' ').count();
fn pred(c: char) -> bool { c == ' ' }
fn pred(c: char) -> bool {
c == ' '
}

b.iter(|| assert_eq!(s.split(pred).count(), len));
}
@@ -185,16 +191,19 @@ fn bench_contains_equal(b: &mut Bencher) {
})
}


macro_rules! make_test_inner {
($s:ident, $code:expr, $name:ident, $str:expr, $iters:expr) => {
#[bench]
fn $name(bencher: &mut Bencher) {
let mut $s = $str;
black_box(&mut $s);
bencher.iter(|| for _ in 0..$iters { black_box($code); });
bencher.iter(|| {
for _ in 0..$iters {
black_box($code);
}
});
}
}
};
}

macro_rules! make_test {
@@ -261,15 +270,9 @@ make_test!(match_indices_a_str, s, s.match_indices("a").count());

make_test!(split_a_str, s, s.split("a").count());

make_test!(trim_ascii_char, s, {
s.trim_matches(|c: char| c.is_ascii())
});
make_test!(trim_start_ascii_char, s, {
s.trim_start_matches(|c: char| c.is_ascii())
});
make_test!(trim_end_ascii_char, s, {
s.trim_end_matches(|c: char| c.is_ascii())
});
make_test!(trim_ascii_char, s, { s.trim_matches(|c: char| c.is_ascii()) });
make_test!(trim_start_ascii_char, s, { s.trim_start_matches(|c: char| c.is_ascii()) });
make_test!(trim_end_ascii_char, s, { s.trim_end_matches(|c: char| c.is_ascii()) });

make_test!(find_underscore_char, s, s.find('_'));
make_test!(rfind_underscore_char, s, s.rfind('_'));
@@ -1,5 +1,5 @@
use std::collections::VecDeque;
use test::{Bencher, black_box};
use test::{black_box, Bencher};

#[bench]
fn bench_new(b: &mut Bencher) {
@@ -30,8 +30,5 @@ fn main() {

assert!(BENCH_N % 2 == 0);
let median = (durations[(l / 2) - 1] + durations[l / 2]) / 2;
println!(
"\ncustom-bench vec_deque_append {:?} ns/iter\n",
median.as_nanos()
);
println!("\ncustom-bench vec_deque_append {:?} ns/iter\n", median.as_nanos());
}
@@ -1,6 +1,6 @@
pub mod map;
mod node;
mod search;
pub mod map;
pub mod set;

#[doc(hidden)]

0 comments on commit 4007d4e

Please sign in to comment.
You can’t perform that action at this time.