You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for working on and releasing Aquascope, I think it's going to have a massive impact on Rust pedagogy.
I was trying it out to see if it could help my students understand one of their most common errors where they attempt to return a mutable reference from an immutable one, and while the information is technically displayed it's not necessarily easy to understand it.
Here's the test program I used:
fn omg<T>(x : & T) -> &mut T {
&mut x
}
fn main() {
omg(&mut 5);
}
Aquascope shows (also has a trace which is uninformative here):
The permissions show that *x only has +R, but there's no display showing we want a &mut T (and thus need +R +W +O).
Perhaps one of those permissions boxes could be shown for the result when there's a borrow check error?
The text was updated successfully, but these errors were encountered:
Thank you for trying out the tool, we hope your students find it useful!
If I understand your request correctly, it can be summed up as: "in the function omg we can see that *x gains read permission, but there isn't something that directly says we need write permission".
I would argue that this feature is available. In the following screenshot, I've hovered over those two colored dots on line 2 to the left of x.
This represents a permission expectation, saying that in order to take a unique reference, we need both read and write permissions. However, the blue W is hollow showing that this permission is missing. Thus symbolizing a permission violation, in this case, promoting a shared reference to a unique reference.
If you're demonstrating this with the online playground, at the moment you'd have to hover the cursor over the dots to expand them to the appropriate characters (they are also color-coded). If you tried your hand at embedding this into mdBook, you can make the characters expanded by default with a `{boundaries}` annotation on line 2. Which combined would look like this:
```aquascope,interpreter+permissions,boundaries,stepper,shouldFail
fn omg(x : & T) -> &mut T {
&mut x `{boundaries}`
}
fn main() {
omg(&mut 5);
}```
Note that we don't currently guarantee any stability on the mdBook interface.
Please let us know if this still doesn't capture the feature you're looking for.
Oh I didn't think of doing that, it's not obvious from the interface alone that there is an error, perhaps this info could be highlighted or otherwise identified to show that there's an error?
First, thanks for working on and releasing Aquascope, I think it's going to have a massive impact on Rust pedagogy.
I was trying it out to see if it could help my students understand one of their most common errors where they attempt to return a mutable reference from an immutable one, and while the information is technically displayed it's not necessarily easy to understand it.
Here's the test program I used:
Aquascope shows (also has a trace which is uninformative here):
The permissions show that
*x
only has+R
, but there's no display showing we want a&mut T
(and thus need+R +W +O
).Perhaps one of those permissions boxes could be shown for the result when there's a borrow check error?
The text was updated successfully, but these errors were encountered: