Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed infos for clarity, consistency, and succinctness #597

Open
wants to merge 17 commits into
base: pfb/extra-info
Choose a base branch
from

Conversation

kkysen
Copy link
Contributor

@kkysen kkysen commented Aug 10, 2022

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 kkysen force-pushed the kkysen/pfb/extra-info/renames branch from 3b5d06c to f547ea3 Compare August 10, 2022 08:03
@spernsteiner
Copy link
Contributor

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.

@kkysen
Copy link
Contributor Author

kkysen commented Aug 10, 2022

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.

@spernsteiner
Copy link
Contributor

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.

@kkysen
Copy link
Contributor Author

kkysen commented Aug 11, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants