diff options
| author | Marcel Hellwig <git@cookiesoft.de> | 2019-03-28 09:31:18 +0100 |
|---|---|---|
| committer | Marcel Hellwig <git@cookiesoft.de> | 2019-03-28 10:12:17 +0100 |
| commit | 8f3e862797ecf83e89245d3f28532ab285c780ef (patch) | |
| tree | c0819839250d60c24cba2d30df5192bdd72b86b1 /src/librustc_codegen_llvm/debuginfo | |
| parent | 7330525e8fa8e873bc7feeb476fa161d20786a43 (diff) | |
| download | rust-8f3e862797ecf83e89245d3f28532ab285c780ef.tar.gz rust-8f3e862797ecf83e89245d3f28532ab285c780ef.zip | |
fixed shift overflow
Fix according to oli-obk (https://github.com/rust-lang/rust/pull/58717#issuecomment-477494457)
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/metadata.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index da9ff54b062..17e6703d03d 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -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)); Some(value as u64) }; |
