-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Logging fixes #8250
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
Logging fixes #8250
Conversation
…t formatting tests to be compatible with both the new and old runtimes
// Truncate the string | ||
let buf_bytes = 256; | ||
let msg = if msg.len() > buf_bytes { | ||
msg.slice(0, buf_bytes) + "[...]" |
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.
Doesn't this make a string of length 257 into one of length 261? (expected behaviour?)
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.
Looks like it. I don't think it's a problem though. The goal is only to avoid spewing endless garbage - it doesn't need to be precise.
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.
On further consideration though, this is probably only appropriate behavior for the console logger, so likely belongs somewhere else. In theory logging can go to arbitrary sinks. Can be fixed in the future. Logging is going to be completely overhauled eventually anyway.
Actually landing with #8257. |
Fix underflow in `manual_split_once` lint Hi, a friend found clippy started crashing on a suspiciously large allocation of `u64::MAX` memory on their code. The mostly minimized repro is: ```rust fn _f01(title: &str) -> Option<()> { let _ = title[1..].splitn(2, '[').next()?; Some(()) } ``` The underflow happens in this case on line 57 of the patch but I've changed the other substraction to saturating as well since it could potentially cause the same issue. I'm not sure where to put a regression test, or if it's even worth for such a thing. Aside, has it been considered before to build clippy with overflow checks enabled? changelog: fix ICE of underflow in `manual_split_once` lint
Updated from #8241