diff --git a/compiler/can/src/expr.rs b/compiler/can/src/expr.rs index 4af31a09d0..938f7ba941 100644 --- a/compiler/can/src/expr.rs +++ b/compiler/can/src/expr.rs @@ -737,57 +737,6 @@ fn canonicalize_when_branch<'a>( ) } -/* -fn canonicalize_when_branch<'a>( - env: &mut Env<'a>, - var_store: &VarStore, - scope: &Scope, - region: Region, - loc_pattern: &Located>, - loc_expr: &'a Located>, - output: &mut Output, -) -> (Located, Located, References) { - // Each case branch gets a new scope for canonicalization. - // Shadow `scope` to make sure we don't accidentally use the original one for the - // rest of this block, but keep the original around for later diffing. - let original_scope = scope; - let mut scope = original_scope.clone(); - - let loc_can_pattern = canonicalize_pattern( - env, - var_store, - &mut scope, - WhenBranch, - &loc_pattern.value, - loc_pattern.region, - ); - - let (can_expr, branch_output) = - canonicalize_expr(env, var_store, &mut scope, region, &loc_expr.value); - - // If we already recorded a tail call then keep it, else use this branch's tail call - match output.tail_call { - Some(_) => {} - None => output.tail_call = branch_output.tail_call, - }; - - // Now that we've collected all the references for this branch, check to see if - // any of the new idents it defined were unused. If any were, report it. - for (symbol, region) in scope.symbols() { - let symbol = *symbol; - - if !output.references.has_lookup(symbol) - && !branch_output.references.has_lookup(symbol) - && !original_scope.contains_symbol(symbol) - { - env.problem(Problem::UnusedDef(symbol, *region)); - } - } - - (loc_can_pattern, can_expr, branch_output.references) -} -*/ - pub fn local_successors<'a>( references: &'a References, closures: &'a MutMap, diff --git a/compiler/mono/src/expr.rs b/compiler/mono/src/expr.rs index 75da1b2f0e..7e54758e52 100644 --- a/compiler/mono/src/expr.rs +++ b/compiler/mono/src/expr.rs @@ -1031,8 +1031,6 @@ fn from_can_when<'a>( for when_branch in branches { let mono_expr = from_can(env, when_branch.value.value, procs, None); - // let mono_patterns = Vec::with_capacity_in(when_branch.patterns.len(), env.arena); - for loc_pattern in when_branch.patterns { let mono_pattern = from_can_pattern(env, &loc_pattern.value); diff --git a/compiler/mono/src/layout.rs b/compiler/mono/src/layout.rs index cdef2d5a36..939062c832 100644 --- a/compiler/mono/src/layout.rs +++ b/compiler/mono/src/layout.rs @@ -95,8 +95,8 @@ impl<'a> Layout<'a> { true } Pointer(_) => { - // TODO is this accurate? - true + // We cannot memcpy pointers, because then we would have the same pointer in multiple places! + false } } }