about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2020-03-24 13:41:19 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2020-03-24 13:41:19 +0100
commitb113e88ddb399f92f0d044caa35e668d2499bdd9 (patch)
tree51c9ebf65a5cccee9520bbeccdf3712099cd1a8b /src
parentdc76cd0551d140f1455cb0969de070cc2cd3fdcc (diff)
downloadrust-b113e88ddb399f92f0d044caa35e668d2499bdd9.tar.gz
rust-b113e88ddb399f92f0d044caa35e668d2499bdd9.zip
Fix warnings
Diffstat (limited to 'src')
-rw-r--r--src/abi/pass_mode.rs2
-rw-r--r--src/abi/returning.rs3
-rw-r--r--src/optimize/mod.rs1
-rw-r--r--src/optimize/stack2reg.rs1
-rw-r--r--src/pointer.rs1
-rw-r--r--src/pretty_clif.rs16
6 files changed, 15 insertions, 9 deletions
diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs
index 3c19787ef92..dc6908fc72d 100644
--- a/src/abi/pass_mode.rs
+++ b/src/abi/pass_mode.rs
@@ -130,7 +130,9 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
 pub(super) fn cvalue_for_param<'tcx>(
     fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
     start_block: Block,
+    #[cfg_attr(not(debug_assertions), allow(unused_variables))]
     local: Option<mir::Local>,
+    #[cfg_attr(not(debug_assertions), allow(unused_variables))]
     local_field: Option<usize>,
     arg_ty: Ty<'tcx>,
 ) -> Option<CValue<'tcx>> {
diff --git a/src/abi/returning.rs b/src/abi/returning.rs
index b4dd04002cf..0262728bb67 100644
--- a/src/abi/returning.rs
+++ b/src/abi/returning.rs
@@ -43,6 +43,9 @@ pub(super) fn codegen_return_param(
         PassMode::ByRef { sized: false } => todo!(),
     };
 
+    #[cfg(not(debug_assertions))]
+    let _ = ret_param;
+
     #[cfg(debug_assertions)]
     crate::abi::comments::add_arg_comment(
         fx,
diff --git a/src/optimize/mod.rs b/src/optimize/mod.rs
index f6d02e999e1..29ad5321d57 100644
--- a/src/optimize/mod.rs
+++ b/src/optimize/mod.rs
@@ -5,6 +5,7 @@ mod stack2reg;
 
 pub fn optimize_function<'tcx>(
     tcx: TyCtxt<'tcx>,
+    #[cfg_attr(not(debug_assertions), allow(unused_variables))]
     instance: Instance<'tcx>,
     ctx: &mut Context,
     cold_blocks: &EntitySet<Block>,
diff --git a/src/optimize/stack2reg.rs b/src/optimize/stack2reg.rs
index 757e608d733..b21f838111c 100644
--- a/src/optimize/stack2reg.rs
+++ b/src/optimize/stack2reg.rs
@@ -162,6 +162,7 @@ impl<'a> OptimizeContext<'a> {
 
 pub(super) fn optimize_function(
     ctx: &mut Context,
+    #[cfg_attr(not(debug_assertions), allow(unused_variables))]
     clif_comments: &mut crate::pretty_clif::CommentWriter,
 ) {
     combine_stack_addr_with_load_store(&mut ctx.func);
diff --git a/src/pointer.rs b/src/pointer.rs
index 0ecb0e1274e..b9183aeedc9 100644
--- a/src/pointer.rs
+++ b/src/pointer.rs
@@ -37,6 +37,7 @@ impl Pointer {
         }
     }
 
+    #[cfg(debug_assertions)]
     pub fn base_and_offset(self) -> (PointerBase, Offset32) {
         (self.base, self.offset)
     }
diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs
index a2872af53f9..725df448161 100644
--- a/src/pretty_clif.rs
+++ b/src/pretty_clif.rs
@@ -1,12 +1,10 @@
-use std::borrow::Cow;
 use std::collections::HashMap;
 use std::fmt;
 
 use cranelift_codegen::{
     entity::SecondaryMap,
-    ir::{self, entities::AnyEntity, function::DisplayFunctionAnnotations},
+    ir::{entities::AnyEntity, function::DisplayFunctionAnnotations},
     write::{FuncWriter, PlainWriter},
-    ValueLabelsRanges,
 };
 
 use crate::prelude::*;
@@ -103,7 +101,7 @@ impl CommentWriter {
         self.global_comments.push(comment.into());
     }
 
-    pub fn add_comment<'s, S: Into<Cow<'s, str>>, E: Into<AnyEntity>>(
+    pub fn add_comment<S: Into<String> + AsRef<str>, E: Into<AnyEntity>>(
         &mut self,
         entity: E,
         comment: S,
@@ -112,10 +110,10 @@ impl CommentWriter {
         match self.entity_comments.entry(entity.into()) {
             Entry::Occupied(mut occ) => {
                 occ.get_mut().push('\n');
-                occ.get_mut().push_str(comment.into().as_ref());
+                occ.get_mut().push_str(comment.as_ref());
             }
             Entry::Vacant(vac) => {
-                vac.insert(comment.into().into_owned());
+                vac.insert(comment.into());
             }
         }
     }
@@ -192,7 +190,7 @@ impl<'a, 'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
         self.clif_comments.add_global_comment(comment);
     }
 
-    pub fn add_comment<'s, S: Into<Cow<'s, str>>, E: Into<AnyEntity>>(
+    pub fn add_comment<S: Into<String> + AsRef<str>, E: Into<AnyEntity>>(
         &mut self,
         entity: E,
         comment: S,
@@ -206,9 +204,9 @@ pub fn write_clif_file<'tcx>(
     tcx: TyCtxt<'tcx>,
     postfix: &str,
     instance: Instance<'tcx>,
-    func: &ir::Function,
+    func: &cranelift_codegen::ir::Function,
     mut clif_comments: &CommentWriter,
-    value_ranges: Option<&ValueLabelsRanges>,
+    value_ranges: Option<&cranelift_codegen::ValueLabelsRanges>,
 ) {
     use std::io::Write;