Skip to content

Commit e2622b9

Browse files
Update tests with new feature gate
1 parent 3cbd17f commit e2622b9

15 files changed

+32
-26
lines changed

src/test/ui/consts/auxiliary/const_fn_lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Crate that exports a const fn. Used for testing cross-crate.
22

3-
#![feature(const_fn)]
3+
#![feature(const_fn_fn_ptr_basics)]
44
#![crate_type="rlib"]
55

66
pub const fn foo() -> usize { 22 }

src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
#![feature(const_fn)]
2+
#![feature(const_fn_fn_ptr_basics)]
33

44
const fn nested(x: (for<'a> fn(&'a ()), String)) -> (fn(&'static ()), String) {
55
x

src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const extern fn unsize(x: &[u8; 3]) -> &[u8] { x }
44
const unsafe extern "C" fn closure() -> fn() { || {} }
5-
//~^ ERROR function pointers in const fn are unstable
5+
//~^ ERROR function pointer
66
const unsafe extern fn use_float() { 1.0 + 1.0; }
77
//~^ ERROR floating point arithmetic
88
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }

src/test/ui/consts/issue-37550.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![allow(dead_code)]
33
#![allow(unused_variables)]
44

5-
#![feature(const_fn)]
5+
#![feature(const_fn_fn_ptr_basics)]
66

77
const fn x() {
88
let t = true;

src/test/ui/consts/issue-56164.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#![feature(const_fn)]
1+
#![feature(const_fn_fn_ptr_basics)]
22

33
const fn foo() { (||{})() }
4-
//~^ ERROR calls in constant functions are limited to constant functions, tuple structs and tuple
5-
// variants
4+
//~^ ERROR calls in constant functions
65

76
const fn bad(input: fn()) {
87
input()
9-
//~^ ERROR function pointers are not allowed in const fn
8+
//~^ ERROR function pointer
109
}
1110

1211
fn main() {
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
#![feature(rustc_attrs, staged_api)]
1+
#![feature(rustc_attrs, staged_api, allow_internal_unstable)]
2+
#![feature(const_fn_fn_ptr_basics)]
23

34
#[stable(feature = "rust1", since = "1.0.0")]
45
#[rustc_const_stable(since="1.0.0", feature = "mep")]
5-
const fn error(_: fn()) {} //~ ERROR function pointers in const fn are unstable
6+
const fn error(_: fn()) {}
7+
//~^ ERROR const-stable function cannot use `#[feature(const_fn_fn_ptr_basics)]`
68

79
#[stable(feature = "rust1", since = "1.0.0")]
8-
#[rustc_allow_const_fn_ptr]
910
#[rustc_const_stable(since="1.0.0", feature = "mep")]
11+
#[allow_internal_unstable(const_fn_fn_ptr_basics)]
1012
const fn compiles(_: fn()) {}
1113

1214
fn main() {}

src/test/ui/consts/min_const_fn/allow_const_fn_ptr_feature_gate.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
#[stable(feature = "rust1", since = "1.0.0")]
44
const fn error(_: fn()) {}
5+
//~^ ERROR `rustc_const_stable` or `rustc_const_unstable`
6+
//~| ERROR `rustc_const_stable` or `rustc_const_unstable`
7+
//~| ERROR function pointers
58

69
#[stable(feature = "rust1", since = "1.0.0")]
7-
#[rustc_allow_const_fn_ptr]
8-
//~^ ERROR internal implementation detail
10+
#[rustc_const_stable(since="1.0.0", feature = "mep")]
911
const fn compiles(_: fn()) {}
12+
//~^ ERROR function pointers
1013

1114
fn main() {}

src/test/ui/consts/min_const_fn/allow_const_fn_ptr_run_pass.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// run-pass
2+
#![feature(allow_internal_unstable)]
3+
#![feature(const_fn_fn_ptr_basics)]
24

35
#![feature(rustc_attrs, staged_api)]
46
#![stable(feature = "rust1", since = "1.0.0")]
57

68
#[stable(feature = "rust1", since = "1.0.0")]
7-
#[rustc_allow_const_fn_ptr]
89
#[rustc_const_stable(since="1.0.0", feature = "mep")]
10+
#[allow_internal_unstable(const_fn_fn_ptr_basics)]
911
const fn takes_fn_ptr(_: fn()) {}
1012

1113
const FN: fn() = || ();

src/test/ui/consts/min_const_fn/cast_errors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ fn main() {}
22

33
const fn unsize(x: &[u8; 3]) -> &[u8] { x }
44
const fn closure() -> fn() { || {} }
5-
//~^ ERROR function pointers in const fn are unstable
5+
//~^ ERROR function pointer
66
const fn closure2() {
77
(|| {}) as fn();
8-
//~^ ERROR function pointers in const fn are unstable
8+
//~^ ERROR function pointer
99
}
1010
const fn reify(f: fn()) -> unsafe fn() { f }
11-
//~^ ERROR function pointers in const fn are unstable
11+
//~^ ERROR function pointer
1212
const fn reify2() { main as unsafe fn(); }
13-
//~^ ERROR function pointers in const fn are unstable
13+
//~^ ERROR function pointer

src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable
1+
const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointer
22
unsafe { x == y }
33
}
44

src/test/ui/consts/min_const_fn/min_const_fn.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
128128
//~^ ERROR trait bounds other than `Sized`
129129

130130
const fn no_fn_ptrs(_x: fn()) {}
131-
//~^ ERROR function pointers in const fn are unstable
131+
//~^ ERROR function pointer
132132
const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
133-
//~^ ERROR function pointers in const fn are unstable
133+
//~^ ERROR function pointer

src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ fn field() {}
99
const fn no_inner_dyn_trait(_x: Hide) {}
1010
const fn no_inner_dyn_trait2(x: Hide) {
1111
x.0.field;
12-
//~^ ERROR function pointers in const fn
12+
//~^ ERROR function pointer
1313
}
1414
const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }
15-
//~^ ERROR function pointers in const fn
15+
//~^ ERROR function pointer
1616

1717
fn main() {}

src/test/ui/issues/issue-37550.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fn x() {
22
let t = true;
3-
let x = || t; //~ ERROR function pointers in const fn are unstable
3+
let x = || t; //~ ERROR function pointer
44
}
55

66
fn main() {}

src/test/ui/issues/issue-46553.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
#![feature(const_fn)]
2+
#![feature(const_fn_fn_ptr_basics)]
33
#![deny(const_err)]
44

55
pub struct Data<T> {

src/test/ui/type-alias-impl-trait/issue-53096.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
#![feature(const_fn)]
2+
#![feature(const_fn, const_fn_fn_ptr_basics)]
33
#![feature(type_alias_impl_trait)]
44

55
type Foo = impl Fn() -> usize;

0 commit comments

Comments
 (0)