add lifetime extension tests for tuple struct temporaries by tshepang · Pull Request #2033 · rust-lang/reference

@tshepang

@tshepang tshepang marked this pull request as ready for review

October 4, 2025 18:11

@traviscross

The example for the tuple enum variant constructor should go above the
example that already uses a tuple enum variant constructor in a nested
manner.  This also matches the order in the list of extending
expressions above -- the list items for tuple struct constructors and
tuple enum variant constructors come after tuple expressions and
before block expressions.

For demonstrating a tuple enum variant constructor, it's better to use
`Some(_)` than to define one; `Option<T>` is well known enough.

For the tuple struct that we need to define, let's use a short name
like `W<T>` here rather than `TupleStruct<T>` (and show its
definition).  When I see a name like `TupleStruct`, it takes me a
moment to confirm it's just a name and not more than that.  We use
this `W<T>(T)` "wrapper" tuple struct definition elsewhere in the
Reference.

As a wording matter, we say "argument to" rather than "argument of".

Similarly, something isn't an argument to a tuple struct but an
argument to the tuple struct constructor, so let's say that.

traviscross

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Oct 7, 2025
Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Oct 7, 2025
Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)

rust-timer added a commit to rust-lang/rust that referenced this pull request

Oct 7, 2025
Rollup merge of #147407 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Oct 8, 2025
Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request

Oct 18, 2025
Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)