2023-08-06 13:20:55 +00:00
|
|
|
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:18:29
|
2021-09-09 14:43:59 +00:00
|
|
|
|
|
2023-08-06 13:20:55 +00:00
|
|
|
LL | struct Evaluatable<const N: Foo>;
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
|
help: add `#[derive(ConstParamTy)]` to the struct
|
|
|
|
|
|
|
|
|
LL + #[derive(ConstParamTy)]
|
|
|
|
LL | struct Foo(u8);
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:20:17
|
|
|
|
|
|
|
|
|
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
|
help: add `#[derive(ConstParamTy)]` to the struct
|
|
|
|
|
|
|
|
|
LL + #[derive(ConstParamTy)]
|
|
|
|
LL | struct Foo(u8);
|
|
|
|
|
|
|
|
|
|
|
|
|
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:24:17
|
|
|
|
|
|
|
|
|
LL | fn bar<const N: Foo>() {}
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
|
help: add `#[derive(ConstParamTy)]` to the struct
|
|
|
|
|
|
|
|
|
LL + #[derive(ConstParamTy)]
|
|
|
|
LL | struct Foo(u8);
|
2021-09-09 14:43:59 +00:00
|
|
|
|
|
|
|
|
|
2024-03-11 21:28:16 +00:00
|
|
|
error: unconstrained generic constant
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:30:12
|
|
|
|
|
|
|
|
|
LL | bar2::<{ std::ops::Add::add(N, N) }>();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2024-03-21 00:03:59 +00:00
|
|
|
help: try adding a `where` bound
|
|
|
|
|
|
|
|
|
LL | fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) where [(); { std::ops::Add::add(N, N) }]: {
|
|
|
|
| +++++++++++++++++++++++++++++++++++++++++
|
2024-03-11 21:28:16 +00:00
|
|
|
|
2024-02-09 12:17:55 +00:00
|
|
|
error[E0015]: cannot call non-const operator in constants
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:20:39
|
|
|
|
|
|
|
|
|
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
|
|
|
|
| ^^^^^
|
|
|
|
|
|
|
|
|
note: impl defined here, but it is not `const`
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:10:1
|
|
|
|
|
|
|
|
|
LL | impl const std::ops::Add for Foo {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
2024-03-07 22:09:00 +00:00
|
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
2024-02-09 12:17:55 +00:00
|
|
|
|
|
|
|
error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:21:13
|
|
|
|
|
|
|
|
|
LL | bar::<{ std::ops::Add::add(N, N) }>();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
2024-03-07 22:09:00 +00:00
|
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
2024-02-09 12:17:55 +00:00
|
|
|
|
|
|
|
error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants
|
|
|
|
--> $DIR/unify-op-with-fn-call.rs:30:14
|
|
|
|
|
|
|
|
|
LL | bar2::<{ std::ops::Add::add(N, N) }>();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
|
2024-03-07 22:09:00 +00:00
|
|
|
help: add `#![feature(effects)]` to the crate attributes to enable
|
|
|
|
|
|
|
|
|
LL + #![feature(effects)]
|
|
|
|
|
|
2024-02-09 12:17:55 +00:00
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
2021-09-09 14:43:59 +00:00
|
|
|
|
2024-02-09 12:17:55 +00:00
|
|
|
Some errors have detailed explanations: E0015, E0741.
|
|
|
|
For more information about an error, try `rustc --explain E0015`.
|