mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
further split up const_fn feature flag This continues the work on splitting up `const_fn` into separate feature flags: * `const_fn_trait_bound` for `const fn` with trait bounds * `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here) I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more. `@oli-obk` are you currently able to do reviews?
This commit is contained in:
commit
b56b175c6c
@ -10,7 +10,8 @@
|
||||
)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(const_fn)] // For the `transmute` in `P::new`
|
||||
#![cfg_attr(bootstrap, feature(const_fn))] // For the `transmute` in `P::new`
|
||||
#![cfg_attr(not(bootstrap), feature(const_fn_unsize))] // For the `transmute` in `P::new`
|
||||
#![feature(const_fn_transmute)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
|
@ -416,7 +416,6 @@ E0716: include_str!("./error_codes/E0716.md"),
|
||||
E0718: include_str!("./error_codes/E0718.md"),
|
||||
E0719: include_str!("./error_codes/E0719.md"),
|
||||
E0720: include_str!("./error_codes/E0720.md"),
|
||||
E0723: include_str!("./error_codes/E0723.md"),
|
||||
E0724: include_str!("./error_codes/E0724.md"),
|
||||
E0725: include_str!("./error_codes/E0725.md"),
|
||||
E0727: include_str!("./error_codes/E0727.md"),
|
||||
@ -636,6 +635,7 @@ E0781: include_str!("./error_codes/E0781.md"),
|
||||
E0717, // rustc_promotable without stability attribute
|
||||
// E0721, // `await` keyword
|
||||
E0722, // Malformed `#[optimize]` attribute
|
||||
// E0723, unstable feature in `const` context
|
||||
E0726, // non-explicit (not `'_`) elided lifetime in unsupported position
|
||||
// E0738, // Removed; errored on `#[track_caller] fn`s in `extern "Rust" { ... }`.
|
||||
E0757, // `#[ffi_const]` functions cannot be `#[ffi_pure]`
|
||||
|
@ -1,20 +0,0 @@
|
||||
An unstable feature in `const` contexts was used.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0723
|
||||
const fn foo<T: Copy>(_: T) { // error!
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
To enable this feature on a nightly version of rustc, add the `const_fn`
|
||||
feature flag:
|
||||
|
||||
```
|
||||
#![feature(const_fn)]
|
||||
|
||||
const fn foo<T: Copy>(_: T) { // ok!
|
||||
// ...
|
||||
}
|
||||
```
|
@ -645,6 +645,12 @@ declare_features! (
|
||||
/// Allows `extern "wasm" fn`
|
||||
(active, wasm_abi, "1.53.0", Some(83788), None),
|
||||
|
||||
/// Allows trait bounds in `const fn`.
|
||||
(active, const_fn_trait_bound, "1.53.0", Some(57563), None),
|
||||
|
||||
/// Allows unsizing coercions in `const fn`.
|
||||
(active, const_fn_unsize, "1.53.0", Some(64992), None),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// feature-group-end: actual feature gates
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -3,7 +3,6 @@
|
||||
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
|
||||
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(const_fn)] // For the unsizing cast on `&[]`
|
||||
#![feature(const_panic)]
|
||||
#![feature(extended_key_value_attributes)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(allow_internal_unstable)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(extend_one)]
|
||||
#![feature(iter_zip)]
|
||||
|
@ -16,7 +16,6 @@
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(extend_one)]
|
||||
#![feature(iter_zip)]
|
||||
|
@ -29,7 +29,6 @@
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(discriminant_kind)]
|
||||
|
@ -12,7 +12,6 @@ Rust MIR: a lowered representation of Rust.
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(decl_macro)]
|
||||
|
@ -540,12 +540,17 @@ impl NonConstOp for UnionAccess {
|
||||
pub struct UnsizingCast;
|
||||
impl NonConstOp for UnsizingCast {
|
||||
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_unsize)
|
||||
}
|
||||
}
|
||||
|
||||
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
|
||||
mcf_build_error(
|
||||
ccx,
|
||||
feature_err(
|
||||
&ccx.tcx.sess.parse_sess,
|
||||
sym::const_fn_unsize,
|
||||
span,
|
||||
"unsizing casts to types besides slices are not allowed in const fn",
|
||||
)
|
||||
@ -642,12 +647,17 @@ pub mod ty {
|
||||
}
|
||||
|
||||
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_trait_bound)
|
||||
}
|
||||
}
|
||||
|
||||
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
|
||||
mcf_build_error(
|
||||
ccx,
|
||||
feature_err(
|
||||
&ccx.tcx.sess.parse_sess,
|
||||
sym::const_fn_trait_bound,
|
||||
span,
|
||||
"trait bounds other than `Sized` on const fn parameters are unstable",
|
||||
)
|
||||
@ -672,21 +682,3 @@ pub mod ty {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn mcf_status_in_item(ccx: &ConstCx<'_, '_>) -> Status {
|
||||
if ccx.const_kind() != hir::ConstContext::ConstFn {
|
||||
Status::Allowed
|
||||
} else {
|
||||
Status::Unstable(sym::const_fn)
|
||||
}
|
||||
}
|
||||
|
||||
fn mcf_build_error(ccx: &ConstCx<'_, 'tcx>, span: Span, msg: &str) -> DiagnosticBuilder<'tcx> {
|
||||
let mut err = struct_span_err!(ccx.tcx.sess, span, E0723, "{}", msg);
|
||||
err.note(
|
||||
"see issue #57563 <https://github.com/rust-lang/rust/issues/57563> \
|
||||
for more information",
|
||||
);
|
||||
err.help("add `#![feature(const_fn)]` to the crate attributes to enable");
|
||||
err
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
|
||||
|
||||
use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorReported};
|
||||
use rustc_errors::{Applicability, Diagnostic, ErrorReported};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, HirId, LangItem};
|
||||
use rustc_index::bit_set::BitSet;
|
||||
@ -234,13 +234,11 @@ impl Validator<'mir, 'tcx> {
|
||||
if self.is_const_stable_const_fn() {
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
if crate::const_eval::is_parent_const_impl_raw(tcx, hir_id) {
|
||||
struct_span_err!(
|
||||
self.ccx.tcx.sess,
|
||||
self.span,
|
||||
E0723,
|
||||
"trait methods cannot be stable const fn"
|
||||
)
|
||||
.emit();
|
||||
self.ccx
|
||||
.tcx
|
||||
.sess
|
||||
.struct_span_err(self.span, "trait methods cannot be stable const fn")
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#![feature(array_windows)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(in_band_lifetimes)]
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(drain_filter)]
|
||||
|
@ -16,7 +16,6 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(array_windows)]
|
||||
#![feature(crate_visibility_modifier)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(negative_impls)]
|
||||
#![feature(nll)]
|
||||
|
@ -382,8 +382,10 @@ symbols! {
|
||||
const_fn,
|
||||
const_fn_floating_point_arithmetic,
|
||||
const_fn_fn_ptr_basics,
|
||||
const_fn_trait_bound,
|
||||
const_fn_transmute,
|
||||
const_fn_union,
|
||||
const_fn_unsize,
|
||||
const_generic_defaults,
|
||||
const_generics,
|
||||
const_generics_defaults,
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(bool_to_option)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(nll)]
|
||||
#![feature(never_type)]
|
||||
|
@ -89,7 +89,8 @@
|
||||
#![feature(cfg_target_has_atomic)]
|
||||
#![feature(coerce_unsized)]
|
||||
#![feature(const_btree_new)]
|
||||
#![feature(const_fn)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn))]
|
||||
#![cfg_attr(not(bootstrap), feature(const_fn_trait_bound))]
|
||||
#![feature(cow_is_borrowed)]
|
||||
#![feature(const_cow_is_borrowed)]
|
||||
#![feature(destructuring_assignment)]
|
||||
|
@ -81,11 +81,12 @@
|
||||
#![feature(const_refs_to_cell)]
|
||||
#![feature(const_panic)]
|
||||
#![feature(const_pin)]
|
||||
#![feature(const_fn)]
|
||||
#![cfg_attr(bootstrap, feature(const_fn))]
|
||||
#![feature(const_fn_union)]
|
||||
#![feature(const_impl_trait)]
|
||||
#![feature(const_fn_floating_point_arithmetic)]
|
||||
#![feature(const_fn_fn_ptr_basics)]
|
||||
#![cfg_attr(not(bootstrap), feature(const_fn_trait_bound))]
|
||||
#![feature(const_option)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
#![feature(const_ptr_offset)]
|
||||
|
@ -12,7 +12,7 @@ RUSTC_BOOTSTRAP=1 ./build/$PGO_HOST/stage2/bin/rustc --edition=2018 \
|
||||
|
||||
# Download and build a single-file stress test benchmark on perf.rust-lang.org.
|
||||
function pgo_perf_benchmark {
|
||||
local PERF=e095f5021bf01cf3800f50b3a9f14a9683eb3e4e
|
||||
local PERF=9442def56a39d742bf27ebcc3e0614cf117e1bc2
|
||||
local github_prefix=https://raw.githubusercontent.com/rust-lang/rustc-perf/$PERF
|
||||
local name=$1
|
||||
curl -o /tmp/$name.rs $github_prefix/collector/benchmarks/$name/src/lib.rs
|
||||
|
@ -1,7 +1,7 @@
|
||||
// issue-49296: Unsafe shenigans in constants can result in missing errors
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_union)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
const unsafe fn transmute<T: Copy, U: Copy>(t: T) -> U {
|
||||
#[repr(C)]
|
||||
|
@ -3,7 +3,8 @@
|
||||
|
||||
// A very basic test of const fn functionality.
|
||||
|
||||
#![feature(const_fn, const_indexing)]
|
||||
#![feature(const_indexing)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
const fn add(x: u32, y: u32) -> u32 {
|
||||
x + y
|
||||
|
8
src/test/ui/consts/const_fn_trait_bound.gated.stderr
Normal file
8
src/test/ui/consts/const_fn_trait_bound.gated.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/const_fn_trait_bound.rs:17:1
|
||||
|
|
||||
LL | fn main() {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
17
src/test/ui/consts/const_fn_trait_bound.rs
Normal file
17
src/test/ui/consts/const_fn_trait_bound.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// gate-test-const_fn_trait_bound
|
||||
|
||||
// revisions: stock gated
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![cfg_attr(gated, feature(const_fn_trait_bound))]
|
||||
|
||||
const fn test1<T: std::ops::Add>() {}
|
||||
//[stock]~^ trait bounds
|
||||
const fn test2(_x: &dyn Send) {}
|
||||
//[stock]~^ trait bounds
|
||||
const fn test3() -> &'static dyn Send { loop {} }
|
||||
//[stock]~^ trait bounds
|
||||
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {} //[gated]~ fatal error triggered by #[rustc_error]
|
30
src/test/ui/consts/const_fn_trait_bound.stock.stderr
Normal file
30
src/test/ui/consts/const_fn_trait_bound.stock.stderr
Normal file
@ -0,0 +1,30 @@
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/const_fn_trait_bound.rs:8:16
|
||||
|
|
||||
LL | const fn test1<T: std::ops::Add>() {}
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/const_fn_trait_bound.rs:10:16
|
||||
|
|
||||
LL | const fn test2(_x: &dyn Send) {}
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/const_fn_trait_bound.rs:12:21
|
||||
|
|
||||
LL | const fn test3() -> &'static dyn Send { loop {} }
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
8
src/test/ui/consts/const_fn_unsize.gated.stderr
Normal file
8
src/test/ui/consts/const_fn_unsize.gated.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error: fatal error triggered by #[rustc_error]
|
||||
--> $DIR/const_fn_unsize.rs:16:1
|
||||
|
|
||||
LL | fn main() {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
16
src/test/ui/consts/const_fn_unsize.rs
Normal file
16
src/test/ui/consts/const_fn_unsize.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// gate-test-const_fn_unsize
|
||||
|
||||
// revisions: stock gated
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![cfg_attr(gated, feature(const_fn_unsize))]
|
||||
|
||||
use std::ptr::NonNull;
|
||||
|
||||
const fn test() {
|
||||
let _x = NonNull::<[i32; 0]>::dangling() as NonNull<[i32]>;
|
||||
//[stock]~^ unsizing cast
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() {} //[gated]~ fatal error triggered by #[rustc_error]
|
12
src/test/ui/consts/const_fn_unsize.stock.stderr
Normal file
12
src/test/ui/consts/const_fn_unsize.stock.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/const_fn_unsize.rs:11:14
|
||||
|
|
||||
LL | let _x = NonNull::<[i32; 0]>::dangling() as NonNull<[i32]>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
@ -130,23 +130,23 @@ LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
|
||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:84:16
|
||||
|
|
||||
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:86:18
|
||||
|
|
||||
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0013]: constant functions cannot refer to statics
|
||||
--> $DIR/min_const_fn.rs:90:27
|
||||
@ -209,41 +209,41 @@ LL | const fn inc(x: &mut i32) { *x += 1 }
|
||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:110:6
|
||||
|
|
||||
LL | impl<T: std::fmt::Debug> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:115:6
|
||||
|
|
||||
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:120:6
|
||||
|
|
||||
LL | impl<T: Sync + Sized> Foo<T> {
|
||||
| ^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:126:34
|
||||
|
|
||||
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0493]: destructors cannot be evaluated at compile-time
|
||||
--> $DIR/min_const_fn.rs:126:19
|
||||
@ -253,14 +253,14 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
|
||||
| |
|
||||
| constant functions cannot evaluate destructors
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:129:22
|
||||
|
|
||||
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0493]: destructors cannot be evaluated at compile-time
|
||||
--> $DIR/min_const_fn.rs:129:18
|
||||
@ -270,50 +270,50 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {}
|
||||
| |
|
||||
| constant functions cannot evaluate destructors
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:132:23
|
||||
|
|
||||
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn.rs:134:32
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/min_const_fn.rs:134:63
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/min_const_fn.rs:134:63
|
||||
|
|
||||
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||
| ^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/min_const_fn.rs:141:42
|
||||
|
|
||||
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
|
||||
| ^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: function pointers cannot appear in constant functions
|
||||
--> $DIR/min_const_fn.rs:144:21
|
||||
@ -344,5 +344,5 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
|
||||
|
||||
error: aborting due to 39 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0013, E0493, E0658, E0723.
|
||||
Some errors have detailed explanations: E0013, E0493, E0658.
|
||||
For more information about an error, try `rustc --explain E0013`.
|
||||
|
@ -1,21 +1,21 @@
|
||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
|
||||
--> $DIR/min_const_fn_dyn.rs:9:5
|
||||
|
|
||||
LL | x.0.field;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
|
||||
|
||||
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/min_const_fn_dyn.rs:12:66
|
||||
|
|
||||
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
|
||||
| ^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` 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`.
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
|
||||
error[E0658]: unsizing casts to types besides slices are not allowed in const fn
|
||||
--> $DIR/unsizing-cast-non-null.rs:6:5
|
||||
|
|
||||
LL | NonNull::<[T; 0]>::dangling()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||
= note: see issue #64992 <https://github.com/rust-lang/rust/issues/64992> for more information
|
||||
= help: add `#![feature(const_fn_unsize)]` 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`.
|
||||
|
@ -6,7 +6,7 @@
|
||||
#![stable(feature = "core", since = "1.6.0")]
|
||||
#![feature(rustc_const_unstable)]
|
||||
#![feature(staged_api)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
enum Opt<T> {
|
||||
Some(T),
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
// check-pass
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct S;
|
||||
|
@ -1,8 +1,8 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_trait_bound_opt_out)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct S;
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
// check-pass
|
||||
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
struct S;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(const_fn_trait_bound)]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0723]: trait methods cannot be stable const fn
|
||||
error: trait methods cannot be stable const fn
|
||||
--> $DIR/stability.rs:14:5
|
||||
|
|
||||
LL | / fn sub(self, rhs: Self) -> Self {
|
||||
@ -17,4 +17,3 @@ LL | Int(1i32) + Int(2i32)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0723`.
|
||||
|
Loading…
Reference in New Issue
Block a user