rust-lang / rust-lang/reference

Clarify terminology around destructors and dropping

Open
#1,078 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-destructors Language Cleanup
Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

In #1037 a question came up about the exact wording around the introduction of the destructors chapter which says

When an initialized variable or temporary goes out of scope its destructor is run, or it is dropped.

The PR author interpreted the phrase dropped meaning a synonym for running the destructor. But I read it as two separate concepts:

  • When any value goes out of scope, it is "dropped".
  • If the value has a destructor, that destructor is run.

I don't think "dropping" and "running destructors" can be used interchangeably because not all values have a destructor. However, I am uncertain if that is correct, or if that is the best way to document these concepts. Either way, it would be good to clarify that a little.

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 wording in src/destructors.md, especially the introduction to the destructors chapter, and review the terminology discussion from #1037. Determine whether “dropping” and running a destructor are distinct concepts, then clarify the chapter text so the relationship is unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.