]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
authorMatthias Krüger <matthias.krueger@famsik.de>
Sat, 30 Oct 2021 12:36:58 +0000 (14:36 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Oct 2021 12:36:58 +0000 (14:36 +0200)
commit20bb93210d1ae4331f8c66efff67ef3e84bd66a2
tree0e9dcfc9026280f1a1921cb2bd55cebd4c9ce468
parent2b643e987173b36cb0279a018579372e31a35776
parent361c978fbd41535f3c7fd0b2f956d4e1ee4aeefd
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk

Make most std::ops traits const on numeric types

This PR makes existing implementations of `std::ops` traits (`Add`, `Sub`, etc) [`impl const`](https://github.com/rust-lang/rust/issues/67792) where possible.
This affects:
- All numeric primitives (`u*`, `i*`, `f*`)
- `NonZero*`
- `Wrapping`

This is under the `rustc_const_unstable` feature `const_ops`.
I will write tests once I know what can and can't be kept for the final version of this PR.

Since this is my first PR to rustc (and hopefully one of many), please give me feedback on how to better handle the PR process wherever possible. Thanks

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Const.20std.3A.3Aops.20traits.20PR)
library/core/src/lib.rs