You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fizzbuzz_loop n =
loop (i =1) ->if i %3==0and i %5==0thenprint"FizzBuzz"elseif i %3==0thenprint"Fizz"elseif i %5==0thenprint"Buzz"elseprint i
if i == n then()else
recur (i +1)
fizzbuzz_loop 30
Fails with:
⮞ env RUST_BACKTRACE=1 ante fizzbuzz.an
thread 'main' panicked at src/hir/monomorphisation.rs:826:17:
internal error: entered unreachable code: Cannot monomorphise from a TraitDefinition.
No cached impl for '%' 39: (I32 - I32 -> I32 can 600)
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: ante::hir::monomorphisation::Context::monomorphise_definition_id
3: ante::hir::monomorphisation::Context::monomorphise
4: ante::hir::monomorphisation::Context::monomorphise_call
5: ante::hir::monomorphisation::Context::monomorphise_call
6: ante::hir::monomorphisation::Context::monomorphise
7: ante::hir::monomorphisation::Context::monomorphise
8: ante::hir::monomorphisation::Context::monomorphise
9: ante::hir::monomorphisation::Context::monomorphise
10: ante::hir::monomorphisation::Context::monomorphise_definition_id
11: ante::hir::monomorphisation::Context::monomorphise
12: ante::hir::monomorphisation::Context::monomorphise_call
13: ante::hir::monomorphisation::Context::monomorphise
14: ante::hir::monomorphisation::Context::monomorphise
15: ante::hir::monomorphisation::Context::monomorphise
16: ante::hir::monomorphisation::Context::monomorphise_definition_id
17: ante::hir::monomorphisation::Context::monomorphise
18: ante::hir::monomorphisation::Context::monomorphise_call
19: ante::hir::monomorphisation::Context::monomorphise
20: ante::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fish: Job 1, 'env RUST_BACKTRACE=1 ante fizzb…' terminated by signal SIGABRT (Abort)
The text was updated successfully, but these errors were encountered:
Looks like it failed to find the monomorphized trait impl. Odd, I'd think you'd need a more complex example to trigger this bug. Thanks for the issue, I'll take a look.
Also - in case you or anyone else reading is looking for a workaround using explicit, non-polymorphic types for fizzbuzz_loop will fix the bug:
fizzbuzz_loop (n:U32) =
loop (i =1) ->if i %3==0and i %5==0thenprint"FizzBuzz"elseif i %3==0thenprint"Fizz"elseif i %5==0thenprint"Buzz"elseprint i
if i != n then
recur (i +1)
fizzbuzz_loop 30
The code:
Fails with:
The text was updated successfully, but these errors were encountered: