Why -Z "mir-opt-level=val" accept values above 4?

Nightly Rust support -Z 'mir-opt-level' option, as rustc -Z help said:

-Z  mir-opt-level=val -- MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)

But actually it set values above 4 (such as 5,10,100 ... ), I'm not sure it's intentional or a compiler bug? And what's that mean ..

I don't think it is a bug. There are more compilers that do this. For example gcc and clang allow -O1000.

1 Like

But rustc does not. Also, clang warns (-Wdeprecated)

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.