未验证 提交 85277ff7 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

Rollup merge of #67531 - RalfJung:tame-promotion, r=nikomatsakis

no longer promote non-pattern const functions

This is trying to pack-pedal a bit on promotion feature creep, as proposed by @EddyB [here](https://github.com/rust-lang/const-eval/issues/19#issuecomment-472799062): possibly, a sane subset of `const fn` that we could promote are those that are just constructors -- the same subset that we might want to allow in pattern position at some point.

So, this removes the `rustc_promotable` attribute from the three functions they identified that do not fit this pattern. The first step is to run crater to see if there is code in the wild that relies on this being promotable.

r? @oli-obk
......@@ -172,7 +172,6 @@ pub const fn from_secs(secs: u64) -> Duration {
/// ```
#[stable(feature = "duration", since = "1.3.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_millis(millis: u64) -> Duration {
Duration {
......@@ -195,7 +194,6 @@ pub const fn from_millis(millis: u64) -> Duration {
/// ```
#[stable(feature = "duration_from_micros", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_micros(micros: u64) -> Duration {
Duration {
......@@ -218,7 +216,6 @@ pub const fn from_micros(micros: u64) -> Duration {
/// ```
#[stable(feature = "duration_extras", since = "1.27.0")]
#[inline]
#[rustc_promotable]
#[rustc_const_stable(feature = "duration_consts", since = "1.32.0")]
pub const fn from_nanos(nanos: u64) -> Duration {
Duration {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册