Closed
Description
This issue tracks the release notes text for #134424.
Steps
- Proposed text is drafted by PR author (or team) making the noteworthy change.Issue is nominated for release team review of clarity for wider audience.Release team includes text in release notes/blog posts.
Release notes text
The responsible team for the underlying change should edit this section to replace the automatically generated link with a succinct description of what changed, drawing upon text proposed by the author (either in discussion or through direct editing).
# Compiler
- [Debug-assert that raw pointers are non-null on access.](https://github.com/rust-lang/rust/pull/134424)
Tip
Use the previous releases categories to help choose which one(s) to use.
The category will be de-duplicated with all the other ones by the release team.
More than one section can be included if needed.
Release blog section
If the change is notable enough for inclusion in the blog post, the responsible team should add content to this section.
Otherwise leave it empty.
cc @1c3t3a, @saethlin -- origin issue/PR authors and assignees for starting to draft text
Metadata
Metadata
Assignees
Labels
Relevant to the compiler team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.Relevant to the opsem teamMarks issues that should be documented in the release notes of the next release.Marks issues tracking what text to put in release notes.
Type
Projects
Relationships
Development
No branches or pull requests
Activity
saethlin commentedon Feb 1, 2025
I don't think there is a terse and accurate way to describe the new checks. The existing release notes are probably fine? But I think this merits a better description, probably a small section in the blog post:
The MIR pass called
CheckNull
will now insert checks that a pointer is not null upon non-zero-sized reads and writes through the pointer are done, and also when the pointer is reborrowed into a reference. For example, the following code will now produce a non-unwinding panic:Trivial examples like this have produced a warning since Rust 1.53.0, the new runtime check will detect these scenarios regardless of complexity.
Mark-Simulacrum commentedon Feb 1, 2025
A few questions:
.read()
,.read_unaligned()
)?I rephrased the relnotes text as "Debug-assert that raw pointers are non-null on access" which is a bit more succinct and I think accurate?
saethlin commentedon Feb 1, 2025
Yes, reads and writes. Edited.
No, those functions do not have any new checks, and in fact have no checks at all because their MIR is from the precompiled std. In addition,
assert_unsafe_precondition
is also off in ptr::read and ptr:::write specifically because in them the checks impose measurable compile time overhead because of how widely they are used in the standard library.