Skip to content

Commit 4c6ddc0

Browse files
committed
fix library and rustdoc tests
1 parent 147e850 commit 4c6ddc0

File tree

108 files changed

+839
-442
lines changed

Some content is hidden

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

108 files changed

+839
-442
lines changed

library/alloc/tests/const_fns.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// Test const functions in the library
22

33
pub const MY_VEC: Vec<usize> = Vec::new();
4-
pub const MY_VEC2: Vec<usize> = Default::default();
4+
5+
// FIXME(#110395)
6+
// pub const MY_VEC2: Vec<usize> = Default::default();
57

68
pub const MY_STRING: String = String::new();
7-
pub const MY_STRING2: String = Default::default();
89

9-
pub const MY_BOXED_SLICE: Box<[usize]> = Default::default();
10-
pub const MY_BOXED_STR: Box<str> = Default::default();
10+
// pub const MY_STRING2: String = Default::default();
11+
12+
// pub const MY_BOXED_SLICE: Box<[usize]> = Default::default();
13+
// pub const MY_BOXED_STR: Box<str> = Default::default();
1114

1215
use std::collections::{BTreeMap, BTreeSet};
1316

@@ -23,11 +26,11 @@ pub const SET_IS_EMPTY: bool = SET.is_empty();
2326

2427
#[test]
2528
fn test_const() {
26-
assert_eq!(MY_VEC, MY_VEC2);
27-
assert_eq!(MY_STRING, MY_STRING2);
29+
assert_eq!(MY_VEC, /* MY_VEC */ vec![]);
30+
assert_eq!(MY_STRING, /* MY_STRING2 */ String::default());
2831

29-
assert_eq!(MY_VEC, *MY_BOXED_SLICE);
30-
assert_eq!(MY_STRING, *MY_BOXED_STR);
32+
// assert_eq!(MY_VEC, *MY_BOXED_SLICE);
33+
// assert_eq!(MY_STRING, *MY_BOXED_STR);
3134

3235
assert_eq!(MAP_LEN, 0);
3336
assert_eq!(SET_LEN, 0);

library/alloc/tests/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(assert_matches)]
44
#![feature(btree_drain_filter)]
55
#![feature(cow_is_borrowed)]
6-
#![feature(const_convert)]
76
#![feature(const_cow_is_borrowed)]
87
#![feature(const_heap)]
98
#![feature(const_mut_refs)]
@@ -33,7 +32,6 @@
3332
#![feature(slice_partition_dedup)]
3433
#![feature(string_remove_matches)]
3534
#![feature(const_btree_len)]
36-
#![feature(const_default_impls)]
3735
#![feature(const_trait_impl)]
3836
#![feature(const_str_from_utf8)]
3937
#![feature(panic_update_hook)]

library/core/tests/atomic.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,11 @@ fn atomic_compare_exchange() {
306306
ATOMIC.compare_exchange_weak(0, 1, SeqCst, SeqCst).ok();
307307
}
308308

309+
/* FIXME(#110395)
309310
#[test]
310311
fn atomic_const_from() {
311312
const _ATOMIC_U8: AtomicU8 = AtomicU8::from(1);
312313
const _ATOMIC_BOOL: AtomicBool = AtomicBool::from(true);
313314
const _ATOMIC_PTR: AtomicPtr<u32> = AtomicPtr::from(core::ptr::null_mut());
314315
}
316+
*/

library/core/tests/bool.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn test_bool_to_option() {
8989
assert_eq!(false.then(|| 0), None);
9090
assert_eq!(true.then(|| 0), Some(0));
9191

92+
/* FIXME(#110395)
9293
const fn zero() -> i32 {
9394
0
9495
}
@@ -102,4 +103,5 @@ fn test_bool_to_option() {
102103
assert_eq!(B, Some(0));
103104
assert_eq!(C, None);
104105
assert_eq!(D, Some(0));
106+
*/
105107
}

