rust/tests/ui/const-generics/not_wf_param_in_rpitit.stderr
Barrett Ray c5598d6a9e fix(hir_analysis/wfcheck): don't leak {type error}
avoid `{type error}` being leaked in user-facing messages,
particularly when using the `adt_const_params` feature
2024-09-29 23:40:43 -05:00

106 lines
4.3 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 "dyn-compatible" 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:10: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 "dyn-compatible" 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:10: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 "dyn-compatible" 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:10: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 6 previous errors
Some errors have detailed explanations: E0038, E0391, E0425, E0782.
For more information about an error, try `rustc --explain E0038`.