rust/tests/ui/const-generics/not_wf_param_in_rpitit.stderr

114 lines
4.6 KiB
Plaintext

error[E0425]: cannot find value `bar` in this scope
--> $DIR/not_wf_param_in_rpitit.rs:3:30
|
LL | trait Trait<const N: Trait = bar> {
| ^^^ not found in this scope
error[E0391]: cycle detected when computing type of `Trait::N`
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^
|
= note: ...which immediately requires computing type of `Trait::N` again
note: cycle used when computing explicit predicates of trait `Trait`
--> $DIR/not_wf_param_in_rpitit.rs:3:1
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^ `Trait` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
LL | trait Trait<const N: Trait = bar> {
| ----- this trait cannot be made into an object...
...
LL | async fn a() {}
| ^ ...because associated function `a` has no `self` parameter
help: consider turning `a` into a method by giving it a `&self` argument
|
LL | async fn a(&self) {}
| +++++
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
LL | async fn a() where Self: Sized {}
| +++++++++++++++++
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/not_wf_param_in_rpitit.rs:3:13
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
LL | trait Trait<const N: Trait = bar> {
| ----- this trait cannot be made into an object...
...
LL | async fn a() {}
| ^ ...because associated function `a` has no `self` parameter
help: consider turning `a` into a method by giving it a `&self` argument
|
LL | async fn a(&self) {}
| +++++
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
LL | async fn a() where Self: Sized {}
| +++++++++++++++++
error: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
error[E0038]: the trait `Trait` cannot be made into an object
--> $DIR/not_wf_param_in_rpitit.rs:3:13
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/not_wf_param_in_rpitit.rs:11:14
|
LL | trait Trait<const N: Trait = bar> {
| ----- this trait cannot be made into an object...
...
LL | async fn a() {}
| ^ ...because associated function `a` has no `self` parameter
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider turning `a` into a method by giving it a `&self` argument
|
LL | async fn a(&self) {}
| +++++
help: alternatively, consider constraining `a` so it does not apply to trait objects
|
LL | async fn a() where Self: Sized {}
| +++++++++++++++++
error[E0782]: trait objects must include the `dyn` keyword
--> $DIR/not_wf_param_in_rpitit.rs:3:22
|
LL | trait Trait<const N: Trait = bar> {
| ^^^^^
|
help: add `dyn` keyword before this trait
|
LL | trait Trait<const N: dyn Trait = bar> {
| +++
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0038, E0391, E0425, E0782.
For more information about an error, try `rustc --explain E0038`.