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

Validation update #297

Merged
merged 8 commits into from
Aug 10, 2017
Merged

Validation update #297

merged 8 commits into from
Aug 10, 2017

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 9, 2017

Turns out RangeMap was broken so validation didn't actually do anything. This fixes range map, and then fixes validation. Mostly. There are some tests for RangeMap now, and some tests making sure validation catches the most blatant errors. I will write more compile-fail tests.

Fixes #290

Turns out that tracking write locks by their lifetime is not precise enough,
but for now, we don't have an alternative.  Also, we need to force_allocate
what we acquire or else the memory will not be in the right state.
This is not complete yet, but it is enough to make unsized-tuple-impls work.
@RalfJung
Copy link
Member Author

Actually, I just added more tests into this one.


fn main() {
let mut array = [1,2,3,4];
let _x = safe::split_at_mut(&mut array, 0); //~ ERROR: in conflict with lock WriteLock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ this test so much (actually the fact that it is failing)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) It came up when someone on reddit asked whether we could catch this, and I was like "thanks for the question -- this is a perfect sample for our test suite, once we finally have one".

@oli-obk oli-obk merged commit 85fd3f8 into rust-lang:master Aug 10, 2017
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.

Add unit tests for RangeMap
2 participants