mirror of https://github.com/rust-lang/rust
74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
error[E0379]: functions in traits cannot be declared const
|
|
--> $DIR/trait-fn-const.rs:6:5
|
|
|
|
|
LL | #[const_trait]
|
|
| -------------- this declares all associated functions implicitly const
|
|
LL | trait Trait {
|
|
LL | const fn fun();
|
|
| ^^^^^-
|
|
| |
|
|
| functions in traits cannot be const
|
|
| help: remove the `const`
|
|
|
|
error[E0379]: functions in trait impls cannot be declared const
|
|
--> $DIR/trait-fn-const.rs:10:5
|
|
|
|
|
LL | impl const Trait for () {
|
|
| ----- this declares all associated functions implicitly const
|
|
LL | const fn fun() {}
|
|
| ^^^^^-
|
|
| |
|
|
| functions in trait impls cannot be const
|
|
| help: remove the `const`
|
|
|
|
error[E0379]: functions in trait impls cannot be declared const
|
|
--> $DIR/trait-fn-const.rs:14:5
|
|
|
|
|
LL | const fn fun() {}
|
|
| ^^^^^ functions in trait impls cannot be const
|
|
|
|
|
help: remove the `const` ...
|
|
|
|
|
LL - const fn fun() {}
|
|
LL + fn fun() {}
|
|
|
|
|
help: ... and declare the impl to be const instead
|
|
|
|
|
LL | impl const Trait for u32 {
|
|
| +++++
|
|
|
|
error[E0379]: functions in traits cannot be declared const
|
|
--> $DIR/trait-fn-const.rs:18:5
|
|
|
|
|
LL | const fn fun();
|
|
| ^^^^^ functions in traits cannot be const
|
|
|
|
|
help: remove the `const` ...
|
|
|
|
|
LL - const fn fun();
|
|
LL + fn fun();
|
|
|
|
|
help: ... and declare the trait to be a `#[const_trait]` instead
|
|
|
|
|
LL + #[const_trait]
|
|
LL | trait NonConst {
|
|
|
|
|
|
|
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
--> $DIR/trait-fn-const.rs:2:30
|
|
|
|
|
LL | #![feature(const_trait_impl, effects)]
|
|
| ^^^^^^^
|
|
|
|
|
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
|
|
= note: `#[warn(incomplete_features)]` on by default
|
|
|
|
error: using `#![feature(effects)]` without enabling next trait solver globally
|
|
|
|
|
= note: the next trait solver must be enabled globally for the effects feature to work correctly
|
|
= help: use `-Znext-solver` to enable
|
|
|
|
error: aborting due to 5 previous errors; 1 warning emitted
|
|
|
|
For more information about this error, try `rustc --explain E0379`.
|