Import the 2021 prelude in the core crate

This commit is contained in:
Daniel Paoliello 2024-03-25 11:02:02 -07:00
parent cb7c63606e
commit d261647c93
16 changed files with 7 additions and 23 deletions

View file

@ -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]

View file

@ -1,5 +1,4 @@
use crate::cmp::BytewiseEq;
use crate::convert::TryInto;
#[stable(feature = "rust1", since = "1.0.0")]
impl<T, U, const N: usize> PartialEq<[U; N]> for [T; N]

View file

@ -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};

View file

@ -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;

View file

@ -1,4 +1,3 @@
use super::TryFrom;
use crate::num::TryFromIntError;
mod private {
@ -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);
@ -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);
@ -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);

View file

@ -1,4 +1,3 @@
use crate::convert::TryFrom;
use crate::{
intrinsics,
iter::{from_fn, TrustedLen, TrustedRandomAccess},

View file

@ -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;

View file

@ -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 = ()>) {}

View file

@ -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]

View file

@ -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};

View file

@ -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::{

View file

@ -1,4 +1,3 @@
use crate::convert::{TryFrom, TryInto};
use crate::num::NonZero;
#[cfg(debug_assertions)]
use crate::ub_checks::assert_unsafe_precondition;

View file

@ -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};

View file

@ -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

View file

@ -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;

View file

@ -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`.
///