Why does convert_int_to_bool convert?
Integer-to-boolean conversions treats 0 as false and all other bit-patterns as true
Why does it work this way, instead of doing trap_if(i >= 2) similar to what i32_to_char does?
(Aside: the names convert_int_to_bool and i32_to_char are a little inconsistent.)
Rust and many popular C and C++ ABIs use a convention of 0 meaning false and 1 meaning true, and could perform a no-op conversion of things like list<bool> into the source language if the Canonical ABI would guarantee that representation as well.
It's a good general question of whether to try to have the ABI trap as much as possible or, rather, check only what's necessary. Initially, I had the rules try to trap as much as possible, but in a few cases, this ended up rather complicating things so, to avoid being inconsistent, we changed our default to only trap when necessary. Note that, while lifting allows the incoming value to be greater than 1, lowering guarantees you a 0 or 1, so I think you should have no-op conversions of list<bool> in both directions.
And yeah, I suppose i32_to_char should get a verb before it like all the other verb_x_to_y functions. Fixed
The question has been answered!