Automatic detection of code that should be optimised away

Currently I am inspecting assembly output to check whether certain asserts have been optimised away by the compiler as expected, I was wondering if there was a neater way to do this, so I get some kind of automated warning when running cargo build. I don't think there is, but maybe I am missing something.

1 Like

Rust's codegen tests use CHECK: annotations that seem to be from LLVM's tool:

https://llvm.org/docs/CommandGuide/FileCheck.html

I don't know if it's feasible to use that in other projects.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.