Skip to content

Don't suggest Box::leak in nonnull_unchecked_on_box_ptr - #17752

Open
Jarcho wants to merge 1 commit into
rust-lang:masterfrom
Jarcho:no-leak
Open

Jarcho wants to merge 1 commit into
rust-lang:masterfrom
Jarcho:no-leak

Conversation

@Jarcho

@Jarcho Jarcho commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Implements part of #17485

Unleaking a leaked Box pointer isn't well defined, so we shouldn't be suggesting to change into_raw into leak. This needs to be backported to beta and ideally would be synced before a new beta is branched off.

r? flip1995

changelog: [nonnull_unchecked_on_box_ptr]: Don't suggest Box::leak

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 17, 2026
@Jarcho Jarcho added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 17, 2026
@Jarcho

Jarcho commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

cc @RalfJung

@github-actions

Copy link
Copy Markdown

Lintcheck changes for 36f15da

Lint Added Removed Changed
clippy::nonnull_unchecked_on_box_ptr 0 1 0

This comment will be updated if you push new changes

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Community review: Change LGTM. There is a typo you missed though 😉

View changes since this review


#[clippy::msrv = "1.25"]
#[clippy::msrv = "1.98"]
fn msrv_1_25() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn msrv_1_25() {
fn msrv_1_98() {


#[clippy::msrv = "1.89"]
#[clippy::msrv = "1.99"]
fn msrv_1_89() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn msrv_1_89() {
fn msrv_1_99() {

@notriddle notriddle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Community review: this looks fine to me (except #17752 (comment))

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants