mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
e6bd6c2044
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Fix #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
189 lines
5.9 KiB
Plaintext
189 lines
5.9 KiB
Plaintext
error[E0635]: unknown feature `const_fn_trait_ref_impls`
|
|
--> $DIR/fn_trait_refs.rs:3:12
|
|
|
|
|
LL | #![feature(const_fn_trait_ref_impls)]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:15:15
|
|
|
|
|
LL | T: ~const Fn<()> + ~const Destruct,
|
|
| ^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:15:15
|
|
|
|
|
LL | T: ~const Fn<()> + ~const Destruct,
|
|
| ^^^^^^
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:22:15
|
|
|
|
|
LL | T: ~const FnMut<()> + ~const Destruct,
|
|
| ^^^^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:22:15
|
|
|
|
|
LL | T: ~const FnMut<()> + ~const Destruct,
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:29:15
|
|
|
|
|
LL | T: ~const FnOnce<()>,
|
|
| ^^^^^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:29:15
|
|
|
|
|
LL | T: ~const FnOnce<()>,
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:36:15
|
|
|
|
|
LL | T: ~const Fn<()> + ~const Destruct,
|
|
| ^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:36:15
|
|
|
|
|
LL | T: ~const Fn<()> + ~const Destruct,
|
|
| ^^^^^^
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:50:15
|
|
|
|
|
LL | T: ~const FnMut<()> + ~const Destruct,
|
|
| ^^^^^^^^^
|
|
|
|
error: `~const` can only be applied to `#[const_trait]` traits
|
|
--> $DIR/fn_trait_refs.rs:50:15
|
|
|
|
|
LL | T: ~const FnMut<()> + ~const Destruct,
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
|
|
error[E0015]: cannot call non-const operator in constants
|
|
--> $DIR/fn_trait_refs.rs:72:17
|
|
|
|
|
LL | assert!(test_one == (1, 1, 1));
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0015]: cannot call non-const operator in constants
|
|
--> $DIR/fn_trait_refs.rs:75:17
|
|
|
|
|
LL | assert!(test_two == (2, 2));
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0015]: cannot call non-const closure in constant functions
|
|
--> $DIR/fn_trait_refs.rs:17:5
|
|
|
|
|
LL | f()
|
|
| ^^^
|
|
|
|
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
|
help: consider further restricting this bound
|
|
|
|
|
LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
|
|
| +++++++++++++
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
|
--> $DIR/fn_trait_refs.rs:13:23
|
|
|
|
|
LL | const fn tester_fn<T>(f: T) -> T::Output
|
|
| ^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error[E0015]: cannot call non-const closure in constant functions
|
|
--> $DIR/fn_trait_refs.rs:24:5
|
|
|
|
|
LL | f()
|
|
| ^^^
|
|
|
|
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
|
help: consider further restricting this bound
|
|
|
|
|
LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
|
|
| ++++++++++++++++
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
|
--> $DIR/fn_trait_refs.rs:20:27
|
|
|
|
|
LL | const fn tester_fn_mut<T>(mut f: T) -> T::Output
|
|
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error[E0015]: cannot call non-const closure in constant functions
|
|
--> $DIR/fn_trait_refs.rs:31:5
|
|
|
|
|
LL | f()
|
|
| ^^^
|
|
|
|
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
|
help: consider further restricting this bound
|
|
|
|
|
LL | T: ~const FnOnce<()> + ~const FnOnce(),
|
|
| +++++++++++++++++
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
|
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
|
--> $DIR/fn_trait_refs.rs:34:21
|
|
|
|
|
LL | const fn test_fn<T>(mut f: T) -> (T::Output, T::Output, T::Output)
|
|
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error[E0493]: destructor of `T` cannot be evaluated at compile-time
|
|
--> $DIR/fn_trait_refs.rs:48:25
|
|
|
|
|
LL | const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
|
|
| ^^^^^ the destructor for this type cannot be evaluated in constant functions
|
|
...
|
|
LL | }
|
|
| - value is dropped here
|
|
|
|
error: aborting due to 20 previous errors
|
|
|
|
Some errors have detailed explanations: E0015, E0493, E0635.
|
|
For more information about an error, try `rustc --explain E0015`.
|