Rust GCC backend: Why and how

30 points by dryya


T6

Let's show an example with this Rust function:

fn t(a: &i32) -> i32 {
    *a
}

The C equivalent looks like this:

int t(int *a) {
  if (!a) {
    return -1;
  }
  return *a;
}

...why? surely the equivalent C code would be

int t(int *a) {
    return *a;
}