Update tests with new feature gate
This commit is contained in:
parent
3cbd17fcc6
commit
e2622b915a
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -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; }
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -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() = || ();
|
||||
|
@ -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
|
||||
|
@ -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 }
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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() {}
|
||||
|
@ -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() {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// run-pass
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![deny(const_err)]
|
||||
|
||||
pub struct Data<T> {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user