EmbarkStudios / rust-gpu

🐉 Making Rust a first-class language and ecosystem for GPU shaders 🚧

Home Page:https://shader.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spurious "checked add" errors from `false` constants, since `nightly-2023-03-04`.

eddyb opened this issue · comments

In this most recent nightly update:

We were hit by the fact that e.g. <u32 as Add>::add now invokes checked_binop(Add) (i.e. the codegen backend equivalent of u32::overflowing_add), ignoring the bool "did it overflow?" flag only in the MIR Assert for overflow checks.

The fix seemed to work, but it's fundamentally flawed because of using Add (or Sub or Mul) and the constant false anywhere in the same crate (well, codegen unit to be more precise, so this is a bit tricky to trigger), will cause the OpConstantFalse instruction used by both to be annotated with the checked add is not supported yet.

cc @Shfty (who ran into this in their project, that also triggered #1021, after switching to Rust-GPU main)