Skip to content

Commit 25b1f1c

Browse files
authored
Rollup merge of rust-lang#103707 - jonathanCogan:master, r=m-ou-se
Replace libstd, libcore, liballoc terminology in docs Fixes rust-lang#103551. I changed line comments containing the outdated terms as well. It would be great if someone with more experience could weigh in on whether these changes introduce ambiguity as suggested in rust-lang#103551 (comment).
2 parents 80e309f + 78691e3 commit 25b1f1c

File tree

40 files changed

+84
-85
lines changed

40 files changed

+84
-85
lines changed

library/alloc/src/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern "Rust" {
2323
// These are the magic symbols to call the global allocator. rustc generates
2424
// them to call `__rg_alloc` etc. if there is a `#[global_allocator]` attribute
2525
// (the code expanding that attribute macro generates those functions), or to call
26-
// the default implementations in libstd (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
26+
// the default implementations in std (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
2727
// otherwise.
2828
// The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
2929
// like `malloc`, `realloc`, and `free`, respectively.

library/alloc/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This library provides smart pointers and collections for managing
44
//! heap-allocated values.
55
//!
6-
//! This library, like libcore, normally doesn’t need to be used directly
6+
//! This library, like core, normally doesn’t need to be used directly
77
//! since its contents are re-exported in the [`std` crate](../std/index.html).
88
//! Crates that use the `#![no_std]` attribute however will typically
99
//! not depend on `std`, so they’d use this crate instead.
@@ -75,7 +75,7 @@
7575
))]
7676
#![no_std]
7777
#![needs_allocator]
78-
// To run liballoc tests without x.py without ending up with two copies of liballoc, Miri needs to be
78+
// To run alloc tests without x.py without ending up with two copies of alloc, Miri needs to be
7979
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
8080
// rustc itself never sets the feature, so this line has no affect there.
8181
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]

library/alloc/src/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl [u8] {
653653
///
654654
/// ```error
655655
/// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica
656-
/// --> src/liballoc/slice.rs:608:6
656+
/// --> library/alloc/src/slice.rs:608:6
657657
/// |
658658
/// 608 | impl<T: Clone, V: Borrow<[T]>> Concat for [V] {
659659
/// | ^ unconstrained type parameter

library/alloc/src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,7 @@ impl From<&String> for String {
26782678
}
26792679
}
26802680

2681-
// note: test pulls in libstd, which causes errors here
2681+
// note: test pulls in std, which causes errors here
26822682
#[cfg(not(test))]
26832683
#[stable(feature = "string_from_box", since = "1.18.0")]
26842684
impl From<Box<str>> for String {

library/alloc/src/vec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3191,7 +3191,7 @@ where
31913191
}
31923192
}
31933193

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

3212-
// note: test pulls in libstd, which causes errors here
3212+
// note: test pulls in std, which causes errors here
32133213
#[cfg(not(no_global_oom_handling))]
32143214
#[cfg(not(test))]
32153215
#[stable(feature = "box_from_vec", since = "1.20.0")]

