Fix invalid special casing of the unreachable! macro#93179
Merged
bors merged 2 commits intorust-lang:masterfrom Feb 7, 2022
Merged
Fix invalid special casing of the unreachable! macro#93179bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
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.
This pull-request fix an invalid special casing of the
unreachable!macro in the same way thepanic!macro was solved, by adding two new internal only macrosunreachable_2015andunreachable_2021edition dependent and turnunreachable!into a built-in macro that do dispatching. This logic is stolen from thepanic!macro.This pull-request also adds an internal featureformat_args_capture_non_literalthat allows capturing arguments from formatted string that expanded from macros. The original RFC #2795 mentioned this as a future possibility. This feature is required because of concatenation that needs to be done inside the macro:In summary the new behavior for the
unreachable!macro with this pr is:Edition 2021:
Edition <= 2018:
Also note that the change in this PR are insta-stable and breaking changes but this a considered as being a bug.
If someone could start a perf run and then a crater run this would be appreciated.
Fixes #92137