Skip to content

Commit 489bff5

Browse files
committed
Sync from rust 7531d2f
2 parents 8f02c4e + 0b58e52 commit 489bff5

File tree

3 files changed

+8
-43
lines changed

3 files changed

+8
-43
lines changed

src/base.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -715,30 +715,6 @@ fn codegen_stmt<'tcx>(
715715
let operand = operand.load_scalar(fx);
716716
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
717717
}
718-
Rvalue::NullaryOp(NullOp::Box, content_ty) => {
719-
let usize_type = fx.clif_type(fx.tcx.types.usize).unwrap();
720-
let content_ty = fx.monomorphize(content_ty);
721-
let layout = fx.layout_of(content_ty);
722-
let llsize = fx.bcx.ins().iconst(usize_type, layout.size.bytes() as i64);
723-
let llalign = fx.bcx.ins().iconst(usize_type, layout.align.abi.bytes() as i64);
724-
let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty));
725-
726-
// Allocate space:
727-
let def_id =
728-
match fx.tcx.lang_items().require(rustc_hir::LangItem::ExchangeMalloc) {
729-
Ok(id) => id,
730-
Err(s) => {
731-
fx.tcx
732-
.sess
733-
.fatal(&format!("allocation of `{}` {}", box_layout.ty, s));
734-
}
735-
};
736-
let instance = ty::Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
737-
let func_ref = fx.get_function_ref(instance);
738-
let call = fx.bcx.ins().call(func_ref, &[llsize, llalign]);
739-
let ptr = fx.bcx.inst_results(call)[0];
740-
lval.write_cvalue(fx, CValue::by_val(ptr, box_layout));
741-
}
742718
Rvalue::NullaryOp(null_op, ty) => {
743719
assert!(
744720
lval.layout()
@@ -749,7 +725,6 @@ fn codegen_stmt<'tcx>(
749725
let val = match null_op {
750726
NullOp::SizeOf => layout.size.bytes(),
751727
NullOp::AlignOf => layout.align.abi.bytes(),
752-
NullOp::Box => unreachable!(),
753728
};
754729
let val = CValue::const_val(fx, fx.layout_of(fx.tcx.types.usize), val.into());
755730
lval.write_cvalue(fx, val);
@@ -774,18 +749,6 @@ fn codegen_stmt<'tcx>(
774749
| StatementKind::Retag { .. }
775750
| StatementKind::AscribeUserType(..) => {}
776751

777-
StatementKind::LlvmInlineAsm(asm) => {
778-
match asm.asm.asm.as_str().trim() {
779-
"" => {
780-
// Black box
781-
}
782-
_ => fx.tcx.sess.span_fatal(
783-
stmt.source_info.span,
784-
"Legacy `llvm_asm!` inline assembly is not supported. \
785-
Try using the new `asm!` instead.",
786-
),
787-
}
788-
}
789752
StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),
790753
StatementKind::CopyNonOverlapping(inner) => {
791754
let dst = codegen_operand(fx, &inner.dst);

src/constant.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ pub(crate) fn codegen_constant<'tcx>(
129129
};
130130
let const_val = match const_.val {
131131
ConstKind::Value(const_val) => const_val,
132-
ConstKind::Unevaluated(uv) if fx.tcx.is_static(uv.def.did) => {
133-
assert!(uv.substs(fx.tcx).is_empty());
134-
assert!(uv.promoted.is_none());
132+
ConstKind::Unevaluated(ty::Unevaluated { def, substs, promoted })
133+
if fx.tcx.is_static(def.did) =>
134+
{
135+
assert!(substs.is_empty());
136+
assert!(promoted.is_none());
135137

136-
return codegen_static_ref(fx, uv.def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
138+
return codegen_static_ref(fx, def.did, fx.layout_of(const_.ty)).to_cvalue(fx);
137139
}
138140
ConstKind::Unevaluated(unevaluated) => {
139141
match fx.tcx.const_eval_resolve(ParamEnv::reveal_all(), unevaluated, None) {
@@ -506,7 +508,7 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
506508
{
507509
return None;
508510
}
509-
StatementKind::LlvmInlineAsm(_) | StatementKind::CopyNonOverlapping(_) => {
511+
StatementKind::CopyNonOverlapping(_) => {
510512
return None;
511513
} // conservative handling
512514
StatementKind::Assign(_)

src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ impl<'tcx> DebugContext<'tcx> {
174174

175175
field_entry.set(
176176
gimli::DW_AT_name,
177-
AttributeValue::String(field_def.ident.as_str().to_string().into_bytes()),
177+
AttributeValue::String(field_def.name.as_str().to_string().into_bytes()),
178178
);
179179
field_entry.set(
180180
gimli::DW_AT_data_member_location,

0 commit comments

Comments
 (0)