diff options
author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2023-05-13 11:05:33 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-13 11:05:33 +0530 |
commit | 36125c43da00a2c57452e72c3cf81b71b13de208 (patch) | |
tree | e5e827d0c93f013603b704607f326606a53f4fd1 /tests/rustdoc-js-std/parser-errors.js | |
parent | 6cb13585d050ed9c708b3d03ab2797ab16a78218 (diff) | |
parent | 7c263adb2afc310b96422bd33317407bc5385bf9 (diff) | |
download | rust-36125c43da00a2c57452e72c3cf81b71b13de208.tar.gz |
Rollup merge of #111096 - AngelicosPhosphoros:overflow_checks_issue_91130, r=petrochenkov
Add support for `cfg(overflow_checks)`
This PR adds support for detecting if overflow checks are enabled in similar fashion as `debug_assertions` are detected. Possible use-case of this, for example, if we want to use checked integer casts in builds with overflow checks, e.g.
```rust
pub fn cast(val: usize)->u16 {
if cfg!(overflow_checks) {
val.try_into().unwrap()
}
else{
vas as _
}
}
```
Resolves #91130.
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions