Skip to content
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

Import the 2021 prelude in the core crate #123042

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion library/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ description = "The Rust Core Library"
autotests = false
autobenches = false
# If you update this, be sure to update it in a bunch of other places too!
# As of 2022, it was the ci/pgo.sh script and the core-no-fp-fmt-parse test.
# As of 2024, it was src/tools/opt-dist, the core-no-fp-fmt-parse test and
# the version of the prelude imported in core/lib.rs.
edition = "2021"

[lib]
Expand Down
1 change: 0 additions & 1 deletion library/core/src/array/equality.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::cmp::BytewiseEq;
use crate::convert::TryInto;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'd long been confused why these were needed in core.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, kudos to @workingjubilee as well for helping to figure this out on my other PR


#[stable(feature = "rust1", since = "1.0.0")]
impl<T, U, const N: usize> PartialEq<[U; N]> for [T; N]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use crate::borrow::{Borrow, BorrowMut};
use crate::cmp::Ordering;
use crate::convert::{Infallible, TryFrom};
use crate::convert::Infallible;
use crate::error::Error;
use crate::fmt;
use crate::hash::{self, Hash};
Expand Down
1 change: 0 additions & 1 deletion library/core/src/char/convert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Character conversions.

use crate::char::TryFromCharError;
use crate::convert::TryFrom;
use crate::error::Error;
use crate::fmt;
use crate::mem::transmute;
Expand Down
4 changes: 0 additions & 4 deletions library/core/src/convert/num.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::TryFrom;
use crate::num::TryFromIntError;

mod private {
Expand Down Expand Up @@ -323,7 +322,6 @@ impl_try_from_lower_bounded!(isize => usize);
#[cfg(target_pointer_width = "16")]
mod ptr_try_from_impls {
use super::TryFromIntError;
use crate::convert::TryFrom;

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

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

impl_try_from_upper_bounded!(usize => u8, u16, u32);
impl_try_from_unbounded!(usize => u64, u128);
Expand Down
1 change: 0 additions & 1 deletion library/core/src/iter/adapters/step_by.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::convert::TryFrom;
use crate::{
intrinsics,
iter::{from_fn, TrustedLen, TrustedRandomAccess},
Expand Down
1 change: 0 additions & 1 deletion library/core/src/iter/range.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::ascii::Char as AsciiChar;
use crate::convert::TryFrom;
use crate::mem;
use crate::net::{Ipv4Addr, Ipv6Addr};
use crate::num::NonZero;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use super::super::ByRefSized;
use super::super::TrustedRandomAccessNoCoerce;
use super::super::{ArrayChunks, Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, Fuse};
use super::super::{FlatMap, Flatten};
use super::super::{FromIterator, Intersperse, IntersperseWith, Product, Sum, Zip};
use super::super::{
Inspect, Map, MapWhile, MapWindows, Peekable, Rev, Scan, Skip, SkipWhile, StepBy, Take,
TakeWhile,
};
use super::super::{Intersperse, IntersperseWith, Product, Sum, Zip};

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

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ extern crate self as core;

#[prelude_import]
#[allow(unused)]
use prelude::v1::*;
use prelude::rust_2021::*;

#[cfg(not(test))] // See #65860
#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion library/core/src/net/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//! This module is "publicly exported" through the `FromStr` implementations
//! below.

use crate::convert::{TryFrom, TryInto};
use crate::error::Error;
use crate::fmt;
use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@

#![stable(feature = "rust1", since = "1.0.0")]

use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
use crate::iter::{self, FusedIterator, TrustedLen};
use crate::panicking::{panic, panic_str};
use crate::pin::Pin;
use crate::{
Expand Down
1 change: 0 additions & 1 deletion library/core/src/ptr/alignment.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::convert::{TryFrom, TryInto};
use crate::num::NonZero;
#[cfg(debug_assertions)]
use crate::ub_checks::assert_unsafe_precondition;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@

#![stable(feature = "rust1", since = "1.0.0")]

use crate::iter::{self, FromIterator, FusedIterator, TrustedLen};
use crate::iter::{self, FusedIterator, TrustedLen};
use crate::ops::{self, ControlFlow, Deref, DerefMut};
use crate::{convert, fmt, hint};

Expand Down
2 changes: 0 additions & 2 deletions library/core/src/unit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::iter::FromIterator;

/// Collapses all unit items from an iterator into one.
///
/// This is more useful when combined with higher-level abstractions, like
Expand Down
4 changes: 0 additions & 4 deletions library/portable-simd/crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
#![unstable(feature = "portable_simd", issue = "86656")]
//! Portable SIMD module.

#[prelude_import]
#[allow(unused_imports)]
use core::prelude::v1::*;

#[path = "mod.rs"]
mod core_simd;
pub use self::core_simd::simd;
1 change: 0 additions & 1 deletion library/portable-simd/crates/core_simd/src/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::simd::{
ptr::{SimdConstPtr, SimdMutPtr},
LaneCount, Mask, MaskElement, SupportedLaneCount, Swizzle,
};
use core::convert::{TryFrom, TryInto};

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