forked from dtolnay/quote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle negative literals a bit better
Looks like upstream in rust-lang/rust negative integers are represented as two tokens instead of one token (and it looks like proc_macro may erroneously (?) accept negative integers as literals, see rust-lang/rust#48889). As a result tweak the `ToTokens` impls for signed integers to maybe put a `-` token out in front. Similar treatment is applied to f32/f64 as well. Special treatment is required, however, for the `iNN::min_value()` constants. The actual integral portion isn't actually representable as a positive integer literal (as it'd overflow back to negative) so to handle this case everything is just represented as a u64 literal cast to the right type.
- Loading branch information
1 parent
3bdfd71
commit d0c4c52
Showing
2 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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