Skip to content

Decide the intended relationship between core::$module, alloc::$module, std::$module #434

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
dtolnay opened this issue Aug 29, 2024 · 2 comments

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 29, 2024

All of the following designs are in use for various standard library modules:

  1. core::$modulealloc::$modulestd::$module
  2. core::$modulealloc::$module = ∅, (core::$modulealloc::$module) ⊆ std::$module
  3. something else, intentionally
  4. something else, unintentionally

Is one of these a good design that should ideally be getting applied for all modules?

design 1 core::alloc alloc::alloc std::alloc
Allocator ☑️ ☑️ ☑️
GlobalAlloc ☑️ ☑️ ☑️
Layout ☑️ ☑️ ☑️
Global ☑️ ☑️
alloc ☑️ ☑️
System ☑️
set_alloc_error_hook ☑️
design 2 core::sync alloc::sync std::sync
atomic ☑️ ☑️
Arc ☑️ ☑️
Weak ☑️ ☑️
Mutex ☑️
mpsc ☑️
design 3 core::panic alloc::panic std::panic
Location ☑️ ☑️
UnwindSafe ☑️ ☑️
PanicInfo ☑️ deprecated
PanicMessage ☑️
PanicHookInfo ☑️
catch_unwind ☑️
design 4 core::ffi::c_str alloc::ffi::c_str std::ffi::c_str
CStr ☑️ ☑️
FromBytesUntilNulError ☑️ ☑️
FromBytesWithNulError ☑️ ☑️
Bytes (bug?) ☑️
CString ☑️ ☑️
FromVecWithNulError ☑️ ☑️
IntoStringError ☑️ ☑️
NulError ☑️ ☑️

Some other examples where an item in core::$module and/or alloc::$module does not appear in std::$module:

  • core::char::encode_utf8_raw
  • core::char::encode_utf16_raw
  • core::error::Source
  • core::ffi::va_list
  • core::iter::InPlaceIterable
  • core::iter::SourceIter
  • core::iter::TrustedFused
  • core::iter::TrustedRandomAccess
  • core::iter::TrustedRandomAccessNoCoerce
  • core::ops::Receiver
  • core::ptr::Thin
  • core::ptr::Unique
  • core::slice::memchr
  • core::slice::GetManyMutError
  • core::slice::SlicePattern
  • core::str::next_code_point
  • core::str::utf8_char_width
  • core::panicking
  • core::range
  • core::ub_checks
  • core::unicode
@taiki-e
Copy link
Member

taiki-e commented Aug 29, 2024

As for sync and iter modules, there was a discussion that both alloc::sync::atomic and alloc::iter look strange at rust-lang/rust#58175. (it is listed as a unresolved question in RFC2480)

@the8472
Copy link
Member

the8472 commented Aug 29, 2024

The listed core::iter types are internal ones, currently not meant for public use. They should already be doc(hidden)

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants