Summary

Stabilize the -C overflow-checks command line argument.

引数

Motivation

This is an easy way to turn on overflow checks in release builds without otherwise

さもなければ
turning on debug assertions,
アサーション
via the -C debug-assertions flag. In stable Rust today you can't get one without the other.

Users can use the -C overflow-checks flag from their Cargo config to turn on overflow checks for an entire application.

This flag, which accepts

受け付ける、受理する
values of 'yes'/'no', 'on'/'off', is being renamed from force-overflow-checks because the force doesn't add anything that the 'yes'/'no'

Detailed design
設計(する)

This is a stabilization RFC. The only steps will be to move force-overflow-checks from -Z to -C, renaming it to overflow-checks, and making it stable.

Drawbacks

It's another rather ad-hoc flag for modifying code generation.

Like other such flags, this applies

適用する
to the entire code unit, regardless
〜に関わらず
of monomorphizations. This means that code generation for a single
単一の
function can be diferent based
基となる、基底(の)
on which code unit its instantiated in.

Alternatives

The flag could instead be tied to crates such that any time code from that crate is inlined/monomorphized it turns on overflow checks.

We might also want a design

設計(する)
that provides
与える
per-function control
制御する
over overflow checks.

Unresolved questions

Cargo might also add a profile option like

[profile.dev] overflow-checks = true

This may also be accomplished by Cargo's pending support for passing arbitrary

任意の
flags to rustc.