Skip to content

Conversation

@scottmcm
Copy link
Member

@scottmcm scottmcm commented Nov 30, 2025

#148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves #149025 by letting them move to this syntax instead.

New tracking issue: #149488
Related RFC: rust-lang/rfcs#3721 (comment) (specifically about experimenting)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 30, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 30, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Nov 30, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Nov 30, 2025

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@rustbot rustbot added the T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. label Nov 30, 2025

#[derive(Copy, Clone, Debug)]
enum TryBlockScope {
/// There isn't a `try` block, so the scope is the function or closure or ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a few reads to understand this comment. Can it be rephrased? What other possibilities are there?

/// A try block (`try { ... }`).
TryBlock(Box<Block>),
/// A try block (`try { ... }`), if the type is `None`, or
/// A try block (`try bikeshed Ty { ... }`) if the type is `Some`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nowhere in the PR is an explanation that bikeshed is deliberately ridiculous placeholder syntax. (I assume that's what it is.) Probably worth mentioning at least once. This might be a good spot for it.

@nnethercote
Copy link
Contributor

Standard plumbing, mostly, seems fine.

r=me with the nits addressed.

@nnethercote nnethercote added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 9, 2025
148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves 149025 by letting them move to this syntax instead.
@rustbot
Copy link
Collaborator

rustbot commented Dec 10, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@scottmcm
Copy link
Member Author

@bors r=nnethercote

@bors
Copy link
Collaborator

bors commented Dec 10, 2025

📌 Commit 35598c1 has been approved by nnethercote

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 10, 2025
/// We're inside a `try { … }` block, so a `?` will block-break
/// from that block using a type depending only on the argument.
Homogeneous(HirId),
/// We're inside a `try as _ { … }` block, so a `?` will block-break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// We're inside a `try as _ { … }` block, so a `?` will block-break
/// We're inside a `try bikeshed _ { … }` block, so a `?` will block-break

Comment on lines +1051 to +1052
ExprKind::TryBlock(body, optional_type) =>
visit_visitable!($($mut)? vis, body, optional_type),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ExprKind::TryBlock(body, optional_type) =>
visit_visitable!($($mut)? vis, body, optional_type),
ExprKind::TryBlock(body, opt_ty) =>
visit_visitable!($($mut)? vis, body, opt_ty),

(For simpler searching, since other places use opt_ty.)

bors added a commit that referenced this pull request Dec 10, 2025
Rollup of 7 pull requests

Successful merges:

 - #148052 (Stabilize `const_mul_add`)
 - #149386 (Display funding link in the github overview)
 - #149489 (Experimentally add *heterogeneous* `try` blocks)
 - #149764 (Make `--print=backend-has-zstd` work by default on any backend)
 - #149838 (Build auxiliary in pretty tests)
 - #149839 (Use `PointeeSized` bound for `TrivialClone` impls)
 - #149846 (Statically require links to an issue or the edition guide for all FCWs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 10, 2025
Rollup of 7 pull requests

Successful merges:

 - #148052 (Stabilize `const_mul_add`)
 - #149386 (Display funding link in the github overview)
 - #149489 (Experimentally add *heterogeneous* `try` blocks)
 - #149764 (Make `--print=backend-has-zstd` work by default on any backend)
 - #149838 (Build auxiliary in pretty tests)
 - #149839 (Use `PointeeSized` bound for `TrivialClone` impls)
 - #149846 (Statically require links to an issue or the edition guide for all FCWs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 02a58a9 into rust-lang:main Dec 10, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 10, 2025
rust-timer added a commit that referenced this pull request Dec 10, 2025
Rollup merge of #149489 - scottmcm:try-bikeshed, r=nnethercote

Experimentally add *heterogeneous* `try` blocks

#148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves #149025 by letting them move to this syntax instead.

New tracking issue: #149488
Related RFC: rust-lang/rfcs#3721 (comment) (specifically about experimenting)
flip1995 pushed a commit to flip1995/rust that referenced this pull request Dec 11, 2025
Experimentally add *heterogeneous* `try` blocks

rust-lang#148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves rust-lang#149025 by letting them move to this syntax instead.

New tracking issue: rust-lang#149488
Related RFC: rust-lang/rfcs#3721 (comment) (specifically about experimenting)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible try blocks regression in nightly

6 participants