simplify ast_fragments!#155919
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| | AstFragment::Params(_) | ||
| | AstFragment::FieldDefs(_) | ||
| | AstFragment::Variants(_) | ||
| | AstFragment::WherePredicates(_) => unreachable!(), |
There was a problem hiding this comment.
This is a small change in behavior: previously, if the contained SmallVecs were empty, using unreachable_to_string would not panic since there were no elements and it was never called. It now panics in all cases. Is this a problem? (I suppose not)
There was a problem hiding this comment.
Looks like this logic is only used in compiler\rustc_expand\src\stats.rs, and only for fragment in macro positions, so things like variants or where clauses should be safe.
Perhaps it would be better to move this function to stats.rs actually.
|
r? petrochenkov |
|
r=me after moving the fragment stringification to stats.rs, where its use should be limited to. |
|
Reminder, once the PR becomes ready for a review, use |
The syntax and meaning of this macro are not very intuitive as its just a large dump of function names and has some special cases.
Each commit should be a small improvement that can be evaluated on its own.