Skip to content

mpz-memory: first check if allocated, then if set #265

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

Open
themighty1 opened this issue Mar 20, 2025 · 2 comments
Open

mpz-memory: first check if allocated, then if set #265

themighty1 opened this issue Mar 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@themighty1
Copy link
Collaborator

Currently the VisibilityView API allow this test to pass

#[test]
    fn test() {
        let mut view = VisibilityView::new();
        view.alloc(10);
        assert!(view.is_set(20..30));
    }

It obviously shouldn't pass since the range 20..30 was not allocated.

Is the caller responsible for passing only the ranges which were allocated or is this a bug that needs fixing @sinui0

@sinui0
Copy link
Collaborator

sinui0 commented Mar 26, 2025

yes, this should probably be regarded as a bug

@themighty1 themighty1 added the bug Something isn't working label Mar 27, 2025
@themighty1 themighty1 self-assigned this Mar 27, 2025
@themighty1
Copy link
Collaborator Author

Im realizing this requires a decision how to treat access to unallocated memory without adding an error to fn sig. We may also want to go back to using Slices instead of Ranges.
Was there a reason why we don't use Slices anymore for these APIs? @sinui0

@themighty1 themighty1 removed their assignment Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants