-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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?
- Loading branch information
Showing
37 changed files
with
176 additions
and
114 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 was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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 |
---|---|---|
@@ -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 | ||
|
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 |
---|---|---|
@@ -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] |
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 |
---|---|---|
@@ -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`. |
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 |
---|---|---|
@@ -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 | ||
|
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 |
---|---|---|
@@ -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] |
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 |
---|---|---|
@@ -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`. |
Oops, something went wrong.