feat: add allow_deprecated option to stack_error - #52
Open
Frando wants to merge 2 commits into
Open
Conversation
Suppresses the deprecated lint in the generated impls, so enums can have #[deprecated] variants without the expansion triggering warnings at the #[stack_error(..)] call site.
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/n0-error/pr/52/docs/n0_error/ Last updated: 2026-07-14T10:38:44Z |
dignifiedquire
approved these changes
Jul 16, 2026
flub
reviewed
Jul 16, 2026
flub
left a comment
There was a problem hiding this comment.
When I've done this by hand I only apply the #[allow(deprecated)] on branch that is deprecated instead of the entire enum block. Is that worth doing here as well or is there no downside to allowing it on all branches?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
stack_errormacro expands to impls that match on and construct every enum variant, including deprecated ones. Under#[deny(deprecated)](or with the lint enabled), an enum with#[deprecated]variants therefore triggersdeprecatedwarnings/errors at the#[stack_error(..)]call site.This PR adds an
allow_deprecatedoption tostack_error(enums only) that wraps the generated impls in#[allow(deprecated)], so deprecated variants no longer trigger warnings in the expansion. The added test would fail to compile without the change.Breaking Changes
Notes & open questions
Change checklist