From 1ff143191c62bc7cfa17da99dac59a871f39a462 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 24 Sep 2020 16:17:03 -0700 Subject: [PATCH 1/6] Add a feature gate for basic function pointer use in `const fn` --- compiler/rustc_feature/src/active.rs | 3 ++ .../src/transform/check_consts/ops.rs | 28 ++++++++++++++----- compiler/rustc_span/src/symbol.rs | 1 + library/core/src/lib.rs | 1 + library/core/src/task/wake.rs | 1 + library/proc_macro/src/lib.rs | 1 + library/std/src/lib.rs | 1 + 7 files changed, 29 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 17b9e1ee7e8..7f5b1913480 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -587,6 +587,9 @@ declare_features! ( /// Allows basic arithmetic on floating point types in a `const fn`. (active, const_fn_floating_point_arithmetic, "1.48.0", Some(57241), None), + /// Allows using and casting function pointers in a `const fn`. + (active, const_fn_fn_ptr_basics, "1.48.0", Some(57563), None), + // ------------------------------------------------------------------------- // feature-group-end: actual feature gates // ------------------------------------------------------------------------- diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs index 1d741085853..3b8d8a5aa99 100644 --- a/compiler/rustc_mir/src/transform/check_consts/ops.rs +++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs @@ -213,11 +213,21 @@ impl NonConstOp for FnPtrCast { const STOPS_CONST_CHECKING: bool = true; fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { - mcf_status_in_item(ccx) + if ccx.const_kind() != hir::ConstContext::ConstFn { + Status::Allowed + } else { + Status::Unstable(sym::const_fn_fn_ptr_basics) + } } fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) { - mcf_emit_error(ccx, span, "function pointer casts are not allowed in const fn"); + feature_err( + &ccx.tcx.sess.parse_sess, + sym::const_fn_fn_ptr_basics, + span, + &format!("function pointer casts are not allowed in {}s", ccx.const_kind()), + ) + .emit() } } @@ -596,17 +606,21 @@ pub mod ty { const STOPS_CONST_CHECKING: bool = true; fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { - // FIXME: This attribute a hack to allow the specialization of the `futures` API. See - // #59739. We should have a proper feature gate for this. - if ccx.tcx.has_attr(ccx.def_id.to_def_id(), sym::rustc_allow_const_fn_ptr) { + if ccx.const_kind() != hir::ConstContext::ConstFn { Status::Allowed } else { - mcf_status_in_item(ccx) + Status::Unstable(sym::const_fn_fn_ptr_basics) } } fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) { - mcf_emit_error(ccx, span, "function pointers in const fn are unstable"); + feature_err( + &ccx.tcx.sess.parse_sess, + sym::const_fn_fn_ptr_basics, + span, + &format!("function pointers cannot appear in {}s", ccx.const_kind()), + ) + .emit() } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 12134a85f45..7332a7ea331 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -353,6 +353,7 @@ symbols! { const_extern_fn, const_fn, const_fn_floating_point_arithmetic, + const_fn_fn_ptr_basics, const_fn_transmute, const_fn_union, const_generics, diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 30fb87b0226..22bf2b15d66 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -83,6 +83,7 @@ #![feature(const_fn_union)] #![feature(const_fn)] #![cfg_attr(not(bootstrap), feature(const_fn_floating_point_arithmetic))] +#![cfg_attr(not(bootstrap), feature(const_fn_fn_ptr_basics))] #![feature(const_generics)] #![feature(const_option)] #![feature(const_precise_live_drops)] diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 668a028a3f1..109dbfda105 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -136,6 +136,7 @@ impl RawWakerVTable { // (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062) #[rustc_allow_const_fn_ptr] #[rustc_const_stable(feature = "futures_api", since = "1.36.0")] + #[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_fn_ptr_basics))] pub const fn new( clone: unsafe fn(*const ()) -> RawWaker, wake: unsafe fn(*const ()), diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index f81ffd2bb94..93fa1f4e585 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -21,6 +21,7 @@ #![feature(nll)] #![feature(staged_api)] #![feature(const_fn)] +#![cfg_attr(not(bootstrap), feature(const_fn_fn_ptr_basics))] #![feature(allow_internal_unstable)] #![feature(decl_macro)] #![feature(extern_types)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index d03428dd082..e343eef9112 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -239,6 +239,7 @@ #![cfg_attr(not(bootstrap), feature(const_fn_floating_point_arithmetic))] #![feature(const_fn_transmute)] #![feature(const_fn)] +#![cfg_attr(not(bootstrap), feature(const_fn_fn_ptr_basics))] #![feature(const_ip)] #![feature(const_ipv6)] #![feature(const_raw_ptr_deref)] From 3cbd17fcc6c5c816b59c1816008b0d4ae3ef2982 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 24 Sep 2020 16:15:41 -0700 Subject: [PATCH 2/6] Remove `rustc_allow_const_fn_ptr` This was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need the bespoke attribute. --- compiler/rustc_attr/src/builtin.rs | 31 +++++-------------- compiler/rustc_feature/src/builtin_attrs.rs | 1 - compiler/rustc_middle/src/query/mod.rs | 4 --- .../rustc_mir/src/const_eval/fn_queries.rs | 6 ---- compiler/rustc_span/src/symbol.rs | 1 - library/core/src/task/wake.rs | 7 +---- 6 files changed, 8 insertions(+), 42 deletions(-) diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index 03dbcc45024..94e2a40e1fe 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -145,8 +145,6 @@ pub struct ConstStability { pub feature: Symbol, /// whether the function has a `#[rustc_promotable]` attribute pub promotable: bool, - /// whether the function has a `#[rustc_allow_const_fn_ptr]` attribute - pub allow_const_fn_ptr: bool, } /// The available stability levels. @@ -190,7 +188,6 @@ where let mut stab: Option = None; let mut const_stab: Option = None; let mut promotable = false; - let mut allow_const_fn_ptr = false; let diagnostic = &sess.parse_sess.span_diagnostic; 'outer: for attr in attrs_iter { @@ -200,7 +197,6 @@ where sym::unstable, sym::stable, sym::rustc_promotable, - sym::rustc_allow_const_fn_ptr, ] .iter() .any(|&s| attr.has_name(s)) @@ -215,9 +211,6 @@ where if attr.has_name(sym::rustc_promotable) { promotable = true; } - if attr.has_name(sym::rustc_allow_const_fn_ptr) { - allow_const_fn_ptr = true; - } // attributes with data else if let Some(MetaItem { kind: MetaItemKind::List(ref metas), .. }) = meta { let meta = meta.as_ref().unwrap(); @@ -360,12 +353,8 @@ where if sym::unstable == meta_name { stab = Some(Stability { level, feature }); } else { - const_stab = Some(ConstStability { - level, - feature, - promotable: false, - allow_const_fn_ptr: false, - }); + const_stab = + Some(ConstStability { level, feature, promotable: false }); } } (None, _, _) => { @@ -440,12 +429,8 @@ where if sym::stable == meta_name { stab = Some(Stability { level, feature }); } else { - const_stab = Some(ConstStability { - level, - feature, - promotable: false, - allow_const_fn_ptr: false, - }); + const_stab = + Some(ConstStability { level, feature, promotable: false }); } } (None, _) => { @@ -464,18 +449,16 @@ where } // Merge the const-unstable info into the stability info - if promotable || allow_const_fn_ptr { + if promotable { if let Some(ref mut stab) = const_stab { stab.promotable = promotable; - stab.allow_const_fn_ptr = allow_const_fn_ptr; } else { struct_span_err!( diagnostic, item_sp, E0717, - "rustc_promotable and rustc_allow_const_fn_ptr attributes \ - must be paired with either a rustc_const_unstable or a rustc_const_stable \ - attribute" + "`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` \ + or a `rustc_const_stable` attribute" ) .emit(); } diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 8b7fd59cd87..22c1ca2f289 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -464,7 +464,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ // ========================================================================== rustc_attr!(rustc_promotable, AssumedUsed, template!(Word), IMPL_DETAIL), - rustc_attr!(rustc_allow_const_fn_ptr, AssumedUsed, template!(Word), IMPL_DETAIL), rustc_attr!(rustc_args_required_const, AssumedUsed, template!(List: "N"), INTERNAL_UNSTABLE), // ========================================================================== diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 784d6c3b2ce..d5b99ea4d28 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -457,10 +457,6 @@ rustc_queries! { desc { |tcx| "checking if item is promotable: `{}`", tcx.def_path_str(key) } } - query const_fn_is_allowed_fn_ptr(key: DefId) -> bool { - desc { |tcx| "checking if const fn allows `fn()` types: `{}`", tcx.def_path_str(key) } - } - /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`). query is_foreign_item(key: DefId) -> bool { desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) } diff --git a/compiler/rustc_mir/src/const_eval/fn_queries.rs b/compiler/rustc_mir/src/const_eval/fn_queries.rs index 9ef63b3322d..b20d89b6e83 100644 --- a/compiler/rustc_mir/src/const_eval/fn_queries.rs +++ b/compiler/rustc_mir/src/const_eval/fn_queries.rs @@ -151,17 +151,11 @@ fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool { } } -fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool { - is_const_fn(tcx, def_id) - && tcx.lookup_const_stability(def_id).map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) -} - pub fn provide(providers: &mut Providers) { *providers = Providers { is_const_fn_raw, is_const_impl_raw: |tcx, def_id| is_const_impl_raw(tcx, def_id.expect_local()), is_promotable_const_fn, - const_fn_is_allowed_fn_ptr, ..*providers }; } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 7332a7ea331..4234aef3359 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -885,7 +885,6 @@ symbols! { rustc, rustc_allocator, rustc_allocator_nounwind, - rustc_allow_const_fn_ptr, rustc_args_required_const, rustc_attrs, rustc_builtin_macro, diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 109dbfda105..ba3fb35caaf 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -129,14 +129,9 @@ impl RawWakerVTable { /// associated task. #[rustc_promotable] #[stable(feature = "futures_api", since = "1.36.0")] - // `rustc_allow_const_fn_ptr` is a hack that should not be used anywhere else - // without first consulting with T-Lang. - // - // FIXME: remove whenever we have a stable way to accept fn pointers from const fn - // (see https://github.com/rust-rfcs/const-eval/issues/19#issuecomment-472799062) - #[rustc_allow_const_fn_ptr] #[rustc_const_stable(feature = "futures_api", since = "1.36.0")] #[cfg_attr(not(bootstrap), allow_internal_unstable(const_fn_fn_ptr_basics))] + #[cfg_attr(bootstrap, rustc_allow_const_fn_ptr)] pub const fn new( clone: unsafe fn(*const ()) -> RawWaker, wake: unsafe fn(*const ()), From e2622b915a15c06bdedc5e1278f6fb92cdaa03fa Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 24 Sep 2020 16:18:41 -0700 Subject: [PATCH 3/6] Update tests with new feature gate --- src/test/ui/consts/auxiliary/const_fn_lib.rs | 2 +- src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs | 2 +- .../const-extern-fn/const-extern-fn-min-const-fn.rs | 2 +- src/test/ui/consts/issue-37550.rs | 2 +- src/test/ui/consts/issue-56164.rs | 7 +++---- src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs | 8 +++++--- .../min_const_fn/allow_const_fn_ptr_feature_gate.rs | 7 +++++-- .../ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs | 4 +++- src/test/ui/consts/min_const_fn/cast_errors.rs | 8 ++++---- src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs | 2 +- src/test/ui/consts/min_const_fn/min_const_fn.rs | 4 ++-- src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs | 4 ++-- src/test/ui/issues/issue-37550.rs | 2 +- src/test/ui/issues/issue-46553.rs | 2 +- src/test/ui/type-alias-impl-trait/issue-53096.rs | 2 +- 15 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/test/ui/consts/auxiliary/const_fn_lib.rs b/src/test/ui/consts/auxiliary/const_fn_lib.rs index 85714efdbe9..bf0b01a2ecf 100644 --- a/src/test/ui/consts/auxiliary/const_fn_lib.rs +++ b/src/test/ui/consts/auxiliary/const_fn_lib.rs @@ -1,6 +1,6 @@ // Crate that exports a const fn. Used for testing cross-crate. -#![feature(const_fn)] +#![feature(const_fn_fn_ptr_basics)] #![crate_type="rlib"] pub const fn foo() -> usize { 22 } diff --git a/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs b/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs index 59d46ea66c9..bf8bae5ea2c 100644 --- a/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs +++ b/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(const_fn)] +#![feature(const_fn_fn_ptr_basics)] const fn nested(x: (for<'a> fn(&'a ()), String)) -> (fn(&'static ()), String) { x diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs index 094ae7378bc..8642954a75b 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs @@ -2,7 +2,7 @@ const extern fn unsize(x: &[u8; 3]) -> &[u8] { x } const unsafe extern "C" fn closure() -> fn() { || {} } -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer const unsafe extern fn use_float() { 1.0 + 1.0; } //~^ ERROR floating point arithmetic const extern "C" fn ptr_cast(val: *const u8) { val as usize; } diff --git a/src/test/ui/consts/issue-37550.rs b/src/test/ui/consts/issue-37550.rs index 04865830df2..15877c53747 100644 --- a/src/test/ui/consts/issue-37550.rs +++ b/src/test/ui/consts/issue-37550.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unused_variables)] -#![feature(const_fn)] +#![feature(const_fn_fn_ptr_basics)] const fn x() { let t = true; diff --git a/src/test/ui/consts/issue-56164.rs b/src/test/ui/consts/issue-56164.rs index 9d1a8b59463..90ea217698d 100644 --- a/src/test/ui/consts/issue-56164.rs +++ b/src/test/ui/consts/issue-56164.rs @@ -1,12 +1,11 @@ -#![feature(const_fn)] +#![feature(const_fn_fn_ptr_basics)] const fn foo() { (||{})() } -//~^ ERROR calls in constant functions are limited to constant functions, tuple structs and tuple -// variants +//~^ ERROR calls in constant functions const fn bad(input: fn()) { input() - //~^ ERROR function pointers are not allowed in const fn + //~^ ERROR function pointer } fn main() { diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs index 937aae1a8e3..dc10db177ed 100644 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs +++ b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.rs @@ -1,12 +1,14 @@ -#![feature(rustc_attrs, staged_api)] +#![feature(rustc_attrs, staged_api, allow_internal_unstable)] +#![feature(const_fn_fn_ptr_basics)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(since="1.0.0", feature = "mep")] -const fn error(_: fn()) {} //~ ERROR function pointers in const fn are unstable +const fn error(_: fn()) {} +//~^ ERROR const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]` #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_allow_const_fn_ptr] #[rustc_const_stable(since="1.0.0", feature = "mep")] +#[allow_internal_unstable(const_fn_fn_ptr_basics)] const fn compiles(_: fn()) {} fn main() {} diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs index 0f9d3729295..5e6c0a33205 100644 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs +++ b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs @@ -2,10 +2,13 @@ #[stable(feature = "rust1", since = "1.0.0")] const fn error(_: fn()) {} +//~^ ERROR `rustc_const_stable` or `rustc_const_unstable` +//~| ERROR `rustc_const_stable` or `rustc_const_unstable` +//~| ERROR function pointers #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_allow_const_fn_ptr] -//~^ ERROR internal implementation detail +#[rustc_const_stable(since="1.0.0", feature = "mep")] const fn compiles(_: fn()) {} +//~^ ERROR function pointers fn main() {} diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs index 7aa9bd7e2dc..b4e836bbc95 100644 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs +++ b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs @@ -1,11 +1,13 @@ // run-pass +#![feature(allow_internal_unstable)] +#![feature(const_fn_fn_ptr_basics)] #![feature(rustc_attrs, staged_api)] #![stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_allow_const_fn_ptr] #[rustc_const_stable(since="1.0.0", feature = "mep")] +#[allow_internal_unstable(const_fn_fn_ptr_basics)] const fn takes_fn_ptr(_: fn()) {} const FN: fn() = || (); diff --git a/src/test/ui/consts/min_const_fn/cast_errors.rs b/src/test/ui/consts/min_const_fn/cast_errors.rs index 8d730df16b0..43ef8ea12eb 100644 --- a/src/test/ui/consts/min_const_fn/cast_errors.rs +++ b/src/test/ui/consts/min_const_fn/cast_errors.rs @@ -2,12 +2,12 @@ fn main() {} const fn unsize(x: &[u8; 3]) -> &[u8] { x } const fn closure() -> fn() { || {} } -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer const fn closure2() { (|| {}) as fn(); -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer } const fn reify(f: fn()) -> unsafe fn() { f } -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer const fn reify2() { main as unsafe fn(); } -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs index c2600f894dc..4aaf7b86e45 100644 --- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs +++ b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs @@ -1,4 +1,4 @@ -const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable +const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointer unsafe { x == y } } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 55a999d5cdc..06a44b27106 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -128,6 +128,6 @@ const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } //~^ ERROR trait bounds other than `Sized` const fn no_fn_ptrs(_x: fn()) {} -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } -//~^ ERROR function pointers in const fn are unstable +//~^ ERROR function pointer diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs index 584ea46b1a6..985220ec7ae 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs @@ -9,9 +9,9 @@ fn field() {} const fn no_inner_dyn_trait(_x: Hide) {} const fn no_inner_dyn_trait2(x: Hide) { x.0.field; -//~^ ERROR function pointers in const fn +//~^ ERROR function pointer } const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) } -//~^ ERROR function pointers in const fn +//~^ ERROR function pointer fn main() {} diff --git a/src/test/ui/issues/issue-37550.rs b/src/test/ui/issues/issue-37550.rs index 505c030b967..35b63bddca2 100644 --- a/src/test/ui/issues/issue-37550.rs +++ b/src/test/ui/issues/issue-37550.rs @@ -1,6 +1,6 @@ const fn x() { let t = true; - let x = || t; //~ ERROR function pointers in const fn are unstable + let x = || t; //~ ERROR function pointer } fn main() {} diff --git a/src/test/ui/issues/issue-46553.rs b/src/test/ui/issues/issue-46553.rs index e21a532effd..0a1e835672d 100644 --- a/src/test/ui/issues/issue-46553.rs +++ b/src/test/ui/issues/issue-46553.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(const_fn)] +#![feature(const_fn_fn_ptr_basics)] #![deny(const_err)] pub struct Data { diff --git a/src/test/ui/type-alias-impl-trait/issue-53096.rs b/src/test/ui/type-alias-impl-trait/issue-53096.rs index 564c5c3d33f..bdf426bbd37 100644 --- a/src/test/ui/type-alias-impl-trait/issue-53096.rs +++ b/src/test/ui/type-alias-impl-trait/issue-53096.rs @@ -1,5 +1,5 @@ // check-pass -#![feature(const_fn)] +#![feature(const_fn, const_fn_fn_ptr_basics)] #![feature(type_alias_impl_trait)] type Foo = impl Fn() -> usize; From 54d3329c95c9ee0b7dbafd787fb90914ef8a98e8 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 24 Sep 2020 16:18:49 -0700 Subject: [PATCH 4/6] Bless tests --- .../ui/consts/const-eval/const_fn_ptr.stderr | 14 +++++++- .../const-eval/const_fn_ptr_fail2.stderr | 10 ++++++ .../const-extern-fn-min-const-fn.stderr | 7 ++-- src/test/ui/consts/issue-56164.stderr | 2 +- .../min_const_fn/allow_const_fn_ptr.stderr | 12 ++++--- .../allow_const_fn_ptr_feature_gate.stderr | 36 +++++++++++++++---- .../ui/consts/min_const_fn/cast_errors.stderr | 18 +++++----- .../min_const_fn/cmp_fn_pointers.stderr | 6 ++-- .../consts/min_const_fn/min_const_fn.stderr | 8 ++--- .../min_const_fn/min_const_fn_fn_ptr.stderr | 10 +++--- .../consts/miri_unleashed/abi-mismatch.stderr | 4 +-- src/test/ui/issues/issue-37550.stderr | 6 ++-- ...caller-location-fnptr-rt-ctfe-equiv.stderr | 19 +++++++++- 13 files changed, 107 insertions(+), 45 deletions(-) diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/src/test/ui/consts/const-eval/const_fn_ptr.stderr index d0ae94079da..ab18020056b 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr.stderr @@ -10,11 +10,23 @@ help: skipping check that does not even have a feature gate | LL | X_CONST(x) | ^^^^^^^^^^ +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/const_fn_ptr.rs:19:14 + | +LL | const fn foo(x: fn(usize) -> usize, y: usize) -> usize { + | ^ +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/const_fn_ptr.rs:20:5 + | +LL | x(y) + | ^ help: skipping check that does not even have a feature gate --> $DIR/const_fn_ptr.rs:20:5 | LL | x(y) | ^^^^ -warning: 1 warning emitted +error: `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine + +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr index 90ee2afa315..822d4af8306 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr @@ -20,6 +20,16 @@ LL | assert_eq!(Z, 4); warning: skipping const checks | +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/const_fn_ptr_fail2.rs:12:14 + | +LL | const fn bar(x: fn(usize) -> usize, y: usize) -> usize { + | ^ +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/const_fn_ptr_fail2.rs:13:5 + | +LL | x(y) + | ^ help: skipping check that does not even have a feature gate --> $DIR/const_fn_ptr_fail2.rs:13:5 | diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr index fcc34f358f9..455a822e2d0 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr @@ -1,11 +1,11 @@ -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/const-extern-fn-min-const-fn.rs:4:41 | LL | const unsafe extern "C" fn closure() -> fn() { || {} } | ^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error[E0658]: floating point arithmetic is not allowed in constant functions --> $DIR/const-extern-fn-min-const-fn.rs:6:38 @@ -27,5 +27,4 @@ LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; } error: aborting due to 3 previous errors -Some errors have detailed explanations: E0658, E0723. -For more information about an error, try `rustc --explain E0658`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/issue-56164.stderr b/src/test/ui/consts/issue-56164.stderr index d3e9ce379ae..500af0a4006 100644 --- a/src/test/ui/consts/issue-56164.stderr +++ b/src/test/ui/consts/issue-56164.stderr @@ -5,7 +5,7 @@ LL | const fn foo() { (||{})() } | ^^^^^^^^ error: function pointers are not allowed in const fn - --> $DIR/issue-56164.rs:8:5 + --> $DIR/issue-56164.rs:7:5 | LL | input() | ^^^^^^^ diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr index 9a14bcc2f73..94f6cda2097 100644 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr +++ b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr.stderr @@ -1,12 +1,14 @@ -error[E0723]: function pointers in const fn are unstable - --> $DIR/allow_const_fn_ptr.rs:5:16 +error: const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]` + --> $DIR/allow_const_fn_ptr.rs:6:16 | LL | const fn error(_: fn()) {} | ^ | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = note: otherwise `#[allow_internal_unstable]` can be used to bypass stability checks +help: if it is not part of the public API, make this function unstably const + | +LL | #[rustc_const_unstable(feature = "...", issue = "...")] + | error: aborting due to previous error -For more information about this error, try `rustc --explain E0723`. diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr index 7794cc7583d..23e31c80c43 100644 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr +++ b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr @@ -1,11 +1,33 @@ -error[E0658]: internal implementation detail - --> $DIR/allow_const_fn_ptr_feature_gate.rs:7:1 +error: stable const functions must have either `rustc_const_stable` or `rustc_const_unstable` attribute + --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:1 | -LL | #[rustc_allow_const_fn_ptr] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable +LL | const fn error(_: fn()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error: stable const functions must have either `rustc_const_stable` or `rustc_const_unstable` attribute + --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:1 + | +LL | const fn error(_: fn()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0658]: function pointers cannot appear in constant functions + --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:16 + | +LL | const fn error(_: fn()) {} + | ^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable + +error[E0658]: function pointers cannot appear in constant functions + --> $DIR/allow_const_fn_ptr_feature_gate.rs:11:19 + | +LL | const fn compiles(_: fn()) {} + | ^ + | + = note: see issue #57563 for more information + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/min_const_fn/cast_errors.stderr b/src/test/ui/consts/min_const_fn/cast_errors.stderr index 583cb4e9720..ac77c181afd 100644 --- a/src/test/ui/consts/min_const_fn/cast_errors.stderr +++ b/src/test/ui/consts/min_const_fn/cast_errors.stderr @@ -1,39 +1,39 @@ -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/cast_errors.rs:4:23 | LL | const fn closure() -> fn() { || {} } | ^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/cast_errors.rs:7:5 | LL | (|| {}) as fn(); | ^^^^^^^^^^^^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/cast_errors.rs:10:28 | LL | const fn reify(f: fn()) -> unsafe fn() { f } | ^^^^^^^^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/cast_errors.rs:12:21 | LL | const fn reify2() { main as unsafe fn(); } | ^^^^^^^^^^^^^^^^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0723`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr index 74e5228d0dc..e913b187fee 100644 --- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr +++ b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr @@ -1,12 +1,12 @@ -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/cmp_fn_pointers.rs:1:14 | LL | const fn cmp(x: fn(), y: fn()) -> bool { | ^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0723`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index a37e5203eee..5e6bf7ef890 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -209,23 +209,23 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 = note: see issue #57563 for more information = help: add `#![feature(const_fn)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/min_const_fn.rs:130:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/min_const_fn.rs:132:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error: aborting due to 26 previous errors diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr index 58acbb5339a..52269c1e2ac 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr @@ -1,21 +1,21 @@ -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/min_const_fn_fn_ptr.rs:11:5 | LL | x.0.field; | ^^^^^^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/min_const_fn_fn_ptr.rs:14:59 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) } | ^^^^^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0723`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr index 93b67fd7b14..8fd562c5dae 100644 --- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr +++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr @@ -12,12 +12,12 @@ LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern " warning: skipping const checks | -help: skipping check for `const_fn` feature +help: skipping check for `const_fn_fn_ptr_basics` feature --> $DIR/abi-mismatch.rs:9:23 | LL | const fn call_rust_fn(my_fn: extern "Rust" fn()) { | ^^^^^ -help: skipping check for `const_fn` feature +help: skipping check for `const_fn_fn_ptr_basics` feature --> $DIR/abi-mismatch.rs:10:5 | LL | my_fn(); diff --git a/src/test/ui/issues/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr index 35da6258016..54b60df70fd 100644 --- a/src/test/ui/issues/issue-37550.stderr +++ b/src/test/ui/issues/issue-37550.stderr @@ -1,12 +1,12 @@ -error[E0723]: function pointers in const fn are unstable +error[E0658]: function pointers cannot appear in constant functions --> $DIR/issue-37550.rs:3:9 | LL | let x = || t; | ^ | = note: see issue #57563 for more information - = help: add `#![feature(const_fn)]` to the crate attributes to enable + = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0723`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr index cf8ca57714c..0291a526333 100644 --- a/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr +++ b/src/test/ui/rfc-2091-track-caller/caller-location-fnptr-rt-ctfe-equiv.stderr @@ -1,10 +1,27 @@ warning: skipping const checks | +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:20:9 + | +LL | let ptr: fn() -> L = attributed; + | ^^^ +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:21:5 + | +LL | ptr() + | ^^^ +help: skipping check for `const_fn_fn_ptr_basics` feature + --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:20:26 + | +LL | let ptr: fn() -> L = attributed; + | ^^^^^^^^^^ help: skipping check that does not even have a feature gate --> $DIR/caller-location-fnptr-rt-ctfe-equiv.rs:21:5 | LL | ptr() | ^^^^^ -warning: 1 warning emitted +error: `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine + +error: aborting due to previous error; 1 warning emitted From 368502cc1d9bbbd8388be548f7ce5cd79f0d24da Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Thu, 24 Sep 2020 16:49:12 -0700 Subject: [PATCH 5/6] Mark `min_const_fn_fn_ptr` test as gate test --- src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs | 2 ++ src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs index 985220ec7ae..bc6fe89222b 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs @@ -1,3 +1,5 @@ +// gate-test-const_fn_fn_ptr_basics + struct HasPtr { field: fn(), } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr index 52269c1e2ac..8d60436ea39 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr @@ -1,5 +1,5 @@ error[E0658]: function pointers cannot appear in constant functions - --> $DIR/min_const_fn_fn_ptr.rs:11:5 + --> $DIR/min_const_fn_fn_ptr.rs:13:5 | LL | x.0.field; | ^^^^^^^^^ @@ -8,7 +8,7 @@ LL | x.0.field; = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error[E0658]: function pointers cannot appear in constant functions - --> $DIR/min_const_fn_fn_ptr.rs:14:59 + --> $DIR/min_const_fn_fn_ptr.rs:16:59 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) } | ^^^^^ From 807260be9fae2612b66bffaadf6e7a7b0b216cdc Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Sun, 27 Sep 2020 11:51:40 -0700 Subject: [PATCH 6/6] Remove feature gate test for `rustc_allow_const_fn_ptr` --- .../allow_const_fn_ptr_feature_gate.rs | 14 -------- .../allow_const_fn_ptr_feature_gate.stderr | 33 ------------------- 2 files changed, 47 deletions(-) delete mode 100644 src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs delete mode 100644 src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs deleted file mode 100644 index 5e6c0a33205..00000000000 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(staged_api)] - -#[stable(feature = "rust1", since = "1.0.0")] -const fn error(_: fn()) {} -//~^ ERROR `rustc_const_stable` or `rustc_const_unstable` -//~| ERROR `rustc_const_stable` or `rustc_const_unstable` -//~| ERROR function pointers - -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_stable(since="1.0.0", feature = "mep")] -const fn compiles(_: fn()) {} -//~^ ERROR function pointers - -fn main() {} diff --git a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr b/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr deleted file mode 100644 index 23e31c80c43..00000000000 --- a/src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error: stable const functions must have either `rustc_const_stable` or `rustc_const_unstable` attribute - --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:1 - | -LL | const fn error(_: fn()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: stable const functions must have either `rustc_const_stable` or `rustc_const_unstable` attribute - --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:1 - | -LL | const fn error(_: fn()) {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0658]: function pointers cannot appear in constant functions - --> $DIR/allow_const_fn_ptr_feature_gate.rs:4:16 - | -LL | const fn error(_: fn()) {} - | ^ - | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable - -error[E0658]: function pointers cannot appear in constant functions - --> $DIR/allow_const_fn_ptr_feature_gate.rs:11:19 - | -LL | const fn compiles(_: fn()) {} - | ^ - | - = note: see issue #57563 for more information - = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`.