mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Fix warnings
This commit is contained in:
parent
dc76cd0551
commit
b113e88ddb
@ -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>> {
|
||||
|
@ -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,
|
||||
|
@ -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>,
|
||||
|
@ -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);
|
||||
|
@ -37,6 +37,7 @@ impl Pointer {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn base_and_offset(self) -> (PointerBase, Offset32) {
|
||||
(self.base, self.offset)
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user