Skip to content

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

Merged
rustbot merged 1 commit into
rust-lang:masterfrom
Jarcho:no-leak
Sep 24, 2026
Merged

rustbot merged 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

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Lintcheck changes for 26ae304

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

@flip1995 flip1995 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@flip1995

Copy link
Copy Markdown
Member

@rustbot merge

@rustbot
rustbot added this pull request to the merge queue Sep 24, 2026
@flip1995

Copy link
Copy Markdown
Member

I will backport this to the current beta today. But I won't also sync it to master. Instead I will backport #17485 to beta in the next cycle.

Merged via the queue into rust-lang:master with commit bc6ac29 Sep 24, 2026
13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 24, 2026
@flip1995

Copy link
Copy Markdown
Member

rust-lang/rust#163264

@flip1995 flip1995 added beta-accepted Accepted for backporting to the compiler in the beta channel. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Sep 24, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Sep 25, 2026
[beta] Clippy backport

r? Mark-Simulacrum 

Backporting 3 PRs:

- rust-lang/rust-clippy#17632 fixes a UX issue where `--explain` stopped working in the current beta
- rust-lang/rust-clippy#17752 Fixes a bad suggestion that this lint is currently making on stable -- we'd rather fix this sooner than later
- rust-lang/rust-clippy#17731 Fixes an infinite loop
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Sep 26, 2026
[beta] Clippy backport

r? Mark-Simulacrum 

Backporting 3 PRs:

- rust-lang/rust-clippy#17632 fixes a UX issue where `--explain` stopped working in the current beta
- rust-lang/rust-clippy#17752 Fixes a bad suggestion that this lint is currently making on stable -- we'd rather fix this sooner than later
- rust-lang/rust-clippy#17731 Fixes an infinite loop
@flip1995

flip1995 commented Nov 5, 2026

Copy link
Copy Markdown
Member

rust-lang/rust#165499

rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 5, 2026
[beta] backports

Cherry picked:
* #165497
* #165499
  - rust-lang/rust-clippy#17752 (was already last beta, but we didn't manage to get the proper fixed merged in time like we planned)
  - rust-lang/rust-clippy#17828
  - rust-lang/rust-clippy#17941

r? @ghost
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 5, 2026
[beta] backports

Cherry picked:
* #165497
* #165499
  - rust-lang/rust-clippy#17752 (was already last beta, but we didn't manage to get the proper fixed merged in time like we planned)
  - rust-lang/rust-clippy#17828
  - rust-lang/rust-clippy#17941

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

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants