forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#58196 - varkor:const-fn-feature-gate-error,…
… r=oli-obk Add specific feature gate error for const-unstable features Before: ``` error: `impl Trait` in const fn is unstable --> src/lib.rs:7:19 | 7 | const fn foo() -> impl T { | ^^^^^^ error: aborting due to previous error ``` After: ``` error[E0723]: `impl Trait` in const fn is unstable (see issue rust-lang#57563) --> src/lib.rs:7:19 | 7 | const fn foo() -> impl T { | ^^^^^^ = help: add #![feature(const_fn)] to the crate attributes to enable error: aborting due to previous error ``` This improves the situation with rust-lang#57563. Fixes rust-lang#57544. Fixes rust-lang#54469. r? @oli-obk
- Loading branch information
Showing
18 changed files
with
352 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
error: heap allocations are not allowed in const fn | ||
error[E0723]: heap allocations are not allowed in const fn (see issue #57563) | ||
--> $DIR/bad_const_fn_body_ice.rs:2:5 | ||
| | ||
LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0723`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
error: unsizing casts are not allowed in const fn | ||
error[E0723]: unsizing casts are not allowed in const fn (see issue #57563) | ||
--> $DIR/cast_errors.rs:3:41 | ||
| | ||
LL | const fn unsize(x: &[u8; 3]) -> &[u8] { x } | ||
| ^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: function pointers in const fn are unstable | ||
error[E0723]: function pointers in const fn are unstable (see issue #57563) | ||
--> $DIR/cast_errors.rs:5:23 | ||
| | ||
LL | const fn closure() -> fn() { || {} } | ||
| ^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: function pointers in const fn are unstable | ||
error[E0723]: function pointers in const fn are unstable (see issue #57563) | ||
--> $DIR/cast_errors.rs:8:5 | ||
| | ||
LL | (|| {}) as fn(); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: function pointers in const fn are unstable | ||
error[E0723]: function pointers in const fn are unstable (see issue #57563) | ||
--> $DIR/cast_errors.rs:11:28 | ||
| | ||
LL | const fn reify(f: fn()) -> unsafe fn() { f } | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: function pointers in const fn are unstable | ||
error[E0723]: function pointers in const fn are unstable (see issue #57563) | ||
--> $DIR/cast_errors.rs:13:21 | ||
| | ||
LL | const fn reify2() { main as unsafe fn(); } | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: aborting due to 5 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0723`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
error: function pointers in const fn are unstable | ||
error[E0723]: function pointers in const fn are unstable (see issue #57563) | ||
--> $DIR/cmp_fn_pointers.rs:1:14 | ||
| | ||
LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable | ||
| ^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0723`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
error: loops are not allowed in const fn | ||
error[E0723]: loops are not allowed in const fn (see issue #57563) | ||
--> $DIR/loop_ice.rs:2:5 | ||
| | ||
LL | loop {} //~ ERROR loops are not allowed in const fn | ||
| ^^^^^^^ | ||
| | ||
= help: add #![feature(const_fn)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0723`. |
Oops, something went wrong.