gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Different inference than rustc for integer

Open jdupak opened this issue 1 year ago • 1 comments

fn test_cast() {
    let i = 1;
    let j = i as i64;
}

rustc says that i is i32 and we say it is i64.

jdupak avatar Oct 13 '23 15:10 jdupak

Awh thats horrible .... :( i wonder can we get away with this one.

In theory it could be a simple fix though, by default we always append the reference chain for all unifications so in this case we are doing:

let i = 1; let j = i as i64; // > = <?I> as <?I64>

So i think the reference chain gets appended to the i64 and thus it gets infered that way... that's a nasty one

philberty avatar Dec 12 '23 13:12 philberty