Skip to content

Commit 0069007

Browse files
committed
Avoid nightly feature usage where easily possible
1 parent 664b25e commit 0069007

File tree

4 files changed

+12
-26
lines changed

4 files changed

+12
-26
lines changed

example/mini_core_hello_world.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#![feature(
2-
no_core, start, lang_items, box_syntax, never_type, linkage,
3-
extern_types, thread_local
4-
)]
1+
#![feature(no_core, lang_items, box_syntax, never_type, linkage, extern_types, thread_local)]
52
#![no_core]
63
#![allow(dead_code, non_camel_case_types)]
74

src/base.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,16 @@ fn codegen_stmt<'tcx>(
465465
let val = crate::constant::codegen_tls_ref(fx, def_id, lval.layout());
466466
lval.write_cvalue(fx, val);
467467
}
468-
Rvalue::BinaryOp(bin_op, box (ref lhs, ref rhs)) => {
469-
let lhs = codegen_operand(fx, lhs);
470-
let rhs = codegen_operand(fx, rhs);
468+
Rvalue::BinaryOp(bin_op, ref lhs_rhs) => {
469+
let lhs = codegen_operand(fx, &lhs_rhs.0);
470+
let rhs = codegen_operand(fx, &lhs_rhs.1);
471471

472472
let res = crate::num::codegen_binop(fx, bin_op, lhs, rhs);
473473
lval.write_cvalue(fx, res);
474474
}
475-
Rvalue::CheckedBinaryOp(bin_op, box (ref lhs, ref rhs)) => {
476-
let lhs = codegen_operand(fx, lhs);
477-
let rhs = codegen_operand(fx, rhs);
475+
Rvalue::CheckedBinaryOp(bin_op, ref lhs_rhs) => {
476+
let lhs = codegen_operand(fx, &lhs_rhs.0);
477+
let rhs = codegen_operand(fx, &lhs_rhs.1);
478478

479479
let res = if !fx.tcx.sess.overflow_checks() {
480480
let val =
@@ -835,19 +835,15 @@ fn codegen_stmt<'tcx>(
835835
}
836836
}
837837
StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),
838-
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
839-
src,
840-
dst,
841-
count,
842-
}) => {
843-
let dst = codegen_operand(fx, dst);
838+
StatementKind::CopyNonOverlapping(inner) => {
839+
let dst = codegen_operand(fx, &inner.dst);
844840
let pointee = dst
845841
.layout()
846842
.pointee_info_at(fx, rustc_target::abi::Size::ZERO)
847843
.expect("Expected pointer");
848844
let dst = dst.load_scalar(fx);
849-
let src = codegen_operand(fx, src).load_scalar(fx);
850-
let count = codegen_operand(fx, count).load_scalar(fx);
845+
let src = codegen_operand(fx, &inner.src).load_scalar(fx);
846+
let count = codegen_operand(fx, &inner.count).load_scalar(fx);
851847
let elem_size: u64 = pointee.size.bytes();
852848
let bytes = if elem_size != 1 {
853849
fx.bcx.ins().imul_imm(count, elem_size as i64)

src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
#![feature(
22
rustc_private,
33
decl_macro,
4-
type_alias_impl_trait,
5-
associated_type_bounds,
64
never_type,
7-
try_blocks,
8-
box_patterns,
95
hash_drain_filter
106
)]
117
#![warn(rust_2018_idioms)]

src/pretty_clif.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,7 @@ pub(crate) fn write_ir_file(
224224

225225
let clif_file_name = clif_output_dir.join(name);
226226

227-
let res: std::io::Result<()> = try {
228-
let mut file = std::fs::File::create(clif_file_name)?;
229-
write(&mut file)?;
230-
};
227+
let res = std::fs::File::create(clif_file_name).and_then(|mut file| write(&mut file));
231228
if let Err(err) = res {
232229
tcx.sess.warn(&format!("error writing ir file: {}", err));
233230
}

0 commit comments

Comments
 (0)