Skip to content

Commit 1e720cd

Browse files
committed
merge rustc history
2 parents 55fe2b3 + 54ee5ac commit 1e720cd

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

build_system/rustc_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub(crate) fn get_file_name(crate_name: &str, crate_type: &str) -> String {
6565
}
6666

6767
/// Similar to `get_file_name`, but converts any dashes (`-`) in the `crate_name` to
68-
/// underscores (`_`). This is specially made for the the rustc and cargo wrappers
68+
/// underscores (`_`). This is specially made for the rustc and cargo wrappers
6969
/// which have a dash in the name, and that is not allowed in a crate name.
7070
pub(crate) fn get_wrapper_file_name(crate_name: &str, crate_type: &str) -> String {
7171
let crate_name = crate_name.replace('-', "_");

example/std_example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(core_intrinsics, generators, generator_trait, is_sorted, bench_black_box)]
1+
#![feature(core_intrinsics, generators, generator_trait, is_sorted)]
22

33
#[cfg(target_arch = "x86_64")]
44
use std::arch::x86_64::*;

src/abi/pass_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub(super) fn from_casted_value<'tcx>(
193193
kind: StackSlotKind::ExplicitSlot,
194194
// FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to
195195
// specify stack slot alignment.
196-
// Stack slot size may be bigger for for example `[u8; 3]` which is packed into an `i32`.
196+
// Stack slot size may be bigger for example `[u8; 3]` which is packed into an `i32`.
197197
// It may also be smaller for example when the type is a wrapper around an integer with a
198198
// larger alignment than the integer.
199199
size: (std::cmp::max(abi_param_size, layout_size) + 15) / 16 * 16,

src/base.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,12 @@ fn codegen_stmt<'tcx>(
633633
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
634634
}
635635
Rvalue::Cast(
636-
CastKind::Misc
636+
CastKind::IntToInt
637+
| CastKind::FloatToFloat
638+
| CastKind::FloatToInt
639+
| CastKind::IntToFloat
640+
| CastKind::FnPtrToPtr
641+
| CastKind::PtrToPtr
637642
| CastKind::PointerExposeAddress
638643
| CastKind::PointerFromExposedAddress,
639644
ref operand,

src/constant.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
55
use rustc_middle::mir::interpret::{
66
read_target_uint, AllocId, ConstAllocation, ConstValue, ErrorHandled, GlobalAlloc, Scalar,
77
};
8-
use rustc_middle::ty::ConstKind;
98
use rustc_span::DUMMY_SP;
109

1110
use cranelift_codegen::ir::GlobalValueData;
@@ -42,15 +41,7 @@ pub(crate) fn check_constants(fx: &mut FunctionCx<'_, '_, '_>) -> bool {
4241
let mut all_constants_ok = true;
4342
for constant in &fx.mir.required_consts {
4443
let unevaluated = match fx.monomorphize(constant.literal) {
45-
ConstantKind::Ty(ct) => match ct.kind() {
46-
ConstKind::Unevaluated(uv) => uv.expand(),
47-
ConstKind::Value(_) => continue,
48-
ConstKind::Param(_)
49-
| ConstKind::Infer(_)
50-
| ConstKind::Bound(_, _)
51-
| ConstKind::Placeholder(_)
52-
| ConstKind::Error(_) => unreachable!("{:?}", ct),
53-
},
44+
ConstantKind::Ty(_) => unreachable!(),
5445
ConstantKind::Unevaluated(uv, _) => uv,
5546
ConstantKind::Val(..) => continue,
5647
};
@@ -118,7 +109,7 @@ pub(crate) fn codegen_constant<'tcx>(
118109
) -> CValue<'tcx> {
119110
let (const_val, ty) = match fx.monomorphize(constant.literal) {
120111
ConstantKind::Ty(const_) => unreachable!("{:?}", const_),
121-
ConstantKind::Unevaluated(ty::Unevaluated { def, substs, promoted }, ty)
112+
ConstantKind::Unevaluated(mir::UnevaluatedConst { def, substs, promoted }, ty)
122113
if fx.tcx.is_static(def.did) =>
123114
{
124115
assert!(substs.is_empty());
@@ -499,7 +490,16 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
499490
match &stmt.kind {
500491
StatementKind::Assign(local_and_rvalue) if &local_and_rvalue.0 == place => {
501492
match &local_and_rvalue.1 {
502-
Rvalue::Cast(CastKind::Misc, operand, ty) => {
493+
Rvalue::Cast(
494+
CastKind::IntToInt
495+
| CastKind::FloatToFloat
496+
| CastKind::FloatToInt
497+
| CastKind::IntToFloat
498+
| CastKind::FnPtrToPtr
499+
| CastKind::PtrToPtr,
500+
operand,
501+
ty,
502+
) => {
503503
if computed_const_val.is_some() {
504504
return None; // local assigned twice
505505
}

0 commit comments

Comments
 (0)