about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/debuginfo
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-28 13:35:29 +0100
committerGitHub <noreply@github.com>2019-03-28 13:35:29 +0100
commitf90ac4f04a740e1f676847209d1f376753bca0d7 (patch)
treebeb20e940c85cf0f5afb2bf6e896beb45cd44b05 /src/librustc_codegen_llvm/debuginfo
parent237bf3244fffef501cf37d4bda00e1fce3fcfb46 (diff)
parent8f3e862797ecf83e89245d3f28532ab285c780ef (diff)
downloadrust-f90ac4f04a740e1f676847209d1f376753bca0d7.tar.gz
rust-f90ac4f04a740e1f676847209d1f376753bca0d7.zip
Rollup merge of #58717 - hellow554:nonzero_parse, r=oli-obk
Add FromStr impl for NonZero types

This is a WIP implementation because I do have some questions regarding the solution.

Somebody should ping the lang team on this I guess.
Please see the annotations on the code for more details.

Closes #58604
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/metadata.rs3
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 8efa025e3dd..042a8c60cfa 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};
@@ -1368,7 +1369,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)
                         };