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) {
|
pub fn set_def(&mut self, position: PatternPosition, def: DefIndex) {
|
||||||
assert!(
|
assert!(
|
||||||
self.get_def(position).is_none(),
|
self.get_def(position).is_none(),
|
||||||
format!("redefinition of variable {}", self.name)
|
"redefinition of variable {}",
|
||||||
|
self.name
|
||||||
);
|
);
|
||||||
match position {
|
match position {
|
||||||
PatternPosition::Source => {
|
PatternPosition::Source => {
|
||||||
@@ -461,7 +462,8 @@ impl Apply {
|
|||||||
// Basic check on number of arguments.
|
// Basic check on number of arguments.
|
||||||
assert!(
|
assert!(
|
||||||
inst.operands_in.len() == args.len(),
|
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.
|
// Check that the kinds of Literals arguments match the expected operand.
|
||||||
|
|||||||
@@ -153,10 +153,9 @@ impl EncodingBuilder {
|
|||||||
let inst = self.inst.inst();
|
let inst = self.inst.inst();
|
||||||
assert!(
|
assert!(
|
||||||
Rc::ptr_eq(&inst.format, &recipes[self.recipe].format),
|
Rc::ptr_eq(&inst.format, &recipes[self.recipe].format),
|
||||||
format!(
|
|
||||||
"Inst {} and recipe {} must have the same format!",
|
"Inst {} and recipe {} must have the same format!",
|
||||||
inst.name, recipes[self.recipe].name
|
inst.name,
|
||||||
)
|
recipes[self.recipe].name
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ impl ValueTypeOrAny {
|
|||||||
pub fn expect(self, msg: &str) -> ValueType {
|
pub fn expect(self, msg: &str) -> ValueType {
|
||||||
match self {
|
match self {
|
||||||
ValueTypeOrAny::ValueType(vt) => vt,
|
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() {
|
if operands_out.is_empty() {
|
||||||
// No result means no other possible type variable, so it's a type inference failure.
|
// No result means no other possible type variable, so it's a type inference failure.
|
||||||
match maybe_error_message {
|
match maybe_error_message {
|
||||||
Some(msg) => panic!(msg),
|
Some(msg) => panic!("{}", msg),
|
||||||
None => panic!("typevar_operand must be a free type variable"),
|
None => panic!("typevar_operand must be a free type variable"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,10 +260,9 @@ impl EncodingRecipeBuilder {
|
|||||||
if !self.format.has_value_list {
|
if !self.format.has_value_list {
|
||||||
assert!(
|
assert!(
|
||||||
operands_in.len() == self.format.num_value_operands,
|
operands_in.len() == self.format.num_value_operands,
|
||||||
format!(
|
|
||||||
"missing operand constraints for recipe {} (format {})",
|
"missing operand constraints for recipe {} (format {})",
|
||||||
self.name, self.format.name
|
self.name,
|
||||||
)
|
self.format.name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,8 @@ impl TypeEnvironment {
|
|||||||
None => {
|
None => {
|
||||||
assert!(
|
assert!(
|
||||||
!actual_tv.name.starts_with("typeof_"),
|
!actual_tv.name.starts_with("typeof_"),
|
||||||
format!("variable {} should be explicitly ranked", actual_tv.name)
|
"variable {} should be explicitly ranked",
|
||||||
|
actual_tv.name
|
||||||
);
|
);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,19 +74,18 @@ impl Transform {
|
|||||||
for &var_index in &input_vars {
|
for &var_index in &input_vars {
|
||||||
assert!(
|
assert!(
|
||||||
var_pool.get(var_index).is_input(),
|
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!(
|
assert!(
|
||||||
input_vars.len() == num_src_inputs,
|
input_vars.len() == num_src_inputs,
|
||||||
format!(
|
|
||||||
"extra input vars in dst pattern: {:?}",
|
"extra input vars in dst pattern: {:?}",
|
||||||
input_vars
|
input_vars
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&i| var_pool.get(i))
|
.map(|&i| var_pool.get(i))
|
||||||
.skip(num_src_inputs)
|
.skip(num_src_inputs)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Perform type inference and cleanup.
|
// Perform type inference and cleanup.
|
||||||
@@ -143,7 +142,8 @@ impl Transform {
|
|||||||
let defined_var = self.var_pool.get(var_index);
|
let defined_var = self.var_pool.get(var_index);
|
||||||
assert!(
|
assert!(
|
||||||
defined_var.is_output(),
|
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);
|
let var = var_pool.get(own_var);
|
||||||
assert!(
|
assert!(
|
||||||
var.is_input() || var.get_def(position).is_some(),
|
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));
|
args.push(Expr::Var(own_var));
|
||||||
}
|
}
|
||||||
@@ -400,10 +401,8 @@ impl TransformGroupBuilder {
|
|||||||
self.custom_legalizes
|
self.custom_legalizes
|
||||||
.insert(inst.camel_name.clone(), func_name)
|
.insert(inst.camel_name.clone(), func_name)
|
||||||
.is_none(),
|
.is_none(),
|
||||||
format!(
|
|
||||||
"custom legalization action for {} inserted twice",
|
"custom legalization action for {} inserted twice",
|
||||||
inst.name
|
inst.name
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +441,8 @@ impl TransformGroups {
|
|||||||
for group in self.groups.values() {
|
for group in self.groups.values() {
|
||||||
assert!(
|
assert!(
|
||||||
group.name != new_group.name,
|
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)
|
self.groups.push(new_group)
|
||||||
@@ -459,7 +459,7 @@ impl TransformGroups {
|
|||||||
return group;
|
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) => {
|
Some(previous_format_name) => {
|
||||||
assert!(
|
assert!(
|
||||||
previous_format_name == leaf_format_name,
|
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) {
|
fn push(&mut self, builder: EncodingRecipeBuilder) {
|
||||||
assert!(
|
assert!(
|
||||||
self.name_to_recipe.get(&builder.name).is_none(),
|
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 name = builder.name.clone();
|
||||||
let number = self.recipes.push(builder.build());
|
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) {
|
if let Some(found_index) = self.recipes_by_name.get(&recipe.name) {
|
||||||
assert!(
|
assert!(
|
||||||
self.recipes[*found_index] == recipe,
|
self.recipes[*found_index] == recipe,
|
||||||
format!(
|
|
||||||
"trying to insert different recipes with a same name ({})",
|
"trying to insert different recipes with a same name ({})",
|
||||||
recipe.name
|
recipe.name
|
||||||
)
|
|
||||||
);
|
);
|
||||||
*found_index
|
*found_index
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user