top | item 33192008

(no title)

philberty | 3 years ago

This is true, I tried to make gccrs only have the AST and go from that stright to GCC GENERIC. This had a lot of problems for Rust in my opinion.

Many things in Rust are syntactic sugar and can be handled by desugaring the AST into another IR so you dont even have to think about it in other passes. The main issue for me is how complicate the type inference is.

So if i wanted to use GCC GENERIC for type resolution for this example:

``` let a; a = 123; let b:u32 = 1; a += b; ```

How do you resolve the type of 'a' you must use inference variables and then update the TREE_TYPE as you go so this means walking the tree's over and over again as type information is gathered over time on the inference variable. Using a separate IR and using id's and side tables makes all of this much much more simple for Rust.

discuss

order

b3morales|3 years ago

Thanks for sharing those details!