-
-
Notifications
You must be signed in to change notification settings - Fork 0
support loop_match on integers
#1
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
support loop_match on integers
#1
Conversation
f9f52c8 to
264d16b
Compare
264d16b to
d2c139e
Compare
| // apply the sign | ||
| let raw = pu.get() as i128; | ||
| let signed = if *neg { -raw } else { raw }; | ||
| scope.match_arms.target_for_value(recast as u128) |
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 think you have to truncate it after casting back to u128: https://github.com/rust-lang/rust/blob/57a4736e9f4b7e8089b2db60583607f3b550c862/compiler/rustc_mir_build/src/builder/expr/as_constant.rs#L153-L156
c09e84d to
47298b2
Compare
47298b2 to
c0184c1
Compare
|
|
||
| let dropless_arena = rustc_arena::DroplessArena::default(); | ||
| let typeck_results = this.tcx.typeck(this.def_id); | ||
| let lint_level = this.tcx.local_def_id_to_hir_id(this.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.
There is a commented out lint_level field in LoopMatch. That one should probably be uncommented and used here instead. The current code would use the lint level for the whole function. Alternatively adding a FIXME would be fine.
ee492fc
into
trifectatechfoundation:loop_match_attr
No description provided.