Skip to content

Commit abe1e0d

Browse files
committed
Adjust test outputs
1 parent 507e3f2 commit abe1e0d

35 files changed

+165
-57
lines changed

src/liballoc/collections/btree/map.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,8 @@ use UnderflowResult::*;
124124
/// ```
125125
#[stable(feature = "rust1", since = "1.0.0")]
126126
pub struct BTreeMap<K, V, A: AllocRef = Global> {
127-
root: Option<node::Root<K, V>>,
127+
root: Option<node::Root<K, V, A>>,
128128
length: usize,
129-
alloc: PhantomData<A>,
130129
}
131130

132131
#[stable(feature = "btree_drop", since = "1.7.0")]
@@ -150,11 +149,7 @@ impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
150149
{
151150
match node.force() {
152151
Leaf(leaf) => {
153-
let mut out_tree = BTreeMap {
154-
root: Some(node::Root::new_leaf()),
155-
length: 0,
156-
alloc: PhantomData,
157-
};
152+
let mut out_tree = BTreeMap { root: Some(node::Root::new_leaf()), length: 0 };
158153

159154
{
160155
let root = out_tree.root.as_mut().unwrap();
@@ -216,7 +211,7 @@ impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
216211
if self.is_empty() {
217212
// Ideally we'd call `BTreeMap::new` here, but that has the `K:
218213
// Ord` constraint, which this method lacks.
219-
BTreeMap { root: None, length: 0, alloc: PhantomData }
214+
BTreeMap { root: None, length: 0 }
220215
} else {
221216
clone_subtree(self.root.as_ref().unwrap().as_ref())
222217
}

src/liballoc/collections/btree/node.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ impl<K, V> BoxedNode<K, V> {
142142
/// An owned tree.
143143
///
144144
/// Note that this does not have a destructor, and must be cleaned up manually.
145-
pub struct Root<K, V> {
145+
pub struct Root<K, V, A: AllocRef = Global> {
146146
node: BoxedNode<K, V>,
147147
/// The number of levels below the root node.
148148
height: usize,
149+
alloc: PhantomData<A>,
149150
}
150151

151152
unsafe impl<K: Sync, V: Sync> Sync for Root<K, V> {}
@@ -154,7 +155,11 @@ unsafe impl<K: Send, V: Send> Send for Root<K, V> {}
154155
impl<K, V> Root<K, V> {
155156
/// Returns a new owned tree, with its own root node that is initially empty.
156157
pub fn new_leaf() -> Self {
157-
Root { node: BoxedNode::from_leaf(Box::new(unsafe { LeafNode::new() })), height: 0 }
158+
Root {
159+
node: BoxedNode::from_leaf(Box::new(unsafe { LeafNode::new() })),
160+
height: 0,
161+
alloc: PhantomData,
162+
}
158163
}
159164

160165
pub fn as_ref(&self) -> NodeRef<marker::Immut<'_>, K, V, marker::LeafOrInternal> {
@@ -174,7 +179,9 @@ impl<K, V> Root<K, V> {
174179
_marker: PhantomData,
175180
}
176181
}
182+
}
177183

184+
impl<K, V, A: AllocRef> Root<K, V, A> {
178185
pub fn into_ref(self) -> NodeRef<marker::Owned, K, V, marker::LeafOrInternal> {
179186
NodeRef {
180187
height: self.height,
@@ -183,7 +190,9 @@ impl<K, V> Root<K, V> {
183190
_marker: PhantomData,
184191
}
185192
}
193+
}
186194

195+
impl<K, V> Root<K, V> {
187196
/// Adds a new internal node with a single edge, pointing to the previous root, and make that
188197
/// new node the root. This increases the height by 1 and is the opposite of `pop_level`.
189198
pub fn push_level(&mut self) -> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
@@ -615,7 +624,8 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
615624
ForceResult::Internal(internal) => {
616625
let edge =
617626
ptr::read(internal.as_internal().edges.get_unchecked(idx + 1).as_ptr());
618-
let mut new_root = Root { node: edge, height: internal.height - 1 };
627+
let mut new_root =
628+
Root { node: edge, height: internal.height - 1, alloc: PhantomData };
619629
(*new_root.as_mut().as_leaf_mut()).parent = ptr::null();
620630
Some(new_root)
621631
}
@@ -647,7 +657,8 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
647657
0,
648658
);
649659

650-
let mut new_root = Root { node: edge, height: internal.height - 1 };
660+
let mut new_root =
661+
Root { node: edge, height: internal.height - 1, alloc: PhantomData };
651662
(*new_root.as_mut().as_leaf_mut()).parent = ptr::null();
652663

653664
for i in 0..old_len {
@@ -1026,7 +1037,12 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::KV>
10261037
(*self.node.as_leaf_mut()).len = self.idx as u16;
10271038
new_node.len = new_len as u16;
10281039

1029-
(self.node, k, v, Root { node: BoxedNode::from_leaf(new_node), height: 0 })
1040+
(
1041+
self.node,
1042+
k,
1043+
v,
1044+
Root { node: BoxedNode::from_leaf(new_node), height: 0, alloc: PhantomData },
1045+
)
10301046
}
10311047
}
10321048

@@ -1081,7 +1097,8 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
10811097
(*self.node.as_leaf_mut()).len = self.idx as u16;
10821098
new_node.data.len = new_len as u16;
10831099

1084-
let mut new_root = Root { node: BoxedNode::from_internal(new_node), height };
1100+
let mut new_root =
1101+
Root { node: BoxedNode::from_internal(new_node), height, alloc: PhantomData };
10851102

10861103
for i in 0..(new_len + 1) {
10871104
Handle::new_edge(new_root.as_mut().cast_unchecked(), i).correct_parent_link();

src/test/debuginfo/pretty-huge-vec.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
// gdb-command: run
1111

1212
// gdb-command: print vec
13-
// gdb-check:$1 = Vec<u8>(len: 1000000000, cap: 1000000000) = {[...]...}
13+
// gdb-check:$1 = Vec<u8, alloc::alloc::Global>(len: 1000000000, cap: 1000000000) = {[...]...}
1414

1515
// gdb-command: print slice
1616
// gdb-check:$2 = &[u8](len: 1000000000) = {[...]...}
1717

18-
1918
#![allow(unused_variables)]
2019

2120
fn main() {
22-
2321
// Vec
2422
let mut vec: Vec<u8> = Vec::with_capacity(1_000_000_000);
25-
unsafe{ vec.set_len(1_000_000_000) }
23+
unsafe { vec.set_len(1_000_000_000) }
2624
let slice = &vec[..];
2725

2826
zzz(); // #break
2927
}
3028

31-
fn zzz() { () }
29+
fn zzz() {
30+
()
31+
}

src/test/debuginfo/pretty-std-collections.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@
1515
// gdb-command: run
1616

1717
// gdb-command: print btree_set
18-
// gdb-check:$1 = BTreeSet<i32>(len: 15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
18+
// gdb-check:$1 = BTreeSet<i32, alloc::alloc::Global>(len: 15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}
1919

2020
// gdb-command: print empty_btree_set
21-
// gdb-check:$2 = BTreeSet<i32>(len: 0)
21+
// gdb-check:$2 = BTreeSet<i32, alloc::alloc::Global>(len: 0)
2222

2323
// gdb-command: print btree_map
24-
// gdb-check:$3 = BTreeMap<i32, i32>(len: 15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}
24+
// gdb-check:$3 = BTreeMap<i32, i32, alloc::alloc::Global>(len: 15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14}
2525

2626
// gdb-command: print empty_btree_map
27-
// gdb-check:$4 = BTreeMap<i32, u32>(len: 0)
27+
// gdb-check:$4 = BTreeMap<i32, u32, alloc::alloc::Global>(len: 0)
2828

2929
// gdb-command: print option_btree_map
30-
// gdb-check:$5 = BTreeMap<bool, core::option::Option<bool>>(len: 2) = {[false] = [...], [true] = [...]}
30+
// gdb-check:$5 = BTreeMap<bool, core::option::Option<bool>, alloc::alloc::Global>(len: 2) = {[false] = [...], [true] = [...]}
3131
// (abbreviated because both values vary wildly over gdb versions and/or linux distributions)
3232

3333
// gdb-command: print nasty_btree_map
34-
// gdb-check:$6 = BTreeMap<i32, pretty_std_collections::MyLeafNode>(len: 15) = {[0] = pretty_std_collections::MyLeafNode (0), [...]}
34+
// gdb-check:$6 = BTreeMap<i32, pretty_std_collections::MyLeafNode, alloc::alloc::Global>(len: 15) = {[0] = pretty_std_collections::MyLeafNode (0), [...]}
3535
// (abbreviated because it's boring but we need enough elements to include internal nodes)
3636

3737
// gdb-command: print vec_deque
38-
// gdb-check:$7 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7}
38+
// gdb-check:$7 = VecDeque<i32, alloc::alloc::Global>(len: 3, cap: 8) = {5, 3, 7}
3939

4040
// gdb-command: print vec_deque2
41-
// gdb-check:$8 = VecDeque<i32>(len: 7, cap: 8) = {2, 3, 4, 5, 6, 7, 8}
41+
// gdb-check:$8 = VecDeque<i32, alloc::alloc::Global>(len: 7, cap: 8) = {2, 3, 4, 5, 6, 7, 8}
4242

4343
#![allow(unused_variables)]
4444
use std::collections::BTreeMap;

src/test/debuginfo/pretty-uninitialized-vec.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@
1010
// gdb-command: run
1111

1212
// gdb-command: print vec
13-
// gdb-check:$1 = Vec<i32>(len: [...], cap: [...])[...]
14-
13+
// gdb-check:$1 = Vec<i32, alloc::alloc::Global>(len: [...], cap: [...])[...]
1514

1615
#![allow(unused_variables)]
1716

1817
fn main() {
19-
2018
let vec;
2119
zzz(); // #break
2220
vec = vec![0];
23-
2421
}
2522

26-
fn zzz() { () }
23+
fn zzz() {
24+
()
25+
}

src/test/rustdoc/inline_cross/impl_trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extern crate impl_trait_aux;
55

66
// @has impl_trait/fn.func.html
7-
// @has - '//pre[@class="rust fn"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
7+
// @has - '//pre[@class="rust fn"]' "pub fn func<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
88
// @!has - '//pre[@class="rust fn"]' 'where'
99
pub use impl_trait_aux::func;
1010

@@ -31,7 +31,7 @@ pub use impl_trait_aux::func4;
3131
pub use impl_trait_aux::async_fn;
3232

3333
// @has impl_trait/struct.Foo.html
34-
// @has - '//code[@id="method.v"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8>> + 'a)"
34+
// @has - '//code[@id="method.v"]' "pub fn method<'a>(_x: impl Clone + Into<Vec<u8, Global>> + 'a)"
3535
// @!has - '//code[@id="method.v"]' 'where'
3636
pub use impl_trait_aux::Foo;
3737

src/test/ui/associated-types/defaults-suitability.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ LL | type Ty = Vec<[u8]>;
131131
|
132132
::: $SRC_DIR/liballoc/vec.rs:LL:COL
133133
|
134-
LL | pub struct Vec<T> {
134+
LL | pub struct Vec<T, A: AllocRef = Global> {
135135
| - required by this bound in `std::vec::Vec`
136136
|
137137
= help: the trait `std::marker::Sized` is not implemented for `[u8]`

src/test/ui/bad/bad-const-type.stderr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ LL | static i: String = 10;
66
| |
77
| expected struct `std::string::String`, found integer
88
| help: try using a conversion method: `10.to_string()`
9+
|
10+
= note: expected struct `std::string::String`
11+
found type `{integer}`
912

1013
error: aborting due to previous error
1114

src/test/ui/bad/bad-sized.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
1717
|
1818
::: $SRC_DIR/liballoc/vec.rs:LL:COL
1919
|
20-
LL | pub struct Vec<T> {
20+
LL | pub struct Vec<T, A: AllocRef = Global> {
2121
| - required by this bound in `std::vec::Vec`
2222
|
2323
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`

src/test/ui/block-result/consider-removing-last-semi.stderr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ LL | fn f() -> String {
88
LL | 0u8;
99
LL | "bla".to_string();
1010
| - help: consider removing this semicolon
11+
|
12+
= note: expected struct `std::string::String`
13+
found unit type `()`
1114

1215
error[E0308]: mismatched types
1316
--> $DIR/consider-removing-last-semi.rs:6:11
@@ -19,6 +22,9 @@ LL | fn g() -> String {
1922
LL | "this won't work".to_string();
2023
LL | "removeme".to_string();
2124
| - help: consider removing this semicolon
25+
|
26+
= note: expected struct `std::string::String`
27+
found unit type `()`
2228

2329
error: aborting due to 2 previous errors
2430

0 commit comments

Comments
 (0)