mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Remove a couple vec allocs
This commit is contained in:
parent
5cc6727e9f
commit
a47dc711f3
2 changed files with 14 additions and 20 deletions
|
@ -1482,8 +1482,8 @@ fn constrain_typed_def(
|
||||||
|
|
||||||
constrain_def_make_constraint(
|
constrain_def_make_constraint(
|
||||||
constraints,
|
constraints,
|
||||||
new_rigid_variables,
|
new_rigid_variables.into_iter(),
|
||||||
new_infer_variables,
|
new_infer_variables.into_iter(),
|
||||||
expr_con,
|
expr_con,
|
||||||
body_con,
|
body_con,
|
||||||
def_pattern_state,
|
def_pattern_state,
|
||||||
|
@ -1517,8 +1517,8 @@ fn constrain_typed_def(
|
||||||
|
|
||||||
constrain_def_make_constraint(
|
constrain_def_make_constraint(
|
||||||
constraints,
|
constraints,
|
||||||
new_rigid_variables,
|
new_rigid_variables.into_iter(),
|
||||||
new_infer_variables,
|
new_infer_variables.into_iter(),
|
||||||
expr_con,
|
expr_con,
|
||||||
body_con,
|
body_con,
|
||||||
def_pattern_state,
|
def_pattern_state,
|
||||||
|
@ -1683,8 +1683,8 @@ fn constrain_def(
|
||||||
|
|
||||||
constrain_def_make_constraint(
|
constrain_def_make_constraint(
|
||||||
constraints,
|
constraints,
|
||||||
vec![],
|
std::iter::empty(),
|
||||||
vec![],
|
std::iter::empty(),
|
||||||
expr_con,
|
expr_con,
|
||||||
body_con,
|
body_con,
|
||||||
def_pattern_state,
|
def_pattern_state,
|
||||||
|
@ -1695,8 +1695,8 @@ fn constrain_def(
|
||||||
|
|
||||||
pub fn constrain_def_make_constraint(
|
pub fn constrain_def_make_constraint(
|
||||||
constraints: &mut Constraints,
|
constraints: &mut Constraints,
|
||||||
new_rigid_variables: Vec<Variable>,
|
new_rigid_variables: impl Iterator<Item = Variable>,
|
||||||
new_infer_variables: Vec<Variable>,
|
new_infer_variables: impl Iterator<Item = Variable>,
|
||||||
expr_con: Constraint,
|
expr_con: Constraint,
|
||||||
body_con: Constraint,
|
body_con: Constraint,
|
||||||
def_pattern_state: PatternState,
|
def_pattern_state: PatternState,
|
||||||
|
|
|
@ -139,8 +139,8 @@ fn constrain_symbols_from_requires(
|
||||||
constraints,
|
constraints,
|
||||||
// No new rigids or flex vars because they are represented in the type
|
// No new rigids or flex vars because they are represented in the type
|
||||||
// annotation.
|
// annotation.
|
||||||
vec![],
|
std::iter::empty(),
|
||||||
vec![],
|
std::iter::empty(),
|
||||||
Constraint::True,
|
Constraint::True,
|
||||||
constraint,
|
constraint,
|
||||||
def_pattern_state,
|
def_pattern_state,
|
||||||
|
@ -187,14 +187,8 @@ pub fn frontload_ability_constraints(
|
||||||
def_pattern_state.vars.push(member_data.signature_var);
|
def_pattern_state.vars.push(member_data.signature_var);
|
||||||
|
|
||||||
let vars = &member_data.variables;
|
let vars = &member_data.variables;
|
||||||
let new_rigid_variables = vars
|
let rigid_variables = vars.rigid_vars.iter().chain(vars.able_vars.iter()).copied();
|
||||||
.rigid_vars
|
let infer_variables = vars.flex_vars.iter().copied();
|
||||||
.iter()
|
|
||||||
.chain(vars.able_vars.iter())
|
|
||||||
.copied()
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let new_infer_variables = vars.flex_vars.clone();
|
|
||||||
|
|
||||||
def_pattern_state
|
def_pattern_state
|
||||||
.constraints
|
.constraints
|
||||||
|
@ -207,8 +201,8 @@ pub fn frontload_ability_constraints(
|
||||||
|
|
||||||
constraint = constrain_def_make_constraint(
|
constraint = constrain_def_make_constraint(
|
||||||
constraints,
|
constraints,
|
||||||
new_rigid_variables,
|
rigid_variables,
|
||||||
new_infer_variables,
|
infer_variables,
|
||||||
Constraint::True,
|
Constraint::True,
|
||||||
constraint,
|
constraint,
|
||||||
def_pattern_state,
|
def_pattern_state,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue