c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

Renamed infos for clarity, consistency, and succinctness

Open kkysen opened this issue 3 years ago • 4 comments

Renamed infos for clarity, consistency, and succinctness. Specifically,

  • mut renamed to store to match load
  • non_unique renamed to alias, as this more closely follows Rust's terminology for aliasing, and is also more succinct

kkysen avatar Aug 10 '22 07:08 kkysen

store/load changes look good. But I think I prefer non_unique over alias, due to the connection to c2rust-analyze's PermissionSet::UNIQUE flag.

spernsteiner avatar Aug 10 '22 18:08 spernsteiner

Isn't aliases the opposite of unique? I much prefer alias because it's shorter, it's a verb like the others, and it's saying what it does, not what it doesn't.

kkysen avatar Aug 10 '22 20:08 kkysen

You can have references that alias (in that they point to the same memory location) but are still unique / &mut. For example:

let x: &mut i32 = ...;
let y = &mut *x;
f(y);
f(x);

y aliases x and has overlapping lifetime, but both can still be &mut, since the compiler can statically track the relationship between the two.

spernsteiner avatar Aug 10 '22 21:08 spernsteiner

If they alias, then they are not unique, by the common definitions of those words. I think in the Rust sense, it's understood that you can't actively use mutably aliased references or pointers in that the uniqueness or aliasing property is determined at use time. Unique and alias are pretty antonyms to me, so I don't think there's any incompatibility between them. The issue you highlighted above is just as much a problem for calling things unique. And alias is quite common terminology used in Rust, so I think it makes a lot of sense to use as an antonym to unique, in the aliased xor mutable (unique) sense.

kkysen avatar Aug 11 '22 22:08 kkysen