Skip to content

Conversation

@Urgau
Copy link
Member

@Urgau Urgau commented Aug 27, 2025

This PR disables the machine-applicable integer_to_ptr_transmutes lint suggestion for unsized types, as std::ptr::with_exposed_provenance requires sized types.

We should probably mention std::ptr::from_raw_parts when it becomes stable.

Fixes #145935

@rustbot
Copy link
Collaborator

rustbot commented Aug 27, 2025

r? @lcnr

rustbot has assigned @lcnr.
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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 27, 2025
@Urgau Urgau changed the title Disable int_to_ptr_transmutes suggestion for unsized types Disable integer_to_ptr_transmutes suggestion for unsized types Aug 27, 2025
@rust-log-analyzer

This comment has been minimized.

@Urgau Urgau force-pushed the int_to_ptr_transmutes-unsized branch from ea7dafe to a8c837e Compare August 27, 2025 18:39
@lcnr
Copy link
Contributor

lcnr commented Aug 28, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 28, 2025

📌 Commit a8c837e has been approved by lcnr

It is now in the queue for this repository.

@bors bors 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 Aug 28, 2025
bors added a commit that referenced this pull request Aug 28, 2025
Rollup of 9 pull requests

Successful merges:

 - #142727 (wasm: rm static mut)
 - #143193 (Port `#[link]` to the new attribute parsing infrastructure )
 - #144864 (No source fixes)
 - #145913 (Add spin_loop hint for LoongArch)
 - #145926 (compiletest: Remove several remnants of the old libtest-based executor)
 - #145928 (Rename `Location::file_with_nul` to `file_as_c_str`)
 - #145930 (`const`ify (the unstable) `str::as_str`)
 - #145941 (Disable `integer_to_ptr_transmutes` suggestion for unsized types)
 - #145953 (Update `icu_list` to 2.0)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 72727b1 into rust-lang:master Aug 28, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 28, 2025
rust-timer added a commit that referenced this pull request Aug 28, 2025
Rollup merge of #145941 - Urgau:int_to_ptr_transmutes-unsized, r=lcnr

Disable `integer_to_ptr_transmutes` suggestion for unsized types

This PR disables the machine-applicable `integer_to_ptr_transmutes` lint suggestion for unsized types, as [`std::ptr::with_exposed_provenance`](https://doc.rust-lang.org/std/ptr/fn.with_exposed_provenance.html) requires sized types.

We should probably mention [`std::ptr::from_raw_parts`](https://doc.rust-lang.org/std/ptr/fn.from_raw_parts.html) when it becomes stable.

Related to #145935
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

integer_to_ptr_transmutes turns transmute::<.. &str> into &*std::ptr::with_exposed_provenance::<str> causing error

5 participants