rust-lang / rust-lang/rust

Use `rustc` attrs in `dangling_pointers_from_temporaries` lint

Open
#132,281 22 comments 0 reactions 1 assignee View on GitHub

@gavincrawford is already working on this.

Since Nov 1, 2024.

A-lints C-cleanup L-dangling_pointers_from_temporaries T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

If you want to do it in this PR (otherwise in a follow-up), we could add an rustc attribute to those as_ptr/as_mut_ptr methods.

You can follow https://github.com/rust-lang/rust/pull/132146/commits/afcb09b8c765bf2c5b1362b433725f57af51aaad and https://github.com/rust-lang/rust/pull/132146/commits/2a930d3818d1f4dcaf7a06ed7fc12c102268755d (from a PR of mine) with check_applied_to_fn_or_method instead, and something similar to this to check the attribute https://github.com/rust-lang/rust/blob/e454c45f1397e382cfb59f0b8970445c8efa875f/compiler/rustc_lint/src/ptr_nulls.rs#L49-L50

Originally posted by @Urgau in https://github.com/rust-lang/rust/pull/128985#discussion_r1818068264

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.