about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/const_eval/eval_queries.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-23 13:19:04 +0000
committerbors <bors@rust-lang.org>2021-01-23 13:19:04 +0000
commit4d0dd02ee07bddad9136f95c9f7846ebf3eb3fc5 (patch)
treed7dffe3cb02e26fea21f7a2bc494de2bca7382cb /compiler/rustc_mir/src/const_eval/eval_queries.rs
parent4153fa82ff8403bde877b52d35bf1ef99e54a4a2 (diff)
parentccaabc9479c5627c38aa3a693f765a400b92e32d (diff)
downloadrust-4d0dd02ee07bddad9136f95c9f7846ebf3eb3fc5.tar.gz
rust-4d0dd02ee07bddad9136f95c9f7846ebf3eb3fc5.zip
Auto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk
avoid promoting division, modulo and indexing operations that could fail

For division, `x / y` will still be promoted if `y` is a non-zero integer literal; however, `1/(1+1)` will not be promoted any more.

While at it, also see if we can reject promoting floating-point arithmetic (which are [complicated](https://github.com/rust-lang/unsafe-code-guidelines/issues/237) so maybe we should not promote them).

This will need a crater run to see if there's code out there that relies on these things being promoted.

If we can land this, promoteds in `fn`/`const fn` cannot fail to evaluate any more, which should let us do some simplifications in codegen/Miri!

Cc https://github.com/rust-lang/rfcs/pull/3027
Fixes https://github.com/rust-lang/rust/issues/61821
r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_mir/src/const_eval/eval_queries.rs')
0 files changed, 0 insertions, 0 deletions