Tracking Issue for strict_provenance_lints
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Original split-lint description for posterity
This tracks the two lints associated with the strict provenance feature:
- fuzzy_provenance_casts: detects an
ascast from an integer to a pointer. It is better to usewith_exposed_provenanceinstead to make explicit what happens. - lossy_provenance_casts: detects an
ascast from a pointer to an integer. It is better to useexpose_provenanceinstead to make explicit what happens.
I am not sure if having two lints here is really justified, IMO they could be merged into one -- not sure what that one should be called, though. Other than that, this seems like a useful lint to ensure the codebase follows strict provenance (or opts-out explicitly, via the methods mentioned above).
This tracks one lint, implicit_provenance_casts, which forbids as casts from integers to pointers and vice/versa.
I am also not sure if this shouldn't maybe be a clippy lint instead of a rustc lint?
Open questions:
- What replacement should be auto-suggested? Currently the lint suggests to replace
as usizeby.addr()which seems dangerous as it will introduce UB if the integer is cast back to a pointer.
Cc @rust-lang/opsem
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's description of the implicit_provenance_casts lint and its relationship to strict provenance. Resolve whether this belongs in rustc or Clippy and what safe replacement should be suggested instead of .addr(); done means those design questions and the lint scope have been settled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100