Make const Fn require const FnMut
This commit is contained in:
parent
a2d1d14f68
commit
28819e0f4b
6 changed files with 33 additions and 4 deletions
|
|
@ -73,7 +73,7 @@ use crate::marker::Tuple;
|
|||
#[fundamental] // so that regex can rely that `&str: !FnMut`
|
||||
#[must_use = "closures are lazy and do nothing unless called"]
|
||||
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
|
||||
pub const trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
pub const trait Fn<Args: Tuple>: [const] FnMut<Args> {
|
||||
/// Performs the call operation.
|
||||
#[unstable(feature = "fn_traits", issue = "29625")]
|
||||
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
pub const _: () = {
|
||||
assert!((const || true)());
|
||||
//~^ ERROR }: [const] Fn()` is not satisfied
|
||||
//~| ERROR }: [const] FnMut()` is not satisfied
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@ error[E0277]: the trait bound `{closure@$DIR/call.rs:7:14: 7:22}: [const] Fn()`
|
|||
LL | assert!((const || true)());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0277]: the trait bound `{closure@$DIR/call.rs:7:14: 7:22}: [const] FnMut()` is not satisfied
|
||||
--> $DIR/call.rs:7:13
|
||||
|
|
||||
LL | assert!((const || true)());
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `call`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@ error[E0277]: the trait bound `{closure@$DIR/const_closure-const_trait_impl-ice-
|
|||
LL | (const || (()).foo())();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0277]: the trait bound `{closure@$DIR/const_closure-const_trait_impl-ice-113381.rs:15:6: 15:14}: [const] FnMut()` is not satisfied
|
||||
--> $DIR/const_closure-const_trait_impl-ice-113381.rs:15:5
|
||||
|
|
||||
LL | (const || (()).foo())();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `call`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ impl Foo for () {
|
|||
fn main() {
|
||||
(const || { (()).foo() })();
|
||||
//~^ ERROR: }: [const] Fn()` is not satisfied
|
||||
//~| ERROR: }: [const] FnMut()` is not satisfied
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,15 @@ error[E0277]: the trait bound `{closure@$DIR/non-const-op-const-closure-non-cons
|
|||
LL | (const || { (()).foo() })();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0277]: the trait bound `{closure@$DIR/non-const-op-const-closure-non-const-outer.rs:13:6: 13:14}: [const] FnMut()` is not satisfied
|
||||
--> $DIR/non-const-op-const-closure-non-const-outer.rs:13:5
|
||||
|
|
||||
LL | (const || { (()).foo() })();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `call`
|
||||
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue