Skip to content

Rollup of 13 pull requests #78000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a020142
Refactor io/buffered.rs into submodules
Lucretiel Sep 11, 2020
96229f0
move buffered.rs to mod.rs
Lucretiel Sep 11, 2020
6d75cdf
Added updated compiler diagnostic
Lucretiel Sep 15, 2020
da700cb
Stabilize move_ref_pattern
Amjad50 Aug 30, 2020
afb9eeb
Disabled error `E0007` from rustc_error_codes
Amjad50 Aug 30, 2020
c4280af
Retry fix error reporting suggestions
Lucretiel Sep 17, 2020
985da43
[mir-opt] Allow debuginfo to be generated for a constant or a Place
wesleywiser May 30, 2020
0b923d3
add `str::{Split,RSplit}::as_str` methods
WaffleLapkin Oct 1, 2020
4747215
add `str::{SplitN, RSplitN, SplitTerminator, RSplitTerminator}::as_st…
WaffleLapkin Oct 1, 2020
076514c
add `str::SplitInclusive::as_str` method
WaffleLapkin Oct 1, 2020
f84f01c
Use futex-based thread-parker for Wasm32.
m-ou-se Oct 6, 2020
54a71e8
For backtrace, use StaticMutex instead of a raw sys Mutex.
m-ou-se Oct 7, 2020
17eb8d8
ICEs should print the top of the query stack
hosseind75 Sep 19, 2020
20ea929
run full query stack print just when RUST_BACKTRACE is set
hosseind75 Sep 19, 2020
7ccca35
fix invalid-punct-ident-1 test
hosseind75 Sep 19, 2020
d6d4388
add filter regexes to load-panic-backtraces test
hosseind75 Sep 20, 2020
d60b7e2
fix show we're just showing... message instead of the end of query st…
hosseind75 Sep 23, 2020
6e7e4ac
fix clippy custom_ice_message test
hosseind75 Sep 25, 2020
15663a4
add new line
hosseind75 Sep 28, 2020
2124e9b
rebase with master
hosseind75 Sep 29, 2020
2b91b7f
ICEs should print the top of the query stack
hosseind75 Sep 19, 2020
01f838a
run full query stack print just when RUST_BACKTRACE is set
hosseind75 Sep 19, 2020
2bfdd64
change approach and run ui tests
hosseind75 Sep 19, 2020
b6e9f08
show a message when we are showing limited slice of query stack
hosseind75 Sep 19, 2020
3c56ba5
fix invalid-punct-ident-1 test
hosseind75 Sep 19, 2020
d1e3059
add filter regexes to load-panic-backtraces test
hosseind75 Sep 20, 2020
6c0f06a
fix show we're just showing... message instead of the end of query st…
hosseind75 Sep 23, 2020
c61d95b
remove new line
hosseind75 Sep 29, 2020
998186e
revert deleted new line
hosseind75 Oct 3, 2020
42ebae3
delete const-pat-ice test stderr
Oct 6, 2020
73d8f00
change condition for end of query stack message
Oct 8, 2020
7280f6a
rustc_parse: correct span on cast expr with attrs
calebcartwright Oct 10, 2020
4e82da4
rustc_parse: correct span on range expr with attrs
calebcartwright Oct 12, 2020
f4034eb
BTreeMap: test invariants more thoroughly and more readably
ssomers Oct 5, 2020
5875657
Fix comment about non-reentrant StaticMutex::lock().
m-ou-se Oct 7, 2020
44a2af3
Remove lifetime from StaticMutex and assume 'static.
m-ou-se Oct 7, 2020
46cc889
fix stderr file of clippy/custom_ice_message test
Oct 14, 2020
9752787
mangling: non-monomorphic `#[rustc_symbol_name]`
davidtwco Aug 18, 2020
fbdfe2c
mangling: encode all impl parameters
davidtwco Aug 24, 2020
95daa06
fix off-by-one in parameter spans
euclio Sep 26, 2020
14b2d16
ensure arguments are included in count mismatch span
euclio Sep 24, 2020
1c03f6d
Fix intra doc link for needs_drop
Manishearth Oct 15, 2020
7bd6403
fill in the tracking issue
WaffleLapkin Oct 15, 2020
73585b8
Rollup merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk
Dylan-DPC Oct 15, 2020
5e3b4fa
Rollup merge of #75023 - euclio:argument-span, r=estebank
Dylan-DPC Oct 15, 2020
355d81b
Rollup merge of #75265 - WaffleLapkin:str_split_as_str, r=dtolnay
Dylan-DPC Oct 15, 2020
bd66ce6
Rollup merge of #75675 - davidtwco:symbol-mangling-impl-params, r=eddyb
Dylan-DPC Oct 15, 2020
d7cd93c
Rollup merge of #76084 - Lucretiel:split-buffered, r=dtolnay
Dylan-DPC Oct 15, 2020
2c74117
Rollup merge of #76119 - Amjad50:stabilizing-move_ref_pattern, r=niko…
Dylan-DPC Oct 15, 2020
e16dee1
Rollup merge of #77493 - hosseind88:ICEs_should_always_print_the_top_…
Dylan-DPC Oct 15, 2020
284f1df
Rollup merge of #77612 - ssomers:btree_cleanup_2, r=Mark-Simulacrum
Dylan-DPC Oct 15, 2020
235fb8b
Rollup merge of #77619 - fusion-engineering-forks:wasm-parker, r=dtolnay
Dylan-DPC Oct 15, 2020
143aa29
Rollup merge of #77646 - fusion-engineering-forks:use-static-mutex, r…
Dylan-DPC Oct 15, 2020
a0781d4
Rollup merge of #77648 - fusion-engineering-forks:static-mutex, r=dto…
Dylan-DPC Oct 15, 2020
7523b4b
Rollup merge of #77780 - calebcartwright:cast-expr-attr-span, r=oli-obk
Dylan-DPC Oct 15, 2020
0c1cfb3
Rollup merge of #77980 - Manishearth:needs-drop-intra, r=jyn514
Dylan-DPC Oct 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 10 additions & 79 deletions library/alloc/src/collections/btree/map/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::super::{navigate::Position, node, DeterministicRng};
use super::super::{node, DeterministicRng};
use super::Entry::{Occupied, Vacant};
use super::*;
use crate::boxed::Box;
Expand All @@ -7,7 +7,7 @@ use crate::rc::Rc;
use crate::string::{String, ToString};
use crate::vec::Vec;
use std::convert::TryFrom;
use std::iter::FromIterator;
use std::iter::{self, FromIterator};
use std::mem;
use std::ops::Bound::{self, Excluded, Included, Unbounded};
use std::ops::RangeBounds;
Expand Down Expand Up @@ -42,19 +42,6 @@ fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator<Item = &'a mut T>
}
}