library/core/tests/cell.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ fn const_cells() {
468468
const CELL: Cell<i32> = Cell::new(3);
469469
const _: i32 = CELL.into_inner();
470470

471+
/* FIXME(#110395)
471472
const UNSAFE_CELL_FROM: UnsafeCell<i32> = UnsafeCell::from(3);
472473
const _: i32 = UNSAFE_CELL.into_inner();
473474
@@ -476,4 +477,5 @@ fn const_cells() {
476477
477478
const CELL_FROM: Cell<i32> = Cell::from(3);
478479
const _: i32 = CELL.into_inner();
480+
*/
479481
}

library/core/tests/char.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fn test_convert() {
2121
assert!(char::try_from(0xFFFF_FFFF_u32).is_err());
2222
}
2323

24+
/* FIXME(#110395)
2425
#[test]
2526
const fn test_convert_const() {
2627
assert!(u32::from('a') == 0x61);
@@ -30,6 +31,7 @@ const fn test_convert_const() {
3031
assert!(char::from(b'a') == 'a');
3132
assert!(char::from(b'\xFF') == '\u{FF}');
3233
}
34+
*/
3335

3436
#[test]
3537
fn test_from_str() {

library/core/tests/cmp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ fn cmp_default() {
217217
assert_eq!(Fool(false), Fool(true));
218218
}
219219

220+
/* FIXME(#110395)
220221
mod const_cmp {
221222
use super::*;
222223
@@ -248,3 +249,4 @@ mod const_cmp {
248249
const _: () = assert!(S(0) < S(1));
249250
const _: () = assert!(S(1) > S(0));
250251
}
252+
*/

library/core/tests/convert.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* FIXME(#110395)
12
#[test]
23
fn convert() {
34
const fn from(x: i32) -> i32 {
@@ -14,3 +15,4 @@ fn convert() {
1415
const BAR: Vec<String> = into(Vec::new());
1516
assert_eq!(BAR, Vec::<String>::new());
1617
}
18+
*/

library/core/tests/hash/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ impl Hasher for MyHasher {
3535

3636
#[test]
3737
fn test_writer_hasher() {
38-
const fn hash<T: Hash>(t: &T) -> u64 {
38+
// FIXME(#110395)
39+
/* const */ fn hash<T: Hash>(t: &T) -> u64 {
3940
let mut s = MyHasher { hash: 0 };
4041
t.hash(&mut s);
4142
s.finish()
4243
}
4344

44-
const {
45+
/* const {
4546
// FIXME(fee1-dead): assert_eq
4647
assert!(hash(&()) == 0);
4748
assert!(hash(&5_u8) == 5);
@@ -52,7 +53,7 @@ fn test_writer_hasher() {
5253
5354
let s: &str = "a";
5455
assert!(hash(&s) == 97 + 0xFF);
55-
};
56+
}; */
5657

5758
assert_eq!(hash(&()), 0);
5859

@@ -139,15 +140,16 @@ impl Hash for Custom {
139140

140141
#[test]
141142
fn test_custom_state() {
142-
const fn hash<T: Hash>(t: &T) -> u64 {
143+
// FIXME(#110395)
144+
/* const */ fn hash<T: Hash>(t: &T) -> u64 {
143145
let mut c = CustomHasher { output: 0 };
144146
t.hash(&mut c);
145147
c.finish()
146148
}
147149

148150
assert_eq!(hash(&Custom { hash: 5 }), 5);
149151

150-
const { assert!(hash(&Custom { hash: 6 }) == 6) };
152+
// const { assert!(hash(&Custom { hash: 6 }) == 6) };
151153
}
152154

153155
// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten.

library/core/tests/hash/sip.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fn hash<T: Hash>(x: &T) -> u64 {
2323
hash_with(SipHasher::new(), x)
2424
}
2525

26+
/* FIXME(#110395)
2627
#[test]
2728
const fn test_const_sip() {
2829
let val1 = 0x45;
@@ -36,6 +37,7 @@ const fn test_const_sip() {
3637
3738
assert!(const_hash(&(val1)) != const_hash(&(val2)));
3839
}
40+
*/
3941

4042
#[test]
4143
#[allow(unused_must_use)]

0 commit comments

Comments
 (0)