rust-lang / rust-lang/rust

Document what a "dangling pointer" is

Open
#132,286 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs E-hard E-help-wanted L-dangling_pointers_from_temporaries T-libs T-opsem
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Location

There are several places this applies, e.g.:

Summary

We have several place in the standard library or as part of lints where we use the term "dangling pointer" without defining it anywhere.

We should have a place where we define what that is, ideally in the standard library, in it's own section, maybe under std::ptr, so it can be referenced elsewhere.

It should probably have a definition, followed by some bad examples (and maybe how to fix them).

Wikipedia has article on the subject, I don't know if it could serve as a base for our documentation but it may be worth checking it.

Steps

  • Add std documentation
  • Update existing std docs
  • Update lints diagnostics

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.

Research direction

Start with the linked std::ptr::dangling and std::ptr::from_ref documentation, then inspect the dangling_pointers_from_temporaries lint. Define “dangling pointer” in a reusable standard-library section with bad examples and possible fixes, and update the existing std docs and lint diagnostics listed in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.