struct SeriesChecker<T> {
previous: Option<T>,
}

impl<T: Copy + Debug + Ord> SeriesChecker<T> {
fn is_ascending(&mut self, next: T) {
if let Some(previous) = self.previous {
assert!(previous < next, "{:?} >= {:?}", previous, next);
}
self.previous = Some(next);
}
}

impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
/// Panics if the map (or the code navigating it) is corrupted.
fn check(&self)
Expand All @@ -63,44 +50,10 @@ impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
{
if let Some(root) = &self.root {
let root_node = root.node_as_ref();
let mut checker = SeriesChecker { previous: None };
let mut internal_length = 0;
let mut internal_kv_count = 0;
let mut leaf_length = 0;
root_node.visit_nodes_in_order(|pos| match pos {
Position::Leaf(node) => {
let is_root = root_node.height() == 0;
let min_len = if is_root { 0 } else { node::MIN_LEN };
assert!(node.len() >= min_len, "{} < {}", node.len(), min_len);

for idx in 0..node.len() {
let key = *unsafe { node.key_at(idx) };
checker.is_ascending(key);
}
leaf_length += node.len();
}
Position::Internal(node) => {
let is_root = root_node.height() == node.height();
let min_len = if is_root { 1 } else { node::MIN_LEN };
assert!(node.len() >= min_len, "{} < {}", node.len(), min_len);

for idx in 0..=node.len() {
let edge = unsafe { node::Handle::new_edge(node, idx) };
assert!(edge.descend().ascend().ok().unwrap() == edge);
}

internal_length += node.len();
}
Position::InternalKV(kv) => {
let key = *kv.into_kv().0;
checker.is_ascending(key);

internal_kv_count += 1;
}
});
assert_eq!(internal_length, internal_kv_count);
assert_eq!(root_node.calc_length(), internal_length + leaf_length);
assert_eq!(self.length, internal_length + leaf_length);
assert!(root_node.ascend().is_err());
root_node.assert_back_pointers();
root_node.assert_ascending();
assert_eq!(self.length, root_node.assert_and_add_lengths());
} else {
assert_eq!(self.length, 0);
}
Expand All @@ -116,28 +69,7 @@ impl<'a, K: 'a, V: 'a> BTreeMap<K, V> {
K: Debug,
{
if let Some(root) = self.root.as_ref() {
let mut result = String::new();
let root_node = root.node_as_ref();
root_node.visit_nodes_in_order(|pos| match pos {
Position::Leaf(leaf) => {
let depth = root_node.height();
let indent = " ".repeat(depth);
result += &format!("\n{}", indent);
for idx in 0..leaf.len() {
if idx > 0 {
result += ", ";
}
result += &format!("{:?}", unsafe { leaf.key_at(idx) });
}
}
Position::Internal(_) => {}
Position::InternalKV(kv) => {
let depth = root_node.height() - kv.into_node().height();
let indent = " ".repeat(depth);
result += &format!("\n{}{:?}", indent, kv.into_kv().0);
}
});
result
root.node_as_ref().dump_keys()
} else {
String::from("not yet allocated")
}
Expand Down Expand Up @@ -170,7 +102,6 @@ fn test_levels() {
let last_key = *map.last_key_value().unwrap().0;
map.insert(last_key + 1, ());
}
println!("{}", map.dump_keys());
map.check();
// Structure:
// - 1 element in internal root node with 2 children
Expand Down Expand Up @@ -372,7 +303,7 @@ fn test_iter_rev() {
fn do_test_iter_mut_mutation<T>(size: usize)
where
T: Copy + Debug + Ord + TryFrom<usize>,
<T as std::convert::TryFrom<usize>>::Error: std::fmt::Debug,
<T as TryFrom<usize>>::Error: Debug,
{
let zero = T::try_from(0).unwrap();
let mut map: BTreeMap<T, T> = (0..size).map(|i| (T::try_from(i).unwrap(), zero)).collect();
Expand Down Expand Up @@ -857,7 +788,7 @@ mod test_drain_filter {
fn consuming_nothing() {
let pairs = (0..3).map(|i| (i, i));
let mut map: BTreeMap<_, _> = pairs.collect();
assert!(map.drain_filter(|_, _| false).eq(std::iter::empty()));
assert!(map.drain_filter(|_, _| false).eq(iter::empty()));
map.check();
}

Expand All @@ -878,7 +809,7 @@ mod test_drain_filter {
*v += 6;
false
})
.eq(std::iter::empty())
.eq(iter::empty())
);
assert!(map.keys().copied().eq(0..3));
assert!(map.values().copied().eq(6..9));
Expand Down
105 changes: 105 additions & 0 deletions library/alloc/src/collections/btree/node/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,109 @@
use super::super::navigate;
use super::*;
use crate::fmt::Debug;
use crate::string::String;

impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
pub fn assert_back_pointers(self) {
match self.force() {
ForceResult::Leaf(_) => {}
ForceResult::Internal(node) => {
for idx in 0..=node.len() {
let edge = unsafe { Handle::new_edge(node, idx) };
let child = edge.descend();
assert!(child.ascend().ok() == Some(edge));
child.assert_back_pointers();
}
}
}
}

pub fn assert_ascending(self)
where
K: Copy + Debug + Ord,
{
struct SeriesChecker<T> {
previous: Option<T>,
}
impl<T: Copy + Debug + Ord> SeriesChecker<T> {
fn is_ascending(&mut self, next: T) {
if let Some(previous) = self.previous {
assert!(previous < next, "{:?} >= {:?}", previous, next);
}
self.previous = Some(next);
}
}

let mut checker = SeriesChecker { previous: None };
self.visit_nodes_in_order(|pos| match pos {
navigate::Position::Leaf(node) => {
for idx in 0..node.len() {
let key = *unsafe { node.key_at(idx) };
checker.is_ascending(key);
}
}
navigate::Position::InternalKV(kv) => {
let key = *kv.into_kv().0;
checker.is_ascending(key);
}
navigate::Position::Internal(_) => {}
});
}

pub fn assert_and_add_lengths(self) -> usize {
let mut internal_length = 0;
let mut internal_kv_count = 0;
let mut leaf_length = 0;
self.visit_nodes_in_order(|pos| match pos {
navigate::Position::Leaf(node) => {
let is_root = self.height() == 0;
let min_len = if is_root { 0 } else { MIN_LEN };
assert!(node.len() >= min_len, "{} < {}", node.len(), min_len);
leaf_length += node.len();
}
navigate::Position::Internal(node) => {
let is_root = self.height() == node.height();
let min_len = if is_root { 1 } else { MIN_LEN };
assert!(node.len() >= min_len, "{} < {}", node.len(), min_len);
internal_length += node.len();
}
navigate::Position::InternalKV(_) => {
internal_kv_count += 1;
}
});
assert_eq!(internal_length, internal_kv_count);
let total = internal_length + leaf_length;
assert_eq!(self.calc_length(), total);
total
}

pub fn dump_keys(self) -> String
where
K: Debug,
{
let mut result = String::new();
self.visit_nodes_in_order(|pos| match pos {
navigate::Position::Leaf(leaf) => {
let depth = self.height();
let indent = " ".repeat(depth);
result += &format!("\n{}", indent);
for idx in 0..leaf.len() {
if idx > 0 {
result += ", ";
}
result += &format!("{:?}", unsafe { leaf.key_at(idx) });
}
}
navigate::Position::Internal(_) => {}
navigate::Position::InternalKV(kv) => {
let depth = self.height() - kv.into_node().height();
let indent = " ".repeat(depth);
result += &format!("\n{}{:?}", indent, kv.into_kv().0);
}
});
result
}
}

#[test]
fn test_splitpoint() {
Expand Down