diff options
Diffstat (limited to 'compiler/rustc_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/builder/expr/as_constant.rs | 20 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/builder/mod.rs | 6 |
2 files changed, 4 insertions, 22 deletions
diff --git a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs index 4a532c3bb2d..0e0c7a7fa4f 100644 --- a/compiler/rustc_mir_build/src/builder/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/builder/expr/as_constant.rs @@ -1,7 +1,5 @@ //! See docs in build/expr/mod.rs -use std::marker::PhantomData; - use rustc_abi::Size; use rustc_ast as ast; use rustc_hir::LangItem; @@ -125,11 +123,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let s = s.as_str().as_bytes(); let len = s.len(); let allocation = tcx.allocate_bytes_dedup(s, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if matches!(inner_ty.kind(), ty::Slice(_)) => @@ -137,11 +131,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let data = byte_sym.as_byte_str(); let len = data.len(); let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::ByteStr(byte_sym, _), ty::Ref(_, inner_ty, _)) if inner_ty.is_array() => { let id = tcx.allocate_bytes_dedup(byte_sym.as_byte_str(), CTFE_ALLOC_SALT); @@ -152,11 +142,7 @@ fn lit_to_mir_constant<'tcx>(tcx: TyCtxt<'tcx>, lit_input: LitToConstInput<'tcx> let data = byte_sym.as_byte_str(); let len = data.len(); let allocation = tcx.allocate_bytes_dedup(data, CTFE_ALLOC_SALT); - ConstValue::Slice { - alloc_id: allocation, - meta: len.try_into().unwrap(), - phantom: PhantomData, - } + ConstValue::Slice { alloc_id: allocation, meta: len.try_into().unwrap() } } (ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => { ConstValue::Scalar(Scalar::from_uint(n, Size::from_bytes(1))) diff --git a/compiler/rustc_mir_build/src/builder/mod.rs b/compiler/rustc_mir_build/src/builder/mod.rs index 3d5f6f4cf45..855cd2f3bc0 100644 --- a/compiler/rustc_mir_build/src/builder/mod.rs +++ b/compiler/rustc_mir_build/src/builder/mod.rs @@ -1045,11 +1045,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } -fn parse_float_into_constval<'tcx>( - num: Symbol, - float_ty: ty::FloatTy, - neg: bool, -) -> Option<ConstValue<'tcx>> { +fn parse_float_into_constval(num: Symbol, float_ty: ty::FloatTy, neg: bool) -> Option<ConstValue> { parse_float_into_scalar(num, float_ty, neg).map(|s| ConstValue::Scalar(s.into())) } |
