Skip to content

Commit 42abbd8

Browse files
committed
Auto merge of #70884 - Dylan-DPC:rollup-r3raqdf, r=jonas-schievink
Rollup of 5 pull requests Successful merges: - #70201 (Small tweaks in ToOwned::clone_into) - #70762 (Miri leak check: memory reachable through globals is not leaked) - #70846 (Keep codegen units unmerged when building compiler builtins) - #70854 (Use assoc int submodules) - #70857 (Don't import integer and float modules, use assoc consts 2) Failed merges: r? @ghost
2 parents 39b6253 + 89d661f commit 42abbd8

File tree

39 files changed

+255
-156
lines changed

39 files changed

+255
-156
lines changed

src/liballoc/raw_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ unsafe impl<#[may_dangle] T, A: AllocRef> Drop for RawVec<T, A> {
608608

609609
#[inline]
610610
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
611-
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
611+
if mem::size_of::<usize>() < 8 && alloc_size > isize::MAX as usize {
612612
Err(CapacityOverflow)
613613
} else {
614614
Ok(())

src/liballoc/slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,14 +733,14 @@ impl<T: Clone> ToOwned for [T] {
733733
fn clone_into(&self, target: &mut Vec<T>) {
734734
// drop anything in target that will not be overwritten
735735
target.truncate(self.len());
736-
let len = target.len();
737-
738-
// reuse the contained values' allocations/resources.
739-
target.clone_from_slice(&self[..len]);
740736

741737
// target.len <= self.len due to the truncate above, so the
742-
// slice here is always in-bounds.
743-
target.extend_from_slice(&self[len..]);
738+
// slices here are always in-bounds.
739+
let (init, tail) = self.split_at(target.len());
740+
741+
// reuse the contained values' allocations/resources.
742+
target.clone_from_slice(init);
743+
target.extend_from_slice(tail);
744744
}
745745
}
746746

src/liballoc/tests/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn trait_object() {
5050

5151
#[test]
5252
fn float_nan_ne() {
53-
let x = Arc::new(std::f32::NAN);
53+
let x = Arc::new(f32::NAN);
5454
assert!(x != x);
5555
assert!(!(x == x));
5656
}

src/liballoc/tests/btree/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ fn test_range_large() {
475475

476476
#[test]
477477
fn test_range_inclusive_max_value() {
478-
let max = std::usize::MAX;
478+
let max = usize::MAX;
479479
let map: BTreeMap<_, _> = vec![(max, 0)].into_iter().collect();
480480

481481
assert_eq!(map.range(max..=max).collect::<Vec<_>>(), &[(&max, &0)]);

src/liballoc/tests/rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn trait_object() {
5050

5151
#[test]
5252
fn float_nan_ne() {
53-
let x = Rc::new(std::f32::NAN);
53+
let x = Rc::new(f32::NAN);
5454
assert!(x != x);
5555
assert!(!(x == x));
5656
}

src/libcore/benches/num/dec2flt/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::f64;
21
use test::Bencher;
32

43
#[bench]

src/libcore/benches/num/flt2dec/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod strategy {
55

66
use core::num::flt2dec::MAX_SIG_DIGITS;
77
use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded};
8-
use std::f64;
98
use std::io::Write;
109
use std::vec::Vec;
1110
use test::Bencher;

src/libcore/tests/iter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ fn test_cmp_by() {
7676
#[test]
7777
fn test_partial_cmp_by() {
7878
use core::cmp::Ordering;
79-
use core::f64;
8079

8180
let f = |x: i32, y: i32| (x * x).partial_cmp(&y);
8281
let xs = || [1, 2, 3, 4].iter().copied();
@@ -2894,7 +2893,7 @@ fn test_is_sorted() {
28942893
assert!(![1, 3, 2].iter().is_sorted());
28952894
assert!([0].iter().is_sorted());
28962895
assert!(std::iter::empty::<i32>().is_sorted());
2897-
assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted());
2896+
assert!(![0.0, 1.0, f32::NAN].iter().is_sorted());
28982897
assert!([-2, -1, 0, 3].iter().is_sorted());
28992898
assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));
29002899
assert!(!["c", "bb", "aaa"].iter().is_sorted());

0 commit comments

Comments
 (0)