separate feature flag for unsizing casts in const fn

This commit is contained in:
Ralf Jung 2021-04-18 19:02:33 +02:00
parent fdad6ab3a3
commit fbfaab2cb7
8 changed files with 33 additions and 43 deletions

View file

@ -288,32 +288,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_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`.

View file

@ -7,16 +7,15 @@ LL | x.0.field;
= 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[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
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`.

View file

@ -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`.