-
Notifications
You must be signed in to change notification settings - Fork 13.3k
use uX::from instead of _ as uX in non - const contexts #140435
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
base: master
Are you sure you want to change the base?
use uX::from instead of _ as uX in non - const contexts #140435
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
func, | ||
snippet, | ||
span, | ||
self.tcx.is_const_fn(def_id) |
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.
I don't believe this heuristic is complete. This leaves out const items and statics, for example.
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.
could you add some tests for statics, consts, and in const blocks?
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.
im not sure the heuristic is complete, but i added those tests and changed it a little.
compiler/rustc_mir_transform/src/check_unnecessary_transmutes.rs
Outdated
Show resolved
Hide resolved
4050a31
to
5f5d1c6
Compare
5f5d1c6
to
17737d6
Compare
changes
transmute(bool) -> integer
tointeger::from
as opposed tobool as integer
.#136083 (comment)
@rustbot label L-unnecessary_transmutes