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

Make the actual read happen in UB tests #102

Merged
merged 1 commit into from
Oct 14, 2024
Merged

Conversation

Manishearth
Copy link
Owner

let _ = ... is a wildcard binding and as such may not perform a read (I'm not 100% sure on the internal semantics here, but using an actual binding avoids the question)

@@ -909,7 +909,7 @@ mod tests {
uninit.as_mut_slice()[0].write(String::from("nonononono"));

// Read invalidated reference to trigger UB
let _ = *x;
let _read = &*x;
Copy link
Owner Author

Choose a reason for hiding this comment

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

@GnomedDev x here is unsized, which is why the & was necessary

@Manishearth Manishearth merged commit 3a829a4 into master Oct 14, 2024
13 checks passed
@Manishearth Manishearth deleted the ub-test-wildcard branch October 14, 2024 16:20
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.

1 participant