-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Turn TrapUnreachable
off by default
#88826
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
Turn TrapUnreachable
off by default
#88826
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
|
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 4d545d9 with merge c95266130c4724381de0a769a741cf934583d48d... |
☀️ Try build successful - checks-actions |
Queued c95266130c4724381de0a769a741cf934583d48d with parent 7bf0736, future comparison URL. |
Finished benchmarking commit (c95266130c4724381de0a769a741cf934583d48d): comparison url. Summary: This change led to large relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. @bors rollup=never |
FWIW upstream is considering turning on TrapUnreachable or some variant thereof on by default, to at least prevent zero-size functions. I think a more conservative step we can take is to enable the NoTrapAfterNoreturn option, which probably is the form in which the vast majority of unreachable appears in rust code (basically after every panic), and also the one where it has little practical benefit. |
I don't know enough about the effects of this to review this properly. r? @nikic |
I think this should be revised to take the more conservative approach quoted here. Changing to S-waiting-on-author for that revision |
Ping from triage: |
Now that #28728 is fixed, there's no longer a risk of programs executing past the end of a function, so we don't have to put a trap instruction there anymore.
This should ever so slightly shrink the average Rust program.
(the second commit is a drive-by-fix that reverts an incorrect part of 62e7331, which made the
alloc-optimisation.rs
test fail with my system's LLVM)