about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/cell.rs4
-rw-r--r--library/core/src/fmt/mod.rs2
-rw-r--r--library/core/src/iter/traits/iterator.rs17
-rw-r--r--library/core/src/lib.rs22
-rw-r--r--library/core/src/num/f32.rs2
-rw-r--r--library/core/src/num/f64.rs2
-rw-r--r--library/core/src/panic.rs8
-rw-r--r--library/core/src/panic/panic_info.rs2
-rw-r--r--library/core/src/panicking.rs10
-rw-r--r--library/core/src/prelude/mod.rs8
-rw-r--r--library/core/src/slice/sort.rs2
-rw-r--r--library/core/src/str/mod.rs2
-rw-r--r--library/core/src/unicode/mod.rs2
13 files changed, 44 insertions, 39 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index 77f1ffaacff..129213fde74 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -1994,7 +1994,7 @@ impl<T: ?Sized> UnsafeCell<T> {
     #[rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0")]
     pub const fn get(&self) -> *mut T {
         // We can just cast the pointer from `UnsafeCell<T>` to `T` because of
-        // #[repr(transparent)]. This exploits libstd's special status, there is
+        // #[repr(transparent)]. This exploits std's special status, there is
         // no guarantee for user code that this will work in future versions of the compiler!
         self as *const UnsafeCell<T> as *const T as *mut T
     }
@@ -2052,7 +2052,7 @@ impl<T: ?Sized> UnsafeCell<T> {
     #[rustc_const_stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
     pub const fn raw_get(this: *const Self) -> *mut T {
         // We can just cast the pointer from `UnsafeCell<T>` to `T` because of
-        // #[repr(transparent)]. This exploits libstd's special status, there is
+        // #[repr(transparent)]. This exploits std's special status, there is
         // no guarantee for user code that this will work in future versions of the compiler!
         this as *const T as *mut T
     }
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs
index 5f4a666de92..51e6a76cea8 100644
--- a/library/core/src/fmt/mod.rs
+++ b/library/core/src/fmt/mod.rs
@@ -558,7 +558,7 @@ impl Display for Arguments<'_> {
 ///
 /// Derived `Debug` formats are not stable, and so may change with future Rust
 /// versions. Additionally, `Debug` implementations of types provided by the
-/// standard library (`libstd`, `libcore`, `liballoc`, etc.) are not stable, and
+/// standard library (`std`, `core`, `alloc`, etc.) are not stable, and
 /// may also change with future Rust versions.
 ///
 /// # Examples
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index f9f24f68e38..fc4d4bff24f 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1381,8 +1381,8 @@ pub trait Iterator {
         Take::new(self, n)
     }
 
-    /// An iterator adapter similar to [`fold`] that holds internal state and
-    /// produces a new iterator.
+    /// An iterator adapter which, like [`fold`], holds internal state, but
+    /// unlike [`fold`], produces a new iterator.
     ///
     /// [`fold`]: Iterator::fold
     ///
@@ -1394,20 +1394,25 @@ pub trait Iterator {
     ///
     /// On iteration, the closure will be applied to each element of the
     /// iterator and the return value from the closure, an [`Option`], is
-    /// yielded by the iterator.
+    /// returned by the `next` method. Thus the closure can return
+    /// `Some(value)` to yield `value`, or `None` to end the iteration.
     ///
     /// # Examples
     ///
     /// Basic usage:
     ///
     /// ```
-    /// let a = [1, 2, 3];
+    /// let a = [1, 2, 3, 4];
     ///
     /// let mut iter = a.iter().scan(1, |state, &x| {
-    ///     // each iteration, we'll multiply the state by the element
+    ///     // each iteration, we'll multiply the state by the element ...
     ///     *state = *state * x;
     ///
-    ///     // then, we'll yield the negation of the state
+    ///     // ... and terminate if the state exceeds 6
+    ///     if *state > 6 {
+    ///         return None;
+    ///     }
+    ///     // ... else yield the negation of the state
     ///     Some(-*state)
     /// });
     ///
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index ab29f7bdeeb..890d7df8e17 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -38,18 +38,18 @@
 //!    which do not trigger a panic can be assured that this function is never
 //!    called. The `lang` attribute is called `eh_personality`.
 
-// Since libcore defines many fundamental lang items, all tests live in a
-// separate crate, libcoretest, to avoid bizarre issues.
+// Since core defines many fundamental lang items, all tests live in a
+// separate crate, libcoretest (library/core/tests), to avoid bizarre issues.
 //
 // Here we explicitly #[cfg]-out this whole crate when testing. If we don't do
 // this, both the generated test artifact and the linked libtest (which
-// transitively includes libcore) will both define the same set of lang items,
+// transitively includes core) will both define the same set of lang items,
 // and this will cause the E0152 "found duplicate lang item" error. See
 // discussion in #50466 for details.
 //
 // This cfg won't affect doc tests.
 #![cfg(not(test))]
-// To run libcore tests without x.py without ending up with two copies of libcore, Miri needs to be
+// To run core tests without x.py without ending up with two copies of core, Miri needs to be
 // able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
 // rustc itself never sets the feature, so this line has no affect there.
 #![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
@@ -311,7 +311,7 @@ pub mod f64;
 #[macro_use]
 pub mod num;
 
-/* The libcore prelude, not as all-encompassing as the libstd prelude */
+/* The core prelude, not as all-encompassing as the std prelude */
 
 pub mod prelude;
 
@@ -378,12 +378,12 @@ mod const_closure;
 #[stable(feature = "core_primitive", since = "1.43.0")]
 pub mod primitive;
 
-// Pull in the `core_arch` crate directly into libcore. The contents of
+// Pull in the `core_arch` crate directly into core. The contents of
 // `core_arch` are in a different repository: rust-lang/stdarch.
 //
-// `core_arch` depends on libcore, but the contents of this module are
+// `core_arch` depends on core, but the contents of this module are
 // set up in such a way that directly pulling it here works such that the
-// crate uses the this crate as its libcore.
+// crate uses the this crate as its core.
 #[path = "../../stdarch/crates/core_arch/src/mod.rs"]
 #[allow(
     missing_docs,
@@ -402,12 +402,12 @@ mod core_arch;
 #[stable(feature = "simd_arch", since = "1.27.0")]
 pub mod arch;
 
-// Pull in the `core_simd` crate directly into libcore. The contents of
+// Pull in the `core_simd` crate directly into core. The contents of
 // `core_simd` are in a different repository: rust-lang/portable-simd.
 //
-// `core_simd` depends on libcore, but the contents of this module are
+// `core_simd` depends on core, but the contents of this module are
 // set up in such a way that directly pulling it here works such that the
-// crate uses this crate as its libcore.
+// crate uses this crate as its core.
 #[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
 #[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
 #[allow(rustdoc::bare_urls)]
diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs
index 2c6a0ba64f2..1308b0770b8 100644
--- a/library/core/src/num/f32.rs
+++ b/library/core/src/num/f32.rs
@@ -428,7 +428,7 @@ impl f32 {
         self != self
     }
 
-    // FIXME(#50145): `abs` is publicly unavailable in libcore due to
+    // FIXME(#50145): `abs` is publicly unavailable in core due to
     // concerns about portability, so this implementation is for
     // private use internally.
     #[inline]
diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs
index fd3c18ce29b..2a22c4302b9 100644
--- a/library/core/src/num/f64.rs
+++ b/library/core/src/num/f64.rs
@@ -427,7 +427,7 @@ impl f64 {
         self != self
     }
 
-    // FIXME(#50145): `abs` is publicly unavailable in libcore due to
+    // FIXME(#50145): `abs` is publicly unavailable in core due to
     // concerns about portability, so this implementation is for
     // private use internally.
     #[inline]
diff --git a/library/core/src/panic.rs b/library/core/src/panic.rs
index 461b70c32f3..8338a5d7e5a 100644
--- a/library/core/src/panic.rs
+++ b/library/core/src/panic.rs
@@ -90,14 +90,14 @@ pub macro unreachable_2021 {
     ),
 }
 
-/// An internal trait used by libstd to pass data from libstd to `panic_unwind`
-/// and other panic runtimes. Not intended to be stabilized any time soon, do
-/// not use.
+/// An internal trait used by std to pass data from std to `panic_unwind` and
+/// other panic runtimes. Not intended to be stabilized any time soon, do not
+/// use.
 #[unstable(feature = "std_internals", issue = "none")]
 #[doc(hidden)]
 pub unsafe trait BoxMeUp {
     /// Take full ownership of the contents.
-    /// The return type is actually `Box<dyn Any + Send>`, but we cannot use `Box` in libcore.
+    /// The return type is actually `Box<dyn Any + Send>`, but we cannot use `Box` in core.
     ///
     /// After this method got called, only some dummy default value is left in `self`.
     /// Calling this method twice, or calling `get` after calling this method, is an error.
diff --git a/library/core/src/panic/panic_info.rs b/library/core/src/panic/panic_info.rs
index 1923155ebc1..0d385c9d187 100644
--- a/library/core/src/panic/panic_info.rs
+++ b/library/core/src/panic/panic_info.rs
@@ -157,7 +157,7 @@ impl fmt::Display for PanicInfo<'_> {
             write!(formatter, "'{}', ", payload)?
         }
         // NOTE: we cannot use downcast_ref::<String>() here
-        // since String is not available in libcore!
+        // since String is not available in core!
         // The payload is a String when `std::panic!` is called with multiple arguments,
         // but in that case the message is also available.
 
diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs
index 9fce78d076b..0146a3c2fbf 100644
--- a/library/core/src/panicking.rs
+++ b/library/core/src/panicking.rs
@@ -1,8 +1,8 @@
-//! Panic support for libcore
+//! Panic support for core
 //!
 //! The core library cannot define panicking, but it does *declare* panicking. This
-//! means that the functions inside of libcore are allowed to panic, but to be
-//! useful an upstream crate must define panicking for libcore to use. The current
+//! means that the functions inside of core are allowed to panic, but to be
+//! useful an upstream crate must define panicking for core to use. The current
 //! interface for panicking is:
 //!
 //! ```
@@ -13,7 +13,7 @@
 //! This definition allows for panicking with any general message, but it does not
 //! allow for failing with a `Box<Any>` value. (`PanicInfo` just contains a `&(dyn Any + Send)`,
 //! for which we fill in a dummy value in `PanicInfo::internal_constructor`.)
-//! The reason for this is that libcore is not allowed to allocate.
+//! The reason for this is that core is not allowed to allocate.
 //!
 //! This module contains a few other panicking functions, but these are just the
 //! necessary lang items for the compiler. All panics are funneled through this
@@ -94,7 +94,7 @@ pub fn panic_nounwind(msg: &'static str) -> ! {
 // Next we define a bunch of higher-level wrappers that all bottom out in the two core functions
 // above.
 
-/// The underlying implementation of libcore's `panic!` macro when no formatting is used.
+/// The underlying implementation of core's `panic!` macro when no formatting is used.
 // never inline unless panic_immediate_abort to avoid code
 // bloat at the call sites as much as possible
 #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs
index 3cd3a3b780e..12f762ef193 100644
--- a/library/core/src/prelude/mod.rs
+++ b/library/core/src/prelude/mod.rs
@@ -1,8 +1,8 @@
-//! The libcore prelude
+//! The core prelude
 //!
-//! This module is intended for users of libcore which do not link to libstd as
-//! well. This module is imported by default when `#![no_std]` is used in the
-//! same manner as the standard library's prelude.
+//! This module is intended for users of core which do not link to std as well.
+//! This module is imported by default when `#![no_std]` is used in the same
+//! manner as the standard library's prelude.
 
 #![stable(feature = "core_prelude", since = "1.4.0")]
 
diff --git a/library/core/src/slice/sort.rs b/library/core/src/slice/sort.rs
index 87f77b7f21d..b8c0c3fd949 100644
--- a/library/core/src/slice/sort.rs
+++ b/library/core/src/slice/sort.rs
@@ -3,7 +3,7 @@
 //! This module contains a sorting algorithm based on Orson Peters' pattern-defeating quicksort,
 //! published at: <https://github.com/orlp/pdqsort>
 //!
-//! Unstable sorting is compatible with libcore because it doesn't allocate memory, unlike our
+//! Unstable sorting is compatible with core because it doesn't allocate memory, unlike our
 //! stable sorting implementation.
 
 use crate::cmp;
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs
index 863ded5e5ec..ab2f8520ecb 100644
--- a/library/core/src/str/mod.rs
+++ b/library/core/src/str/mod.rs
@@ -368,7 +368,7 @@ impl str {
     #[inline(always)]
     pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
         // SAFETY: the cast from `&str` to `&[u8]` is safe since `str`
-        // has the same layout as `&[u8]` (only libstd can make this guarantee).
+        // has the same layout as `&[u8]` (only std can make this guarantee).
         // The pointer dereference is safe since it comes from a mutable reference which
         // is guaranteed to be valid for writes.
         unsafe { &mut *(self as *mut str as *mut [u8]) }
diff --git a/library/core/src/unicode/mod.rs b/library/core/src/unicode/mod.rs
index 72fa059b787..e1faa407d54 100644
--- a/library/core/src/unicode/mod.rs
+++ b/library/core/src/unicode/mod.rs
@@ -17,7 +17,7 @@ mod unicode_data;
 #[stable(feature = "unicode_version", since = "1.45.0")]
 pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION;
 
-// For use in liballoc, not re-exported in libstd.
+// For use in alloc, not re-exported in std.
 pub use unicode_data::{
     case_ignorable::lookup as Case_Ignorable, cased::lookup as Cased, conversions,
 };