Skip to content

Commit ac0a9c5

Browse files
Rollup merge of rust-lang#123042 - dpaoliello:prelude, r=Nilstrieb
Import the 2021 prelude in the core crate The `core` crate currently imports the v1 prelude https://github.com/rust-lang/rust/blob/b3df0d7e5ef5f7dbeeca3fb289c65680ad013f87/library/core/src/lib.rs#L285-L287 This recently caused an issue when updating the `portable-simd` subtree since it was using a trait that was added to the 2021 prelude: rust-lang#122905 (comment) To make it easier to have a consistent build environment for subtrees and submodules that get included in `core`, we will now import the 2021 prelude into `core`. Fixes rust-lang#122912 r? `@Nilstrieb`
2 parents 2b13f94 + d261647 commit ac0a9c5

File tree

16 files changed

+7
-23
lines changed

16 files changed

+7
-23
lines changed

Diff for: library/core/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ description = "The Rust Core Library"
77
autotests = false
88
autobenches = false
99
# If you update this, be sure to update it in a bunch of other places too!
10-
# As of 2022, it was the ci/pgo.sh script and the core-no-fp-fmt-parse test.
10+
# As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and
11+
# the version of the prelude imported in core/lib.rs.
1112
edition = "2021"
1213

1314
[lib]

Diff for: library/core/src/array/equality.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::cmp::BytewiseEq;
2-
use crate::convert::TryInto;
32

43
#[stable(feature = "rust1", since = "1.0.0")]
54
impl<T, U, const N: usize> PartialEq<[U; N]> for [T; N]

Diff for: library/core/src/array/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use crate::borrow::{Borrow, BorrowMut};
88
use crate::cmp::Ordering;
9-
use crate::convert::{Infallible, TryFrom};
9+
use crate::convert::Infallible;
1010
use crate::error::Error;
1111
use crate::fmt;
1212
use crate::hash::{self, Hash};

Diff for: library/core/src/char/convert.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Character conversions.
22
33
use crate::char::TryFromCharError;
4-
use crate::convert::TryFrom;
54
use crate::error::Error;
65
use crate::fmt;
76
use crate::mem::transmute;

Diff for: library/core/src/convert/num.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use super::TryFrom;
21
use crate::num::TryFromIntError;
32

43
mod private {
@@ -323,7 +322,6 @@ impl_try_from_lower_bounded!(isize => usize);
323322
#[cfg(target_pointer_width = "16")]
324323
mod ptr_try_from_impls {
325324
use super::TryFromIntError;
326-
use crate::convert::TryFrom;
327325

328326
impl_try_from_upper_bounded!(usize => u8);
329327
impl_try_from_unbounded!(usize => u16, u32, u64, u128);
@@ -346,7 +344,6 @@ mod ptr_try_from_impls {
346344
#[cfg(target_pointer_width = "32")]
347345
mod ptr_try_from_impls {
348346
use super::TryFromIntError;
349-
use crate::convert::TryFrom;
350347

351348
impl_try_from_upper_bounded!(usize => u8, u16);
352349
impl_try_from_unbounded!(usize => u32, u64, u128);
@@ -372,7 +369,6 @@ mod ptr_try_from_impls {
372369
#[cfg(target_pointer_width = "64")]
373370
mod ptr_try_from_impls {
374371
use super::TryFromIntError;
375-
use crate::convert::TryFrom;
376372

377373
impl_try_from_upper_bounded!(usize => u8, u16, u32);
378374
impl_try_from_unbounded!(usize => u64, u128);

Diff for: library/core/src/iter/adapters/step_by.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::convert::TryFrom;
21
use crate::{
32
intrinsics,
43
iter::{from_fn, TrustedLen, TrustedRandomAccess},

Diff for: library/core/src/iter/range.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::ascii::Char as AsciiChar;
2-
use crate::convert::TryFrom;
32
use crate::mem;
43
use crate::net::{Ipv4Addr, Ipv6Addr};
54
use crate::num::NonZero;

Diff for: library/core/src/iter/traits/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use super::super::ByRefSized;
88
use super::super::TrustedRandomAccessNoCoerce;
99
use super::super::{ArrayChunks, Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, Fuse};
1010
use super::super::{FlatMap, Flatten};
11-
use super::super::{FromIterator, Intersperse, IntersperseWith, Product, Sum, Zip};
1211
use super::super::{
1312
Inspect, Map, MapWhile, MapWindows, Peekable, Rev, Scan, Skip, SkipWhile, StepBy, Take,
1413
TakeWhile,
1514
};
15+
use super::super::{Intersperse, IntersperseWith, Product, Sum, Zip};
1616

1717
fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
1818

Diff for: library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ extern crate self as core;
286286

287287
#[prelude_import]
288288
#[allow(unused)]
289-
use prelude::v1::*;
289+
use prelude::rust_2021::*;
290290

291291
#[cfg(not(test))] // See #65860
292292
#[macro_use]

Diff for: library/core/src/net/parser.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//! This module is "publicly exported" through the `FromStr` implementations
44
//! below.
55
6-
use crate::convert::{TryFrom, TryInto};
76
use crate::error::Error;
87
use crate::fmt;
98
use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};

Diff for: library/core/src/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
554554
#![stable(feature = "rust1", since = "1.0.0")]
555555

556-
use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
556+
use crate::iter::{self, FusedIterator, TrustedLen};
557557
use crate::panicking::{panic, panic_str};
558558
use crate::pin::Pin;
559559
use crate::{

Diff for: library/core/src/ptr/alignment.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::convert::{TryFrom, TryInto};
21
use crate::num::NonZero;
32
#[cfg(debug_assertions)]
43
use crate::ub_checks::assert_unsafe_precondition;

Diff for: library/core/src/result.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@
488488
489489
#![stable(feature = "rust1", since = "1.0.0")]
490490

491-
use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
491+
use crate::iter::{self, FusedIterator, TrustedLen};
492492
use crate::ops::{self, ControlFlow, Deref, DerefMut};
493493
use crate::{convert, fmt, hint};
494494

Diff for: library/core/src/unit.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use crate::iter::FromIterator;
2-
31
/// Collapses all unit items from an iterator into one.
42
///
53
/// This is more useful when combined with higher-level abstractions, like

Diff for: library/portable-simd/crates/core_simd/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
#![unstable(feature = "portable_simd", issue = "86656")]
4646
//! Portable SIMD module.
4747
48-
#[prelude_import]
49-
#[allow(unused_imports)]
50-
use core::prelude::v1::*;
51-
5248
#[path = "mod.rs"]
5349
mod core_simd;
5450
pub use self::core_simd::simd;

Diff for: library/portable-simd/crates/core_simd/src/vector.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::simd::{
44
ptr::{SimdConstPtr, SimdMutPtr},
55
LaneCount, Mask, MaskElement, SupportedLaneCount, Swizzle,
66
};
7-
use core::convert::{TryFrom, TryInto};
87

98
/// A SIMD vector with the shape of `[T; N]` but the operations of `T`.
109
///

0 commit comments

Comments
 (0)