Skip to content

Update should_panic to use the attribute template #1882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 3, 2025

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Jun 30, 2025

New rules:

  • attributes.testing.should_panic.allowed-positions
  • attributes.testing.should_panic.duplicates
  • attributes.testing.should_panic.expected (split from syntax)
  • attributes.testing.should_panic.return (split from intro)

Removed rules:

  • attributes.testing.should_panic.behavior --- This is duplicated in the intro. I'm uncertain how I want to handle that. I kind of want to always have a behavior rule, but it feels weird to essentially repeat the exact same words.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jun 30, 2025
@traviscross traviscross added this pull request to the merge queue Jul 3, 2025
@traviscross traviscross removed this pull request from the merge queue due to a manual request Jul 3, 2025
The test functions within our code blocks will not actually be run in
any case, so let's mark these tests as `no_run`.

In the examples, let's demonstrate the behavior that the expected
string must be a substring of the panic message.

Let's also tighten up some wording.
We currently accept invalid syntax between the parentheses with
`should_panic(..)`.  Let's make a note of that.
@traviscross traviscross enabled auto-merge July 3, 2025 23:53
@traviscross traviscross added this pull request to the merge queue Jul 3, 2025
Merged via the queue into rust-lang:master with commit 38cecac Jul 3, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jul 3, 2025
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