Skip to content

Implement Box::as_non_null().#157347

Open
theemathas wants to merge 2 commits into
rust-lang:mainfrom
theemathas:box-as-non-null
Open

Implement Box::as_non_null().#157347
theemathas wants to merge 2 commits into
rust-lang:mainfrom
theemathas:box-as-non-null

Conversation

@theemathas
Copy link
Copy Markdown
Contributor

ACP: rust-lang/libs-team#799
Tracking issue: #157345

The docs are mostly copied from Box::as_mut_ptr()

I also made a drive-by change to add #[must_use] to Box::as_{ptr, mut_ptr}.

I'm unsure what #[rustc_never_returns_null_ptr] and #[rustc_as_ptr] do. Should Box::as_non_null() be annotated with them?

r? libs-api

ACP: <rust-lang/libs-team#799>
Tracking issue: <rust-lang#157345>

The docs are mostly copied from `Box::as_mut_ptr()`
@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 Jun 3, 2026
@theemathas
Copy link
Copy Markdown
Contributor Author

#[rustc_as_ptr] is used by the dangling_pointers_from_temporaries lint. So, Box::as_non_null should have the attribute. See also 24e92dc (#157226).

I'm unsure about #[rustc_never_returns_null_ptr] though.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants