rust-lang / rust-lang/book

'static lifetime & trait objects

Open
#754 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Rust
Stars
18.3k
Forks
4.1k
Avg merge
14m
Merged PRs (30d)
1

Description

I bumped into some issues with using trait objects and I was informed by other nice Rust folks that I have to add 'static lifetime to my trait for this to work. I was quite puzzled since according the book 'static lifetime means "to exist throughout the lifetime of the program" but it does not say that it has different meaning when you associate it with traits. I think it would be very helpful if the book explained what 'static means to traits.

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

The issue names no file, test, or entry point. Locate the book’s existing discussion of 'static lifetimes and trait objects, then determine where an explanation should be added and verify that it clearly addresses the reported confusion.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.