feat(plugins): deprecate #[panic_with] - #10096
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR SummaryLow Risk Overview Plugin tests that expect clean expansion add the feature attribute on annotated items. Diagnostic tests now also expect this deprecation signal alongside existing Reviewed by Cursor Bugbot for commit 26f0bf0. Bugbot is set up for automated code reviews on this repo. Configure here. |
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).
TomerStarkware
left a comment
There was a problem hiding this comment.
@TomerStarkware made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on orizi).
f4957f3 to
302f09c
Compare
ccf3121 to
063248d
Compare
302f09c to
e64c09f
Compare
063248d to
6cbbfb3
Compare
e64c09f to
9593fd5
Compare
6cbbfb3 to
0335928
Compare
Emit a warning when `#[panic_with]` is used, unless the item or an enclosing
module grants `#[feature("deprecated-panic-with")]`. Prefer explicit calculations,
which are now supported in const context.
The wrapper is still generated — this only warns. Relies on
`MacroPluginMetadata::allowed_features` being populated at the defs layer.
0335928 to
6e4bec5
Compare
9593fd5 to
26f0bf0
Compare

Summary
Deprecates the
#[panic_with]macro by emitting a warning diagnostic when it is used without an explicit#[feature("deprecated-panic-with")]opt-in attribute. The warning message directs users to use simple calculations instead, noting that these are supported in const context.Type of change
Please check one:
Why is this change needed?
The
#[panic_with]macro is being deprecated in favor of simple calculations, which are now supported in const context. Without a deprecation warning, users have no signal to migrate away from this macro.What was the behavior or documentation before?
Using
#[panic_with]produced no deprecation warning. The macro expanded silently regardless of whether the user acknowledged its deprecated status.What is the behavior or documentation after?
Using
#[panic_with]without#[feature("deprecated-panic-with")]on the same item now emits a warning:Users who need to continue using the macro can suppress the warning by adding
#[feature("deprecated-panic-with")]to the item.Related issue or discussion (if any)
Additional context
The feature gate string
"deprecated-panic-with"is stored with surrounding quotes becauseallowed_featuresholds raw string-literal text.