diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 689cf319bd750..9cf42eff219ba 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -474,7 +474,7 @@ impl Cell { /// ``` #[inline] #[stable(feature = "cell_as_ptr", since = "1.12.0")] - pub fn as_ptr(&self) -> *mut T { + pub const fn as_ptr(&self) -> *mut T { self.value.get() } @@ -1508,7 +1508,7 @@ impl UnsafeCell { /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn get(&self) -> *mut T { + pub const fn get(&self) -> *mut T { &self.value as *const T as *mut T } } diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index 64a17786b0a6b..35181afea3da6 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -903,7 +903,7 @@ impl char { /// ``` #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] #[inline] - pub fn is_ascii(&self) -> bool { + pub const fn is_ascii(&self) -> bool { *self as u32 <= 0x7F } diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index b900990d0a726..dbc28ef7cf6a9 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -104,7 +104,6 @@ /// assert_eq!(vec![1, 3], filtered); /// ``` #[unstable(feature = "convert_id", issue = "53500")] -#[rustc_const_unstable(feature = "const_convert_id")] #[inline] pub const fn identity(x: T) -> T { x } diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index d500cc99fa13c..7fa3a4bcce7bb 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -283,7 +283,7 @@ impl Default for Empty { /// assert_eq!(None, nope.next()); /// ``` #[stable(feature = "iter_empty", since = "1.2.0")] -pub fn empty() -> Empty { +pub const fn empty() -> Empty { Empty(marker::PhantomData) } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index c69d4441121ce..6cf6417974a0d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -82,7 +82,6 @@ #![feature(const_fn)] #![feature(const_int_ops)] #![feature(const_fn_union)] -#![feature(const_manually_drop_new)] #![feature(custom_attribute)] #![feature(doc_cfg)] #![feature(doc_spotlight)] diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 8c4ff02aa140f..d4b7094d6fb64 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -942,7 +942,6 @@ impl ManuallyDrop { /// ManuallyDrop::new(Box::new(())); /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] - #[rustc_const_unstable(feature = "const_manually_drop_new")] #[inline] pub const fn new(value: T) -> ManuallyDrop { ManuallyDrop { value } @@ -961,7 +960,7 @@ impl ManuallyDrop { /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] #[inline] - pub fn into_inner(slot: ManuallyDrop) -> T { + pub const fn into_inner(slot: ManuallyDrop) -> T { slot.value } diff --git a/src/libcore/num/flt2dec/estimator.rs b/src/libcore/num/flt2dec/estimator.rs index d42e05a91f140..4e33fcfd76e61 100644 --- a/src/libcore/num/flt2dec/estimator.rs +++ b/src/libcore/num/flt2dec/estimator.rs @@ -22,4 +22,3 @@ pub fn estimate_scaling_factor(mant: u64, exp: i16) -> i16 { // therefore this always underestimates (or is exact), but not much. (((nbits + exp as i64) * 1292913986) >> 32) as i16 } - diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index 21a2e72dac8c3..d58015beecb1e 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -658,4 +658,3 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T, } } } - diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 1c826c2fa76bd..00134a58d30f1 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -387,7 +387,7 @@ assert_eq!(n.count_ones(), 3); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn count_ones(self) -> u32 { + pub const fn count_ones(self) -> u32 { self.0.count_ones() } } @@ -407,7 +407,7 @@ assert_eq!(Wrapping(!0", stringify!($t), ").count_zeros(), 0); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn count_zeros(self) -> u32 { + pub const fn count_zeros(self) -> u32 { self.0.count_zeros() } } @@ -430,7 +430,7 @@ assert_eq!(n.trailing_zeros(), 3); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn trailing_zeros(self) -> u32 { + pub const fn trailing_zeros(self) -> u32 { self.0.trailing_zeros() } } @@ -456,7 +456,7 @@ assert_eq!(n.trailing_zeros(), 3); /// ``` #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn rotate_left(self, n: u32) -> Self { + pub const fn rotate_left(self, n: u32) -> Self { Wrapping(self.0.rotate_left(n)) } @@ -481,7 +481,7 @@ assert_eq!(n.trailing_zeros(), 3); /// ``` #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn rotate_right(self, n: u32) -> Self { + pub const fn rotate_right(self, n: u32) -> Self { Wrapping(self.0.rotate_right(n)) } @@ -505,7 +505,7 @@ assert_eq!(n.trailing_zeros(), 3); /// ``` #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn swap_bytes(self) -> Self { + pub const fn swap_bytes(self) -> Self { Wrapping(self.0.swap_bytes()) } @@ -532,7 +532,7 @@ assert_eq!(n.trailing_zeros(), 3); /// ``` #[unstable(feature = "reverse_bits", issue = "48763")] #[inline] - pub fn reverse_bits(self) -> Self { + pub const fn reverse_bits(self) -> Self { Wrapping(self.0.reverse_bits()) } @@ -560,7 +560,7 @@ if cfg!(target_endian = \"big\") { ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn from_be(x: Self) -> Self { + pub const fn from_be(x: Self) -> Self { Wrapping(<$t>::from_be(x.0)) } } @@ -589,7 +589,7 @@ if cfg!(target_endian = \"little\") { ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn from_le(x: Self) -> Self { + pub const fn from_le(x: Self) -> Self { Wrapping(<$t>::from_le(x.0)) } } @@ -618,7 +618,7 @@ if cfg!(target_endian = \"big\") { ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn to_be(self) -> Self { + pub const fn to_be(self) -> Self { Wrapping(self.0.to_be()) } } @@ -647,7 +647,7 @@ if cfg!(target_endian = \"little\") { ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn to_le(self) -> Self { + pub const fn to_le(self) -> Self { Wrapping(self.0.to_le()) } } @@ -707,7 +707,7 @@ assert_eq!(n.leading_zeros(), 3); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn leading_zeros(self) -> u32 { + pub const fn leading_zeros(self) -> u32 { self.0.leading_zeros() } } @@ -784,7 +784,7 @@ assert!(!Wrapping(-10", stringify!($t), ").is_positive()); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn is_positive(self) -> bool { + pub const fn is_positive(self) -> bool { self.0.is_positive() } } @@ -806,7 +806,7 @@ assert!(!Wrapping(10", stringify!($t), ").is_negative()); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn is_negative(self) -> bool { + pub const fn is_negative(self) -> bool { self.0.is_negative() } } @@ -836,7 +836,7 @@ assert_eq!(n.leading_zeros(), 2); ```"), #[inline] #[unstable(feature = "wrapping_int_impl", issue = "32463")] - pub fn leading_zeros(self) -> u32 { + pub const fn leading_zeros(self) -> u32 { self.0.leading_zeros() } } diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 6cfb1005325ba..908490e1c839e 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -416,7 +416,7 @@ impl RangeInclusive { /// ``` #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] - pub fn start(&self) -> &Idx { + pub const fn start(&self) -> &Idx { &self.start } @@ -440,7 +440,7 @@ impl RangeInclusive { /// ``` #[stable(feature = "inclusive_range_methods", since = "1.27.0")] #[inline] - pub fn end(&self) -> &Idx { + pub const fn end(&self) -> &Idx { &self.end } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 827e297c84d1f..a7bfc3f512447 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -2905,7 +2905,7 @@ impl NonNull { /// Acquires the underlying `*mut` pointer. #[stable(feature = "nonnull", since = "1.25.0")] #[inline] - pub fn as_ptr(self) -> *mut T { + pub const fn as_ptr(self) -> *mut T { self.pointer.0 as *mut T } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 8a6b212020b4e..fece328f51f47 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -385,7 +385,6 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - #[rustc_const_unstable(feature = "const_slice_as_ptr")] pub const fn as_ptr(&self) -> *const T { self as *const [T] as *const T } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index a2782dd8e2e43..e710cbffe4d35 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2277,7 +2277,6 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] - #[rustc_const_unstable(feature = "const_str_as_ptr")] pub const fn as_ptr(&self) -> *const u8 { self as *const str as *const u8 } diff --git a/src/libcore/time.rs b/src/libcore/time.rs index cfbd431aef0a0..938e97503deb6 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -209,7 +209,6 @@ impl Duration { /// /// [`subsec_nanos`]: #method.subsec_nanos #[stable(feature = "duration", since = "1.3.0")] - #[rustc_const_unstable(feature="duration_getters")] #[inline] pub const fn as_secs(&self) -> u64 { self.secs } @@ -229,7 +228,6 @@ impl Duration { /// assert_eq!(duration.subsec_millis(), 432); /// ``` #[stable(feature = "duration_extras", since = "1.27.0")] - #[rustc_const_unstable(feature="duration_getters")] #[inline] pub const fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI } @@ -249,7 +247,6 @@ impl Duration { /// assert_eq!(duration.subsec_micros(), 234_567); /// ``` #[stable(feature = "duration_extras", since = "1.27.0")] - #[rustc_const_unstable(feature="duration_getters")] #[inline] pub const fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO } @@ -269,7 +266,6 @@ impl Duration { /// assert_eq!(duration.subsec_nanos(), 10_000_000); /// ``` #[stable(feature = "duration", since = "1.3.0")] - #[rustc_const_unstable(feature="duration_getters")] #[inline] pub const fn subsec_nanos(&self) -> u32 { self.nanos } @@ -286,7 +282,7 @@ impl Duration { /// ``` #[unstable(feature = "duration_as_u128", issue = "50202")] #[inline] - pub fn as_millis(&self) -> u128 { + pub const fn as_millis(&self) -> u128 { self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128 } @@ -303,7 +299,7 @@ impl Duration { /// ``` #[unstable(feature = "duration_as_u128", issue = "50202")] #[inline] - pub fn as_micros(&self) -> u128 { + pub const fn as_micros(&self) -> u128 { self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128 } @@ -320,7 +316,7 @@ impl Duration { /// ``` #[unstable(feature = "duration_as_u128", issue = "50202")] #[inline] - pub fn as_nanos(&self) -> u128 { + pub const fn as_nanos(&self) -> u128 { self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128 } @@ -478,7 +474,7 @@ impl Duration { /// ``` #[unstable(feature = "duration_float", issue = "54361")] #[inline] - pub fn as_float_secs(&self) -> f64 { + pub const fn as_float_secs(&self) -> f64 { (self.secs as f64) + (self.nanos as f64) / (NANOS_PER_SEC as f64) } diff --git a/src/libcore/unicode/tables.rs b/src/libcore/unicode/tables.rs index 3de855ac94315..e525c0574002b 100644 --- a/src/libcore/unicode/tables.rs +++ b/src/libcore/unicode/tables.rs @@ -2598,4 +2598,3 @@ pub mod conversions { ]; } - diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 87ffe0f15e454..66718b95408ca 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1091,7 +1091,7 @@ impl CStr { /// [`CString`]: struct.CString.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub fn as_ptr(&self) -> *const c_char { + pub const fn as_ptr(&self) -> *const c_char { self.inner.as_ptr() } diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index d45a66ef66532..2517c45696a2d 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -424,7 +424,7 @@ impl Ipv4Addr { /// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_unspecified(), false); /// ``` #[stable(feature = "ip_shared", since = "1.12.0")] - pub fn is_unspecified(&self) -> bool { + pub const fn is_unspecified(&self) -> bool { self.inner.s_addr == 0 } @@ -862,7 +862,6 @@ impl Ipv6Addr { /// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_ip")] pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Ipv6Addr { Ipv6Addr { @@ -1224,7 +1223,7 @@ impl Ipv6Addr { /// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); /// ``` #[stable(feature = "ipv6_to_octets", since = "1.12.0")] - pub fn octets(&self) -> [u8; 16] { + pub const fn octets(&self) -> [u8; 16] { self.inner.s6_addr } } diff --git a/src/test/ui/consts/const-eval/duration_conversion.rs b/src/test/ui/consts/const-eval/duration_conversion.rs index 4481b75840487..c8bed4a2b77e1 100644 --- a/src/test/ui/consts/const-eval/duration_conversion.rs +++ b/src/test/ui/consts/const-eval/duration_conversion.rs @@ -10,8 +10,6 @@ // compile-pass -#![feature(duration_getters)] - use std::time::Duration; fn main() { diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs index d6ffca09e96d8..4136a7b6a724f 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs @@ -23,13 +23,16 @@ unsafe impl Sync for Foo {} static FOO: Foo = Foo(UnsafeCell::new(42)); +fn foo() {} + static BAR: () = unsafe { *FOO.0.get() = 5; - //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants - + //~^ ERROR statements in statics are unstable (see issue #48821) // This error is caused by a separate bug that the feature gate error is reported // even though the feature gate "const_let" is active. - //~| statements in statics are unstable (see issue #48821) + + foo(); + //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants }; fn main() { diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr index 8eaed1dcab116..c2bba27e4d1e2 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr @@ -1,17 +1,17 @@ -error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/mod-static-with-const-fn.rs:27:6 - | -LL | *FOO.0.get() = 5; - | ^^^^^^^^^^^ - error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/mod-static-with-const-fn.rs:27:5 + --> $DIR/mod-static-with-const-fn.rs:29:5 | LL | *FOO.0.get() = 5; | ^^^^^^^^^^^^^^^^ | = help: add #![feature(const_let)] to the crate attributes to enable +error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants + --> $DIR/mod-static-with-const-fn.rs:34:5 + | +LL | foo(); + | ^^^^^ + error: aborting due to 2 previous errors Some errors occurred: E0015, E0658. diff --git a/src/test/ui/consts/std/cell.rs b/src/test/ui/consts/std/cell.rs new file mode 100644 index 0000000000000..cf6c0f2379d1e --- /dev/null +++ b/src/test/ui/consts/std/cell.rs @@ -0,0 +1,30 @@ +use std::cell::*; + +// not ok, because this would create a silent constant with interior mutability. +// the rules could be relaxed in the future +static FOO: Wrap<*mut u32> = Wrap(Cell::new(42).as_ptr()); +//~^ ERROR cannot borrow a constant which may contain interior mutability + +static FOO3: Wrap> = Wrap(Cell::new(42)); +// ok +static FOO4: Wrap<*mut u32> = Wrap(FOO3.0.as_ptr()); + +// not ok, because the `as_ptr` call takes a reference to a type with interior mutability +// which is not allowed in constants +const FOO2: *mut u32 = Cell::new(42).as_ptr(); +//~^ ERROR cannot borrow a constant which may contain interior mutability + +struct IMSafeTrustMe(UnsafeCell); +unsafe impl Send for IMSafeTrustMe {} +unsafe impl Sync for IMSafeTrustMe {} + +static BAR: IMSafeTrustMe = IMSafeTrustMe(UnsafeCell::new(5)); + + +struct Wrap(T); +unsafe impl Send for Wrap {} +unsafe impl Sync for Wrap {} + +static BAR_PTR: Wrap<*mut u32> = Wrap(BAR.0.get()); + +fn main() {} diff --git a/src/test/ui/consts/std/cell.stderr b/src/test/ui/consts/std/cell.stderr new file mode 100644 index 0000000000000..f75aadff6d5ea --- /dev/null +++ b/src/test/ui/consts/std/cell.stderr @@ -0,0 +1,15 @@ +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/cell.rs:5:35 + | +LL | static FOO: Wrap<*mut u32> = Wrap(Cell::new(42).as_ptr()); + | ^^^^^^^^^^^^^ + +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/cell.rs:14:24 + | +LL | const FOO2: *mut u32 = Cell::new(42).as_ptr(); + | ^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0492`. diff --git a/src/test/ui/consts/std/char.rs b/src/test/ui/consts/std/char.rs new file mode 100644 index 0000000000000..fe79059a2e497 --- /dev/null +++ b/src/test/ui/consts/std/char.rs @@ -0,0 +1,9 @@ +// run-pass + +static X: bool = 'a'.is_ascii(); +static Y: bool = 'รค'.is_ascii(); + +fn main() { + assert!(X); + assert!(!Y); +} diff --git a/src/test/ui/consts/std/iter.rs b/src/test/ui/consts/std/iter.rs new file mode 100644 index 0000000000000..e9af781eb2b8d --- /dev/null +++ b/src/test/ui/consts/std/iter.rs @@ -0,0 +1,9 @@ +// run-pass + +const I: std::iter::Empty = std::iter::empty(); + +fn main() { + for i in I { + panic!("magical value creation: {}", i); + } +} diff --git a/src/test/ui/consts/std/slice.rs b/src/test/ui/consts/std/slice.rs new file mode 100644 index 0000000000000..ad38105b6aa0e --- /dev/null +++ b/src/test/ui/consts/std/slice.rs @@ -0,0 +1,10 @@ +// compile-pass + +struct Wrap(T); +unsafe impl Send for Wrap {} +unsafe impl Sync for Wrap {} + +static FOO: Wrap<*const u32> = Wrap([42, 44, 46].as_ptr()); +static BAR: Wrap<*const u8> = Wrap("hello".as_ptr()); + +fn main() {} diff --git a/src/test/ui/rfc-2306/convert-id-const-no-gate.rs b/src/test/ui/rfc-2306/convert-id-const-no-gate.rs deleted file mode 100644 index 545c179dec9fc..0000000000000 --- a/src/test/ui/rfc-2306/convert-id-const-no-gate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This test should fail since identity is not stable as a const fn yet. - -#![feature(convert_id)] - -fn main() { - const _FOO: u8 = ::std::convert::identity(42u8); -} diff --git a/src/test/ui/rfc-2306/convert-id-const-no-gate.stderr b/src/test/ui/rfc-2306/convert-id-const-no-gate.stderr deleted file mode 100644 index dfd8619d87516..0000000000000 --- a/src/test/ui/rfc-2306/convert-id-const-no-gate.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: `std::convert::identity` is not yet stable as a const fn - --> $DIR/convert-id-const-no-gate.rs:16:22 - | -LL | const _FOO: u8 = ::std::convert::identity(42u8); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: in Nightly builds, add `#![feature(const_convert_id)]` to the crate attributes to enable - -error: aborting due to previous error - diff --git a/src/test/ui/rfc-2306/convert-id-const-with-gate.rs b/src/test/ui/rfc-2306/convert-id-const-with-gate.rs index c546f11914f81..2e71aee57c2f1 100644 --- a/src/test/ui/rfc-2306/convert-id-const-with-gate.rs +++ b/src/test/ui/rfc-2306/convert-id-const-with-gate.rs @@ -8,12 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This test should pass since we've opted into 'identity' as an -// unstable const fn. +// This test should pass since 'identity' is const fn. // compile-pass -#![feature(convert_id, const_convert_id)] +#![feature(convert_id)] fn main() { const _FOO: u8 = ::std::convert::identity(42u8);