Skip to content

Add overview documentation for std::mem.#153793

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
kpreid:std-mem-doc
Mar 16, 2026
Merged

Add overview documentation for std::mem.#153793
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
kpreid:std-mem-doc

Conversation

@kpreid
Copy link
Contributor

@kpreid kpreid commented Mar 12, 2026

I heard that std::mem sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include Discriminant as well as discriminant. I’m also not particularly happy with the wording of the introductory paragraph.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 12, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, scottmcm

Copy link
Member

@scottmcm scottmcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request, but this is already a big improvement. mem::take is really useful for a whole bunch of beginner things (like "get a string out of this slice") so pointing to it as normal and "everday" is great.

r? scottmcm

View changes since this review

I heard that `std::mem` sounds scary to some people, and how it’s
described — “Basic functions for dealing with memory” — sounds even to
me like something that should be avoided, not even because it would be
unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in
the module, without having to read all the individual item descriptions.
@scottmcm
Copy link
Member

Thanks! With mem having a whole bunch of stuff in it, this overview will hopefully be helpful to people.

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 15, 2026

📌 Commit b1b87ff has been approved by scottmcm

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 15, 2026
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 15, 2026
Add overview documentation for `std::mem`.

I heard that `std::mem` sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include `Discriminant` as well as `discriminant`. I’m also not particularly happy with the wording of the introductory paragraph.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 15, 2026
Add overview documentation for `std::mem`.

I heard that `std::mem` sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include `Discriminant` as well as `discriminant`. I’m also not particularly happy with the wording of the introductory paragraph.
rust-bors bot pushed a commit that referenced this pull request Mar 15, 2026
Rollup of 6 pull requests

Successful merges:

 - #153639 (Remove `QueryInfo`.)
 - #153570 (MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs)
 - #153793 (Add overview documentation for `std::mem`.)
 - #153884 (test `classify-runtime-const` for `f16`)
 - #153922 (rustc_mir_build only depends on rustc_lint_defs, not rustc_lint)
 - #153928 (remove several redundant tests)
Zalathar added a commit to Zalathar/rust that referenced this pull request Mar 16, 2026
Add overview documentation for `std::mem`.

I heard that `std::mem` sounds scary to some people, and how it’s described — “Basic functions for dealing with memory” — sounds even to me like something that should be avoided, not even because it would be unsafe, but because it is too low-level.

Let’s fix that by telling people about what they can actually find in the module, without having to read all the individual item descriptions.

The exact contents of the list are, of course, highly debatable, and I chose not to include any of the unstable or deprecated items, nor to include `Discriminant` as well as `discriminant`. I’m also not particularly happy with the wording of the introductory paragraph.
rust-bors bot pushed a commit that referenced this pull request Mar 16, 2026
Rollup of 7 pull requests

Successful merges:

 - #153639 (Remove `QueryInfo`.)
 - #153570 (MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs)
 - #153793 (Add overview documentation for `std::mem`.)
 - #153922 (rustc_mir_build only depends on rustc_lint_defs, not rustc_lint)
 - #153923 (run_make_support: Print the command and output even if it succeeds)
 - #153925 (Provide better suggestions for inference errors on `.collect()?`)
 - #153928 (remove several redundant tests)
rust-bors bot pushed a commit that referenced this pull request Mar 16, 2026
Rollup of 8 pull requests

Successful merges:

 - #153639 (Remove `QueryInfo`.)
 - #153570 (MaybeUninit: mention common mistakes in assume_init docs; link to validity invariant docs)
 - #153724 (Show named lifetime in closure upvar diagnostics)
 - #153793 (Add overview documentation for `std::mem`.)
 - #153922 (rustc_mir_build only depends on rustc_lint_defs, not rustc_lint)
 - #153923 (run_make_support: Print the command and output even if it succeeds)
 - #153925 (Provide better suggestions for inference errors on `.collect()?`)
 - #153928 (remove several redundant tests)
@rust-bors rust-bors bot merged commit eb101bb into rust-lang:main Mar 16, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 16, 2026
@kpreid kpreid deleted the std-mem-doc branch March 16, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants