Skip to content

Conversation

dianne
Copy link
Contributor

@dianne dianne commented Aug 26, 2025

This is present in the compiler here, but was not yet present in the Reference.

Based on #1979; the first commit is the commit from that PR.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 26, 2025
@rustbot

This comment has been minimized.

dianne and others added 5 commits September 4, 2025 07:27
In particular, let's note that the final expression of an async block
expression is not extending; we need to say that as we otherwise say
that the final expression of a block expression is extending, and
async blocks are ostensibly blocks in our ontology.

Let's build the pass tests with Rust 2024 to ensure that we're not
relying on the old edition tail expression rule.

When talking about an arm of an extending match expression, let's be
clear that we're talking about the arm expression.

Let's break apart all of the failure tests; otherwise we can't be sure
that they're all failing, and let's mark the expected error code for
each failure.

For each test, let's note the applicable rule for the outermost part
of the expression.

Let's add some tests to show that the operand of `break` is not
extending, as that might be a bit surprising.

Let's demonstrate explicitly that raw borrows count as borrows.
We document that the operands of an extending array expression are
extending expressions, but `rustc` doesn't treat the repeat operand
that way.  Let's add a note about that flagging it as an open question
and link to the relevant issue.
In our authoring guide, we describe how to control the edition for a
test.  This was written as though the only two editions were 2015 and
2018.  Let's update the wording to make this more general.
When writing tests for failure cases, we need to break up each case
into a separate code block so that each is tested properly.  Let's
describe this in our authoring guidelines.
@traviscross traviscross added this pull request to the merge queue Sep 4, 2025
Merged via the queue into rust-lang:master with commit 4984678 Sep 4, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Sep 4, 2025
@traviscross traviscross changed the title specify lifetime extension of match arms and if consequent/else block tail expressions Specify lifetime extension of match arms and if consequent/else block tail expressions Sep 4, 2025
@traviscross
Copy link
Contributor

Great. Thanks.

@dianne dianne deleted the extending-match branch September 4, 2025 10:43
jhpratt added a commit to jhpratt/rust that referenced this pull request Sep 8, 2025
Update books

## rust-lang/nomicon

1 commits in 57ed4473660565d9357fcae176b358d7e8724ebf..f17a018b9989430967d1c58e9a12c51169abc744
2025-09-05 22:46:58 UTC to 2025-09-05 22:46:58 UTC

- Add missing "C" ABI to FFI example code (rust-lang/nomicon#501)

## rust-lang/reference

7 commits in 89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769..b3ce60628c6f55ab8ff3dba9f3d20203df1c0dee
2025-09-05 20:14:36 UTC to 2025-08-26 20:17:24 UTC

- Ensure all lexical elements are SCREAMING_CASE (rust-lang/reference#1990)
- Link out to the notation from grammar summary (rust-lang/reference#1989)
- Or-patterns are extending (rust-lang/reference#1975)
- Specify lifetime extension of `match` arms and `if` consequent/`else` block tail expressions (rust-lang/reference#1981)
- clean up and properly test temporary lifetime extension in doctests (rust-lang/reference#1979)
- Update `cold` and `inline` to use the attribute template (rust-lang/reference#1907)
- Pluralize "syntax diagrams" (rust-lang/reference#1977)

## rust-lang/rust-by-example

1 commits in ad27f82c18464525c761a4a8db2e01785da59e1f..dd26bc8e726dc2e73534c8972d4dccd1bed7495f
2025-09-04 22:33:29 UTC to 2025-09-04 22:33:29 UTC

- Fix drop order explanation in trait > drop (rust-lang/rust-by-example#1953)
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 9, 2025
Update books

## rust-lang/nomicon

1 commits in 57ed4473660565d9357fcae176b358d7e8724ebf..f17a018b9989430967d1c58e9a12c51169abc744
2025-09-05 22:46:58 UTC to 2025-09-05 22:46:58 UTC

- Add missing "C" ABI to FFI example code (rust-lang/nomicon#501)

## rust-lang/reference

7 commits in 89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769..b3ce60628c6f55ab8ff3dba9f3d20203df1c0dee
2025-09-05 20:14:36 UTC to 2025-08-26 20:17:24 UTC

- Ensure all lexical elements are SCREAMING_CASE (rust-lang/reference#1990)
- Link out to the notation from grammar summary (rust-lang/reference#1989)
- Or-patterns are extending (rust-lang/reference#1975)
- Specify lifetime extension of `match` arms and `if` consequent/`else` block tail expressions (rust-lang/reference#1981)
- clean up and properly test temporary lifetime extension in doctests (rust-lang/reference#1979)
- Update `cold` and `inline` to use the attribute template (rust-lang/reference#1907)
- Pluralize "syntax diagrams" (rust-lang/reference#1977)

## rust-lang/rust-by-example

1 commits in ad27f82c18464525c761a4a8db2e01785da59e1f..dd26bc8e726dc2e73534c8972d4dccd1bed7495f
2025-09-04 22:33:29 UTC to 2025-09-04 22:33:29 UTC

- Fix drop order explanation in trait > drop (rust-lang/rust-by-example#1953)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 9, 2025
Update books

## rust-lang/nomicon

1 commits in 57ed4473660565d9357fcae176b358d7e8724ebf..f17a018b9989430967d1c58e9a12c51169abc744
2025-09-05 22:46:58 UTC to 2025-09-05 22:46:58 UTC

- Add missing "C" ABI to FFI example code (rust-lang/nomicon#501)

## rust-lang/reference

7 commits in 89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769..b3ce60628c6f55ab8ff3dba9f3d20203df1c0dee
2025-09-05 20:14:36 UTC to 2025-08-26 20:17:24 UTC

- Ensure all lexical elements are SCREAMING_CASE (rust-lang/reference#1990)
- Link out to the notation from grammar summary (rust-lang/reference#1989)
- Or-patterns are extending (rust-lang/reference#1975)
- Specify lifetime extension of `match` arms and `if` consequent/`else` block tail expressions (rust-lang/reference#1981)
- clean up and properly test temporary lifetime extension in doctests (rust-lang/reference#1979)
- Update `cold` and `inline` to use the attribute template (rust-lang/reference#1907)
- Pluralize "syntax diagrams" (rust-lang/reference#1977)

## rust-lang/rust-by-example

1 commits in ad27f82c18464525c761a4a8db2e01785da59e1f..dd26bc8e726dc2e73534c8972d4dccd1bed7495f
2025-09-04 22:33:29 UTC to 2025-09-04 22:33:29 UTC

- Fix drop order explanation in trait > drop (rust-lang/rust-by-example#1953)
rust-timer added a commit to rust-lang/rust that referenced this pull request Sep 9, 2025
Rollup merge of #146339 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/nomicon

1 commits in 57ed4473660565d9357fcae176b358d7e8724ebf..f17a018b9989430967d1c58e9a12c51169abc744
2025-09-05 22:46:58 UTC to 2025-09-05 22:46:58 UTC

- Add missing "C" ABI to FFI example code (rust-lang/nomicon#501)

## rust-lang/reference

7 commits in 89f67b3c1b904cbcd9ed55e443d6fc67c8ca2769..b3ce60628c6f55ab8ff3dba9f3d20203df1c0dee
2025-09-05 20:14:36 UTC to 2025-08-26 20:17:24 UTC

- Ensure all lexical elements are SCREAMING_CASE (rust-lang/reference#1990)
- Link out to the notation from grammar summary (rust-lang/reference#1989)
- Or-patterns are extending (rust-lang/reference#1975)
- Specify lifetime extension of `match` arms and `if` consequent/`else` block tail expressions (rust-lang/reference#1981)
- clean up and properly test temporary lifetime extension in doctests (rust-lang/reference#1979)
- Update `cold` and `inline` to use the attribute template (rust-lang/reference#1907)
- Pluralize "syntax diagrams" (rust-lang/reference#1977)

## rust-lang/rust-by-example

1 commits in ad27f82c18464525c761a4a8db2e01785da59e1f..dd26bc8e726dc2e73534c8972d4dccd1bed7495f
2025-09-04 22:33:29 UTC to 2025-09-04 22:33:29 UTC

- Fix drop order explanation in trait > drop (rust-lang/rust-by-example#1953)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants