Skip to content

Emit a warning when Miri is used with optimizations #2814

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

Merged
merged 3 commits into from
Mar 18, 2023

Conversation

saethlin
Copy link
Member

@saethlin saethlin commented Mar 12, 2023

This may address #2797, by clarifying to the user what is going on and what the consequences of their choices are.

Fixes #2797

@oli-obk
Copy link
Contributor

oli-obk commented Mar 13, 2023

Should we also tell the user that this will not significantly improve the performance of running miri except in microbenchmarks?

@@ -43,7 +43,7 @@ function run_tests {
# optimizations up all the way, too).
# Optimizations change diagnostics (mostly backtraces), so we don't check
# them. Also error locations change so we don't run the failing tests.
MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
Copy link
Member

Choose a reason for hiding this comment

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

Why add the flag back here? I guess some tests rely on it? Please add a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. I considered doing something more clever, such cfg(not(debug_assertions)) on the test cases, but the tests pretty explicitly call debug_assert! so it seemed very circular.

@saethlin saethlin force-pushed the warn-on-optimization branch from e0863ef to a67fa85 Compare March 17, 2023 22:29
@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Mar 18, 2023

📌 Commit 25b401c has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 18, 2023

⌛ Testing commit 25b401c with merge 95c583c...

@bors
Copy link
Contributor

bors commented Mar 18, 2023

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 95c583c to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Mar 18, 2023

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 95c583c to master...

@bors bors merged commit 95c583c into rust-lang:master Mar 18, 2023
@saethlin saethlin deleted the warn-on-optimization branch May 19, 2023 14:47
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.

running miri in release mode should disable debug assertions
4 participants