On 10-09-19 02:45 AM, Peter Hull wrote:
Is pattern-alt the only way to select from tag types, ie. I tried this
code using if

tag tt { a(); b();}

fn main() {
   let tt t = a();
   if (t == a()) {
     log "equal";
   }
}

and got a compile error

Fatal error: exception Failure("forcing non-scalar referent of type
[b32,([]|[])] to register")

Yeah. This is a bug. At the moment comparisons in general only work between scalar types (int, uint, u8, char). Strings, records, tags, vectors are presently non-comparable. And not in a nice way: in a bug-thrown-by-compiler way.

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to