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

Add clear indication for path liveness and permissions changes #85

Open
gavinleroy opened this issue May 21, 2023 · 1 comment
Open

Comments

@gavinleroy
Copy link
Collaborator

Aquascope shows how permissions change to help users understand why a particular permission may be missing. Per path, these changes are described as a gain or loss in permissions. Additionally, we use a single icon to indicate why these changes occurred, I'll refer to these icons as the change reason.

Screenshot 2023-05-21 at 11 38 46

In the above example, this table row tells the reader that the path s gained RWO permissions and the up arrow indicates that this was because the variable became live. However, showing a single icon has proven to be insufficient because, with liveness, multiple change reasons can exist. Consider line 3 in the below example:

Screenshot 2023-05-21 at 11 29 35

On line 3, the path s loses RWO permissions. A common question from readers is "hey, shouldn't s keep R permissions because the path is only borrowed immutably?" The answer is YES. A path borrowed immutably can still be read. The issue is that s is no longer used after line 3, it dies; however, because our visual indication only allows for a single icon this change in liveness is not called out to the reader.

The task here is to develop a system of indication that is flexible enough to convey multiple change reasons. The result should achieve the following goals: the visualization should remain clear, and cases where only one change reason exists should not become more confusing. In the past, we've experimented with showing multiple icons, and a dropdown list of icons, but both of these were insufficient as they violated the aforementioned goals.


The previous code for easy copy/pasting.

fn foo() {
  let mut s = String::from("");
  let b = &s;

  println!("{b}");
}
@willcrichton
Copy link
Collaborator

For example, one possibility could be to annotate individual permissions with their cause when multiple causes exist, like in this example:

R↓ W→ O→

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

No branches or pull requests

2 participants