Fix a number of warnings on nightly Rust (#2652)
This fixes some issues that are cropping up where some syntax will get phased out in 2021
This commit is contained in:
@@ -296,7 +296,8 @@ impl Var {
|
||||
pub fn set_def(&mut self, position: PatternPosition, def: DefIndex) {
|
||||
assert!(
|
||||
self.get_def(position).is_none(),
|
||||
format!("redefinition of variable {}", self.name)
|
||||
"redefinition of variable {}",
|
||||
self.name
|
||||
);
|
||||
match position {
|
||||
PatternPosition::Source => {
|
||||
@@ -461,7 +462,8 @@ impl Apply {
|
||||
// Basic check on number of arguments.
|
||||
assert!(
|
||||
inst.operands_in.len() == args.len(),
|
||||
format!("incorrect number of arguments in instruction {}", inst.name)
|
||||
"incorrect number of arguments in instruction {}",
|
||||
inst.name
|
||||
);
|
||||
|
||||
// Check that the kinds of Literals arguments match the expected operand.
|
||||
|
||||
@@ -153,10 +153,9 @@ impl EncodingBuilder {
|
||||
let inst = self.inst.inst();
|
||||
assert!(
|
||||
Rc::ptr_eq(&inst.format, &recipes[self.recipe].format),
|
||||
format!(
|
||||
"Inst {} and recipe {} must have the same format!",
|
||||
inst.name, recipes[self.recipe].name
|
||||
)
|
||||
"Inst {} and recipe {} must have the same format!",
|
||||
inst.name,
|
||||
recipes[self.recipe].name
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -394,7 +394,7 @@ impl ValueTypeOrAny {
|
||||
pub fn expect(self, msg: &str) -> ValueType {
|
||||
match self {
|
||||
ValueTypeOrAny::ValueType(vt) => vt,
|
||||
ValueTypeOrAny::Any => panic!(format!("Unexpected Any: {}", msg)),
|
||||
ValueTypeOrAny::Any => panic!("Unexpected Any: {}", msg),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -665,7 +665,7 @@ fn verify_polymorphic(
|
||||
if operands_out.is_empty() {
|
||||
// No result means no other possible type variable, so it's a type inference failure.
|
||||
match maybe_error_message {
|
||||
Some(msg) => panic!(msg),
|
||||
Some(msg) => panic!("{}", msg),
|
||||
None => panic!("typevar_operand must be a free type variable"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,10 +260,9 @@ impl EncodingRecipeBuilder {
|
||||
if !self.format.has_value_list {
|
||||
assert!(
|
||||
operands_in.len() == self.format.num_value_operands,
|
||||
format!(
|
||||
"missing operand constraints for recipe {} (format {})",
|
||||
self.name, self.format.name
|
||||
)
|
||||
"missing operand constraints for recipe {} (format {})",
|
||||
self.name,
|
||||
self.format.name
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,8 @@ impl TypeEnvironment {
|
||||
None => {
|
||||
assert!(
|
||||
!actual_tv.name.starts_with("typeof_"),
|
||||
format!("variable {} should be explicitly ranked", actual_tv.name)
|
||||
"variable {} should be explicitly ranked",
|
||||
actual_tv.name
|
||||
);
|
||||
None
|
||||
}
|
||||
|
||||
@@ -74,19 +74,18 @@ impl Transform {
|
||||
for &var_index in &input_vars {
|
||||
assert!(
|
||||
var_pool.get(var_index).is_input(),
|
||||
format!("'{:?}' used as both input and def", var_pool.get(var_index))
|
||||
"'{:?}' used as both input and def",
|
||||
var_pool.get(var_index)
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
input_vars.len() == num_src_inputs,
|
||||
format!(
|
||||
"extra input vars in dst pattern: {:?}",
|
||||
input_vars
|
||||
.iter()
|
||||
.map(|&i| var_pool.get(i))
|
||||
.skip(num_src_inputs)
|
||||
.collect::<Vec<_>>()
|
||||
)
|
||||
"extra input vars in dst pattern: {:?}",
|
||||
input_vars
|
||||
.iter()
|
||||
.map(|&i| var_pool.get(i))
|
||||
.skip(num_src_inputs)
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
|
||||
// Perform type inference and cleanup.
|
||||
@@ -143,7 +142,8 @@ impl Transform {
|
||||
let defined_var = self.var_pool.get(var_index);
|
||||
assert!(
|
||||
defined_var.is_output(),
|
||||
format!("{:?} not defined in the destination pattern", defined_var)
|
||||
"{:?} not defined in the destination pattern",
|
||||
defined_var
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,8 @@ fn rewrite_expr(
|
||||
let var = var_pool.get(own_var);
|
||||
assert!(
|
||||
var.is_input() || var.get_def(position).is_some(),
|
||||
format!("{:?} used as both input and def", var)
|
||||
"{:?} used as both input and def",
|
||||
var
|
||||
);
|
||||
args.push(Expr::Var(own_var));
|
||||
}
|
||||
@@ -400,10 +401,8 @@ impl TransformGroupBuilder {
|
||||
self.custom_legalizes
|
||||
.insert(inst.camel_name.clone(), func_name)
|
||||
.is_none(),
|
||||
format!(
|
||||
"custom legalization action for {} inserted twice",
|
||||
inst.name
|
||||
)
|
||||
"custom legalization action for {} inserted twice",
|
||||
inst.name
|
||||
);
|
||||
}
|
||||
|
||||
@@ -442,7 +441,8 @@ impl TransformGroups {
|
||||
for group in self.groups.values() {
|
||||
assert!(
|
||||
group.name != new_group.name,
|
||||
format!("trying to insert {} for the second time", new_group.name)
|
||||
"trying to insert {} for the second time",
|
||||
new_group.name
|
||||
);
|
||||
}
|
||||
self.groups.push(new_group)
|
||||
@@ -459,7 +459,7 @@ impl TransformGroups {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
panic!(format!("transform group with name {} not found", name));
|
||||
panic!("transform group with name {} not found", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ fn emit_instp(instp: &InstructionPredicate, has_func: bool, fmt: &mut Formatter)
|
||||
Some(previous_format_name) => {
|
||||
assert!(
|
||||
previous_format_name == leaf_format_name,
|
||||
format!("Format predicate can only operate on a single InstructionFormat; trying to use both {} and {}", previous_format_name, leaf_format_name
|
||||
));
|
||||
"Format predicate can only operate on a single InstructionFormat; trying to use both {} and {}", previous_format_name, leaf_format_name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ impl RecipeGroup {
|
||||
fn push(&mut self, builder: EncodingRecipeBuilder) {
|
||||
assert!(
|
||||
self.name_to_recipe.get(&builder.name).is_none(),
|
||||
format!("riscv recipe '{}' created twice", builder.name)
|
||||
"riscv recipe '{}' created twice",
|
||||
builder.name
|
||||
);
|
||||
let name = builder.name.clone();
|
||||
let number = self.recipes.push(builder.build());
|
||||
|
||||
@@ -45,10 +45,8 @@ impl PerCpuModeEncodings {
|
||||
if let Some(found_index) = self.recipes_by_name.get(&recipe.name) {
|
||||
assert!(
|
||||
self.recipes[*found_index] == recipe,
|
||||
format!(
|
||||
"trying to insert different recipes with a same name ({})",
|
||||
recipe.name
|
||||
)
|
||||
"trying to insert different recipes with a same name ({})",
|
||||
recipe.name
|
||||
);
|
||||
*found_index
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user