about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-03-18 12:20:24 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-03-18 12:23:55 +0100
commit0069007d5b17b19bf6a7686dec7dee7be46dcd47 (patch)
treea2c7d0743b57b93434f3d4340b9e326f74e9d6f0
parent664b25ea38f9a7e826048df1490a101adbc7d6d5 (diff)
downloadrust-0069007d5b17b19bf6a7686dec7dee7be46dcd47.tar.gz
rust-0069007d5b17b19bf6a7686dec7dee7be46dcd47.zip
Avoid nightly feature usage where easily possible
-rw-r--r--example/mini_core_hello_world.rs5
-rw-r--r--src/base.rs24
-rw-r--r--src/lib.rs4
-rw-r--r--src/pretty_clif.rs5
4 files changed, 12 insertions, 26 deletions
diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs
index 08ceaeb6544..ea37ca98b59 100644
--- a/example/mini_core_hello_world.rs
+++ b/example/mini_core_hello_world.rs
@@ -1,7 +1,4 @@
-#![feature(
-    no_core, start, lang_items, box_syntax, never_type, linkage,
-    extern_types, thread_local
-)]
+#![feature(no_core, lang_items, box_syntax, never_type, linkage, extern_types, thread_local)]
 #![no_core]
 #![allow(dead_code, non_camel_case_types)]
 
diff --git a/src/base.rs b/src/base.rs
index ee0244b1ad0..33a28ac733e 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -465,16 +465,16 @@ fn codegen_stmt<'tcx>(
                     let val = crate::constant::codegen_tls_ref(fx, def_id, lval.layout());
                     lval.write_cvalue(fx, val);
                 }
-                Rvalue::BinaryOp(bin_op, box (ref lhs, ref rhs)) => {
-                    let lhs = codegen_operand(fx, lhs);
-                    let rhs = codegen_operand(fx, rhs);
+                Rvalue::BinaryOp(bin_op, ref lhs_rhs) => {
+                    let lhs = codegen_operand(fx, &lhs_rhs.0);
+                    let rhs = codegen_operand(fx, &lhs_rhs.1);
 
                     let res = crate::num::codegen_binop(fx, bin_op, lhs, rhs);
                     lval.write_cvalue(fx, res);
                 }
-                Rvalue::CheckedBinaryOp(bin_op, box (ref lhs, ref rhs)) => {
-                    let lhs = codegen_operand(fx, lhs);
-                    let rhs = codegen_operand(fx, rhs);
+                Rvalue::CheckedBinaryOp(bin_op, ref lhs_rhs) => {
+                    let lhs = codegen_operand(fx, &lhs_rhs.0);
+                    let rhs = codegen_operand(fx, &lhs_rhs.1);
 
                     let res = if !fx.tcx.sess.overflow_checks() {
                         let val =
@@ -835,19 +835,15 @@ fn codegen_stmt<'tcx>(
             }
         }
         StatementKind::Coverage { .. } => fx.tcx.sess.fatal("-Zcoverage is unimplemented"),
-        StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
-          src,
-          dst,
-          count,
-        }) => {
-            let dst = codegen_operand(fx, dst);
+        StatementKind::CopyNonOverlapping(inner) => {
+            let dst = codegen_operand(fx, &inner.dst);
             let pointee = dst
               .layout()
               .pointee_info_at(fx, rustc_target::abi::Size::ZERO)
               .expect("Expected pointer");
             let dst = dst.load_scalar(fx);
-            let src = codegen_operand(fx, src).load_scalar(fx);
-            let count = codegen_operand(fx, count).load_scalar(fx);
+            let src = codegen_operand(fx, &inner.src).load_scalar(fx);
+            let count = codegen_operand(fx, &inner.count).load_scalar(fx);
             let elem_size: u64 = pointee.size.bytes();
             let bytes = if elem_size != 1 {
                fx.bcx.ins().imul_imm(count, elem_size as i64)
diff --git a/src/lib.rs b/src/lib.rs
index 158f5d4b9d2..63fb1c40844 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,11 +1,7 @@
 #![feature(
     rustc_private,
     decl_macro,
-    type_alias_impl_trait,
-    associated_type_bounds,
     never_type,
-    try_blocks,
-    box_patterns,
     hash_drain_filter
 )]
 #![warn(rust_2018_idioms)]
diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs
index 855a0cc8e4a..d22ea3772ee 100644
--- a/src/pretty_clif.rs
+++ b/src/pretty_clif.rs
@@ -224,10 +224,7 @@ pub(crate) fn write_ir_file(
 
     let clif_file_name = clif_output_dir.join(name);
 
-    let res: std::io::Result<()> = try {
-        let mut file = std::fs::File::create(clif_file_name)?;
-        write(&mut file)?;
-    };
+    let res = std::fs::File::create(clif_file_name).and_then(|mut file| write(&mut file));
     if let Err(err) = res {
         tcx.sess.warn(&format!("error writing ir file: {}", err));
     }