Skip to content

Commit

Permalink
Auto merge of rust-lang#106296 - matthiaskrgr:rollup-ukdbqwx, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#99244 (doc: clearer and more correct Iterator::scan)
 - rust-lang#103707 (Replace libstd, libcore, liballoc terminology in docs)
 - rust-lang#104182 (`IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` documentation.)
 - rust-lang#106273 (rustdoc: remove redundant CSS `.source .content { overflow: visible }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 30, 2022
2 parents 7c99186 + 3f9909a commit bbdca4c
Show file tree
Hide file tree
Showing 43 changed files with 104 additions and 95 deletions.
2 changes: 1 addition & 1 deletion library/alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extern "Rust" {
// These are the magic symbols to call the global allocator. rustc generates
// them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
// (the code expanding that attribute macro generates those functions), or to call
// the default implementations in libstd (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
// the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
// otherwise.
// The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
// like `malloc`, `realloc`, and `free`, respectively.
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! This library provides smart pointers and collections for managing
//! heap-allocated values.
//!
//! This library, like libcore, normally doesn’t need to be used directly
//! This library, like core, normally doesn’t need to be used directly
//! since its contents are re-exported in the [`std` crate](../std/index.html).
//! Crates that use the `#![no_std]` attribute however will typically
//! not depend on `std`, so they’d use this crate instead.
Expand Down Expand Up @@ -75,7 +75,7 @@
))]
#![no_std]
#![needs_allocator]
// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be
// To run alloc tests without x.py without ending up with two copies of alloc, 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))]
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ impl [u8] {
///
/// ```error
/// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
/// --> src/liballoc/slice.rs:608:6
/// --> library/alloc/src/slice.rs:608:6
/// |
/// 608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
/// | ^ unconstrained type parameter
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2678,7 +2678,7 @@ impl From<&String> for String {
}
}

// note: test pulls in libstd, which causes errors here
// note: test pulls in std, which causes errors here
#[cfg(not(test))]
#[stable(feature = "string_from_box", since = "1.18.0")]
impl From<Box<str>> for String {
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,7 @@ where
}
}

// note: test pulls in libstd, which causes errors here
// note: test pulls in std, which causes errors here
#[cfg(not(test))]
#[stable(feature = "vec_from_box", since = "1.18.0")]
impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
Expand All @@ -3209,7 +3209,7 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
}
}

// note: test pulls in libstd, which causes errors here
// note: test pulls in std, which causes errors here
#[cfg(not(no_global_oom_handling))]
#[cfg(not(test))]
#[stable(feature = "box_from_vec", since = "1.20.0")]
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/tests/autotraits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn test_btree_map() {
// spawn(f());
// }
//
// where with some unintentionally overconstrained Send impls in liballoc's
// where with some unintentionally overconstrained Send impls in alloc's
// internals, the future might incorrectly not be Send even though every
// single type involved in the program is Send and Sync.
require_send_sync(async {
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions library/core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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)
/// });
///
Expand Down
22 changes: 11 additions & 11 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand All @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/panic/panic_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions library/core/src/panicking.rs
Original file line number Diff line number Diff line change
@@ -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:
//!
//! ```
Expand All @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/prelude/mod.rs
Original file line number Diff line number Diff line change
@@ -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")]

Expand Down
2 changes: 1 addition & 1 deletion library/core/src/slice/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]) }
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/unicode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion library/core/tests/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ fn ptr_metadata_bounds() {
}
// "Synthetic" trait impls generated by the compiler like those of `Pointee`
// are not checked for bounds of associated type.
// So with a buggy libcore we could have both:
// So with a buggy core we could have both:
// * `<dyn Display as Pointee>::Metadata == DynMetadata`
// * `DynMetadata: !PartialEq`
// … and cause an ICE here:
Expand Down
2 changes: 1 addition & 1 deletion library/core/tests/str.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// All `str` tests live in liballoc/tests
// All `str` tests live in library/alloc/tests/str.rs
6 changes: 3 additions & 3 deletions library/panic_abort/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
//
// https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
//
// Note: this is the same implementation as in libstd's `abort_internal`
// Note: this is the same implementation as in std's `abort_internal`
unsafe fn abort() -> ! {
#[allow(unused)]
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
Expand Down Expand Up @@ -89,7 +89,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
// This... is a bit of an oddity. The tl;dr; is that this is required to link
// correctly, the longer explanation is below.
//
// Right now the binaries of libcore/libstd that we ship are all compiled with
// Right now the binaries of core/std that we ship are all compiled with
// `-C panic=unwind`. This is done to ensure that the binaries are maximally
// compatible with as many situations as possible. The compiler, however,
// requires a "personality function" for all functions compiled with `-C
Expand All @@ -109,7 +109,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
// library just defines this symbol so there's at least some personality
// somewhere.
//
// Essentially this symbol is just defined to get wired up to libcore/libstd
// Essentially this symbol is just defined to get wired up to core/std
// binaries, but it should never be called as we don't link in an unwinding
// runtime at all.
pub mod personalities {
Expand Down
4 changes: 2 additions & 2 deletions library/panic_unwind/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ cfg_if::cfg_if! {
}

extern "C" {
/// Handler in libstd called when a panic object is dropped outside of
/// Handler in std called when a panic object is dropped outside of
/// `catch_unwind`.
fn __rust_drop_panic() -> !;

/// Handler in libstd called when a foreign exception is caught.
/// Handler in std called when a foreign exception is caught.
fn __rust_foreign_exception() -> !;
}

Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/bridge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<I, O> Clone for Client<I, O> {

fn maybe_install_panic_hook(force_show_panics: bool) {
// Hide the default panic output within `proc_macro` expansions.
// NB. the server can't do this because it may use a different libstd.
// NB. the server can't do this because it may use a different std.
static HIDE_PANICS_DURING_EXPANSION: Once = Once::new();
HIDE_PANICS_DURING_EXPANSION.call_once(|| {
let prev = panic::take_hook();
Expand Down
6 changes: 3 additions & 3 deletions library/proc_macro/src/bridge/fxhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ use std::ops::BitXor;
/// Type alias for a hashmap using the `fx` hash algorithm.
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;

/// A speedy hash algorithm for use within rustc. The hashmap in liballoc
/// by default uses SipHash which isn't quite as speedy as we want. In the
/// compiler we're not really worried about DOS attempts, so we use a fast
/// A speedy hash algorithm for use within rustc. The hashmap in alloc by
/// default uses SipHash which isn't quite as speedy as we want. In the compiler
/// we're not really worried about DOS attempts, so we use a fast
/// non-cryptographic hash.
///
/// This is the same as the algorithm used by Firefox -- which is a homespun
Expand Down
Loading

0 comments on commit bbdca4c

Please sign in to comment.