library/alloc/tests/autotraits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn test_btree_map() {
3232
// spawn(f());
3333
// }
3434
//
35-
// where with some unintentionally overconstrained Send impls in liballoc's
35+
// where with some unintentionally overconstrained Send impls in alloc's
3636
// internals, the future might incorrectly not be Send even though every
3737
// single type involved in the program is Send and Sync.
3838
require_send_sync(async {

library/core/src/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ impl<T: ?Sized> UnsafeCell<T> {
19941994
#[rustc_const_stable(feature = "const_unsafecell_get", since = "1.32.0")]
19951995
pub const fn get(&self) -> *mut T {
19961996
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
1997-
// #[repr(transparent)]. This exploits libstd's special status, there is
1997+
// #[repr(transparent)]. This exploits std's special status, there is
19981998
// no guarantee for user code that this will work in future versions of the compiler!
19991999
self as *const UnsafeCell<T> as *const T as *mut T
20002000
}
@@ -2052,7 +2052,7 @@ impl<T: ?Sized> UnsafeCell<T> {
20522052
#[rustc_const_stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
20532053
pub const fn raw_get(this: *const Self) -> *mut T {
20542054
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
2055-
// #[repr(transparent)]. This exploits libstd's special status, there is
2055+
// #[repr(transparent)]. This exploits std's special status, there is
20562056
// no guarantee for user code that this will work in future versions of the compiler!
20572057
this as *const T as *mut T
20582058
}

library/core/src/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl Display for Arguments<'_> {
558558
///
559559
/// Derived `Debug` formats are not stable, and so may change with future Rust
560560
/// versions. Additionally, `Debug` implementations of types provided by the
561-
/// standard library (`libstd`, `libcore`, `liballoc`, etc.) are not stable, and
561+
/// standard library (`std`, `core`, `alloc`, etc.) are not stable, and
562562
/// may also change with future Rust versions.
563563
///
564564
/// # Examples

library/core/src/lib.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@
3838
//! which do not trigger a panic can be assured that this function is never
3939
//! called. The `lang` attribute is called `eh_personality`.
4040
41-
// Since libcore defines many fundamental lang items, all tests live in a
42-
// separate crate, libcoretest, to avoid bizarre issues.
41+
// Since core defines many fundamental lang items, all tests live in a
42+
// separate crate, libcoretest (library/core/tests), to avoid bizarre issues.
4343
//
4444
// Here we explicitly #[cfg]-out this whole crate when testing. If we don't do
4545
// this, both the generated test artifact and the linked libtest (which
46-
// transitively includes libcore) will both define the same set of lang items,
46+
// transitively includes core) will both define the same set of lang items,
4747
// and this will cause the E0152 "found duplicate lang item" error. See
4848
// discussion in #50466 for details.
4949
//
5050
// This cfg won't affect doc tests.
5151
#![cfg(not(test))]
52-
// To run libcore tests without x.py without ending up with two copies of libcore, Miri needs to be
52+
// To run core tests without x.py without ending up with two copies of core, Miri needs to be
5353
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
5454
// rustc itself never sets the feature, so this line has no affect there.
5555
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
@@ -311,7 +311,7 @@ pub mod f64;
311311
#[macro_use]
312312
pub mod num;
313313

314-
/* The libcore prelude, not as all-encompassing as the libstd prelude */
314+
/* The core prelude, not as all-encompassing as the std prelude */
315315

316316
pub mod prelude;
317317

@@ -378,12 +378,12 @@ mod const_closure;
378378
#[stable(feature = "core_primitive", since = "1.43.0")]
379379
pub mod primitive;
380380

381-
// Pull in the `core_arch` crate directly into libcore. The contents of
381+
// Pull in the `core_arch` crate directly into core. The contents of
382382
// `core_arch` are in a different repository: rust-lang/stdarch.
383383
//
384-
// `core_arch` depends on libcore, but the contents of this module are
384+
// `core_arch` depends on core, but the contents of this module are
385385
// set up in such a way that directly pulling it here works such that the
386-
// crate uses the this crate as its libcore.
386+
// crate uses the this crate as its core.
387387
#[path = "../../stdarch/crates/core_arch/src/mod.rs"]
388388
#[allow(
389389
missing_docs,
@@ -402,12 +402,12 @@ mod core_arch;
402402
#[stable(feature = "simd_arch", since = "1.27.0")]
403403
pub mod arch;
404404

405-
// Pull in the `core_simd` crate directly into libcore. The contents of
405+
// Pull in the `core_simd` crate directly into core. The contents of
406406
// `core_simd` are in a different repository: rust-lang/portable-simd.
407407
//
408-
// `core_simd` depends on libcore, but the contents of this module are
408+
// `core_simd` depends on core, but the contents of this module are
409409
// set up in such a way that directly pulling it here works such that the
410-
// crate uses this crate as its libcore.
410+
// crate uses this crate as its core.
411411
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
412412
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
413413
#[allow(rustdoc::bare_urls)]

library/core/src/num/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl f32 {
428428
self != self
429429
}
430430

431-
// FIXME(#50145): `abs` is publicly unavailable in libcore due to
431+
// FIXME(#50145): `abs` is publicly unavailable in core due to
432432
// concerns about portability, so this implementation is for
433433
// private use internally.
434434
#[inline]

library/core/src/num/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl f64 {
427427
self != self
428428
}
429429

430-
// FIXME(#50145): `abs` is publicly unavailable in libcore due to
430+
// FIXME(#50145): `abs` is publicly unavailable in core due to
431431
// concerns about portability, so this implementation is for
432432
// private use internally.
433433
#[inline]

library/core/src/panic.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ pub macro unreachable_2021 {
9090
),
9191
}
9292

93-
/// An internal trait used by libstd to pass data from libstd to `panic_unwind`
94-
/// and other panic runtimes. Not intended to be stabilized any time soon, do
95-
/// not use.
93+
/// An internal trait used by std to pass data from std to `panic_unwind` and
94+
/// other panic runtimes. Not intended to be stabilized any time soon, do not
95+
/// use.
9696
#[unstable(feature = "std_internals", issue = "none")]
9797
#[doc(hidden)]
9898
pub unsafe trait BoxMeUp {
9999
/// Take full ownership of the contents.
100-
/// The return type is actually `Box<dyn Any + Send>`, but we cannot use `Box` in libcore.
100+
/// The return type is actually `Box<dyn Any + Send>`, but we cannot use `Box` in core.
101101
///
102102
/// After this method got called, only some dummy default value is left in `self`.
103103
/// Calling this method twice, or calling `get` after calling this method, is an error.

library/core/src/panic/panic_info.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl fmt::Display for PanicInfo<'_> {
157157
write!(formatter, "'{}', ", payload)?
158158
}
159159
// NOTE: we cannot use downcast_ref::<String>() here
160-
// since String is not available in libcore!
160+
// since String is not available in core!
161161
// The payload is a String when `std::panic!` is called with multiple arguments,
162162
// but in that case the message is also available.
163163

library/core/src/panicking.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//! Panic support for libcore
1+
//! Panic support for core
22
//!
33
//! The core library cannot define panicking, but it does *declare* panicking. This
4-
//! means that the functions inside of libcore are allowed to panic, but to be
5-
//! useful an upstream crate must define panicking for libcore to use. The current
4+
//! means that the functions inside of core are allowed to panic, but to be
5+
//! useful an upstream crate must define panicking for core to use. The current
66
//! interface for panicking is:
77
//!
88
//! ```
@@ -13,7 +13,7 @@
1313
//! This definition allows for panicking with any general message, but it does not
1414
//! allow for failing with a `Box<Any>` value. (`PanicInfo` just contains a `&(dyn Any + Send)`,
1515
//! for which we fill in a dummy value in `PanicInfo::internal_constructor`.)
16-
//! The reason for this is that libcore is not allowed to allocate.
16+
//! The reason for this is that core is not allowed to allocate.
1717
//!
1818
//! This module contains a few other panicking functions, but these are just the
1919
//! necessary lang items for the compiler. All panics are funneled through this
@@ -94,7 +94,7 @@ pub fn panic_nounwind(msg: &'static str) -> ! {
9494
// Next we define a bunch of higher-level wrappers that all bottom out in the two core functions
9595
// above.
9696

97-
/// The underlying implementation of libcore's `panic!` macro when no formatting is used.
97+
/// The underlying implementation of core's `panic!` macro when no formatting is used.
9898
// never inline unless panic_immediate_abort to avoid code
9999
// bloat at the call sites as much as possible
100100
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]

library/core/src/prelude/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//! The libcore prelude
1+
//! The core prelude
22
//!
3-
//! This module is intended for users of libcore which do not link to libstd as
4-
//! well. This module is imported by default when `#![no_std]` is used in the
5-
//! same manner as the standard library's prelude.
3+
//! This module is intended for users of core which do not link to std as well.
4+
//! This module is imported by default when `#![no_std]` is used in the same
5+
//! manner as the standard library's prelude.
66
77
#![stable(feature = "core_prelude", since = "1.4.0")]
88

library/core/src/slice/sort.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! This module contains a sorting algorithm based on Orson Peters' pattern-defeating quicksort,
44
//! published at: <https://github.com/orlp/pdqsort>
55
//!
6-
//! Unstable sorting is compatible with libcore because it doesn't allocate memory, unlike our
6+
//! Unstable sorting is compatible with core because it doesn't allocate memory, unlike our
77
//! stable sorting implementation.
88
99
use crate::cmp;

library/core/src/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl str {
368368
#[inline(always)]
369369
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
370370
// SAFETY: the cast from `&str` to `&[u8]` is safe since `str`
371-
// has the same layout as `&[u8]` (only libstd can make this guarantee).
371+
// has the same layout as `&[u8]` (only std can make this guarantee).
372372
// The pointer dereference is safe since it comes from a mutable reference which
373373
// is guaranteed to be valid for writes.
374374
unsafe { &mut *(self as *mut str as *mut [u8]) }

library/core/src/unicode/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod unicode_data;
1717
#[stable(feature = "unicode_version", since = "1.45.0")]
1818
pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION;
1919

20-
// For use in liballoc, not re-exported in libstd.
20+
// For use in alloc, not re-exported in std.
2121
pub use unicode_data::{
2222
case_ignorable::lookup as Case_Ignorable, cased::lookup as Cased, conversions,
2323
};

library/core/tests/ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ fn ptr_metadata_bounds() {
807807
}
808808
// "Synthetic" trait impls generated by the compiler like those of `Pointee`
809809
// are not checked for bounds of associated type.
810-
// So with a buggy libcore we could have both:
810+
// So with a buggy core we could have both:
811811
// * `<dyn Display as Pointee>::Metadata == DynMetadata`
812812
// * `DynMetadata: !PartialEq`
813813
// … and cause an ICE here:

library/core/tests/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// All `str` tests live in liballoc/tests
1+
// All `str` tests live in library/alloc/tests/str.rs

library/panic_abort/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
6161
//
6262
// https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail
6363
//
64-
// Note: this is the same implementation as in libstd's `abort_internal`
64+
// Note: this is the same implementation as in std's `abort_internal`
6565
unsafe fn abort() -> ! {
6666
#[allow(unused)]
6767
const FAST_FAIL_FATAL_APP_EXIT: usize = 7;
@@ -89,7 +89,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
8989
// This... is a bit of an oddity. The tl;dr; is that this is required to link
9090
// correctly, the longer explanation is below.
9191
//
92-
// Right now the binaries of libcore/libstd that we ship are all compiled with
92+
// Right now the binaries of core/std that we ship are all compiled with
9393
// `-C panic=unwind`. This is done to ensure that the binaries are maximally
9494
// compatible with as many situations as possible. The compiler, however,
9595
// requires a "personality function" for all functions compiled with `-C
@@ -109,7 +109,7 @@ pub unsafe fn __rust_start_panic(_payload: *mut &mut dyn BoxMeUp) -> u32 {
109109
// library just defines this symbol so there's at least some personality
110110
// somewhere.
111111
//
112-
// Essentially this symbol is just defined to get wired up to libcore/libstd
112+
// Essentially this symbol is just defined to get wired up to core/std
113113
// binaries, but it should never be called as we don't link in an unwinding
114114
// runtime at all.
115115
pub mod personalities {

library/panic_unwind/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ cfg_if::cfg_if! {
8282
}
8383

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

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

library/proc_macro/src/bridge/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl<I, O> Clone for Client<I, O> {
356356

357357
fn maybe_install_panic_hook(force_show_panics: bool) {
358358
// Hide the default panic output within `proc_macro` expansions.
359-
// NB. the server can't do this because it may use a different libstd.
359+
// NB. the server can't do this because it may use a different std.
360360
static HIDE_PANICS_DURING_EXPANSION: Once = Once::new();
361361
HIDE_PANICS_DURING_EXPANSION.call_once(|| {
362362
let prev = panic::take_hook();

library/proc_macro/src/bridge/fxhash.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ use std::ops::BitXor;
1515
/// Type alias for a hashmap using the `fx` hash algorithm.
1616
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
1717

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

library/proc_macro/src/bridge/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ macro_rules! define_dispatcher_impl {
112112
$name::$method(server, $($arg),*)
113113
};
114114
// HACK(eddyb) don't use `panic::catch_unwind` in a panic.
115-
// If client and server happen to use the same `libstd`,
115+
// If client and server happen to use the same `std`,
116116
// `catch_unwind` asserts that the panic counter was 0,
117117
// even when the closure passed to it didn't panic.
118118
let r = if thread::panicking() {

library/rustc-std-workspace-alloc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// See rustc-std-workspace-core for why this crate is needed.
55

6-
// Rename the crate to avoid conflicting with the alloc module in liballoc.
6+
// Rename the crate to avoid conflicting with the alloc module in alloc.
77
extern crate alloc as foo;
88

99
pub use foo::*;

library/std/src/backtrace.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
//!
2424
//! ## Platform support
2525
//!
26-
//! Not all platforms that libstd compiles for support capturing backtraces.
27-
//! Some platforms simply do nothing when capturing a backtrace. To check
28-
//! whether the platform supports capturing backtraces you can consult the
29-
//! `BacktraceStatus` enum as a result of `Backtrace::status`.
26+
//! Not all platforms that std compiles for support capturing backtraces. Some
27+
//! platforms simply do nothing when capturing a backtrace. To check whether the
28+
//! platform supports capturing backtraces you can consult the `BacktraceStatus`
29+
//! enum as a result of `Backtrace::status`.
3030
//!
3131
//! Like above with accuracy platform support is done on a best effort basis.
3232
//! Sometimes libraries might not be available at runtime or something may go

0 commit comments

Comments
 (0)