-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the codebase's use of char
s & put range asserts on char
s
#12086
Conversation
} | ||
bump(rdr); | ||
accum_int *= 16; | ||
accum_int += hex_digit_val(n); | ||
i -= 1u; | ||
} | ||
if i != 0 && is_eof(rdr) { | ||
fatal_span(rdr, start_bpos, rdr.last_pos.get(), | ||
~"unterminated numeric characer escape"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
LGTM, r=me after squash |
Avoid using -1 as a char sentinel, when Option<char> is the perfect thing.
The transmute was unsound. There are many instances of .unwrap_or('\x00') for "ignoring" EOF which either do not make the situation worse than it was (well, actually make it better, since it's easy to grep for places that don't handle EOF) or can never ever be read. Fixes rust-lang#8971.
A `char` is a Unicode codepoint, and so ranges from 0--0x10FFFF (with the surrogate gaps): we may as well inform LLVM of this.
Apparently loading them signed will break if/when they become i1.
The lexer and json were using `transmute(-1): char` as a sentinel value for EOF, which is invalid since `char` is strictly a unicode codepoint. Fixing this allows for range asserts on chars since they always lie between 0 and 0x10FFFF.
What’s a range assert and when is it used? Should it also exclude the 0xD800 to 0xDFFF range (surrogate code points), matching |
@SimonSapin A range assert tells LLVM that a Excluding the surrogate range is possible, but it seems unlikely that there will be much performance gained from just excluding an interior range, while telling LLVM that |
Perfect answer, thanks @huonw! |
infer from RPIT bounds of _this_ function Collect obligations from RPITs (Return Position `impl Trait`) of a function which is being inferred. This allows inferring {unknown}s from RPIT bounds. Closes rust-lang#8403
Update copyright year for Clippy (2024 edition) Our license was outdated by a year (+ change in the main README.md) changelog:none
The lexer and json were using
transmute(-1): char
as a sentinel value for EOF, which is invalid sincechar
is strictly a unicode codepoint.Fixing this allows for range asserts on chars since they always lie between 0 and 0x10FFFF.