-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add FromStr impl for NonZero types #58717
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
Changes from all commits
36bcbc3
ce30d4e
912ad68
ad240ea
7330525
8f3e862
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ use rustc::hir::CodegenFnAttrFlags; | |
use rustc::hir::def::CtorKind; | ||
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; | ||
use rustc::ich::NodeIdHashingMode; | ||
use rustc::mir::interpret::truncate; | ||
use rustc_data_structures::fingerprint::Fingerprint; | ||
use rustc::ty::Instance; | ||
use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; | ||
|
@@ -1366,7 +1367,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { | |
let value = (i.as_u32() as u128) | ||
.wrapping_sub(niche_variants.start().as_u32() as u128) | ||
.wrapping_add(niche_start); | ||
let value = value & ((1u128 << niche.value.size(cx).bits()) - 1); | ||
let value = truncate(value, niche.value.size(cx)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh wow I don't know what I thought when I wrote that code, maybe I just forgot the semantics of Nevermind, it wasn't me, see #55701 (comment). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you're touching this code, can you add the |
||
Some(value as u64) | ||
}; | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.