rust/tests/ui/traits/unspecified-self-in-trait-ref.stderr
León Orell Valerian Liehr 233a45c41a
Fix handling of const params defaults that ref Self & generalize diag
We used to lower such bad defaulted const args in trait object types to
`{type error}`; now correctly lower them to `{const error}`.

The added tests used to ICE prior to this change.
2026-01-21 12:53:47 +01:00

105 lines
4.5 KiB
Text

warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:11:13
|
LL | let a = Foo::lol();
| ^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
|
LL | let a = <dyn Foo>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:11:18
|
LL | let a = Foo::lol();
| ^^^ function or associated item not found in `dyn Foo<_>`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:15:13
|
LL | let b = Foo::<_>::lol();
| ^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
|
LL | let b = <dyn Foo::<_>>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:15:23
|
LL | let b = Foo::<_>::lol();
| ^^^ function or associated item not found in `dyn Foo<_>`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:19:13
|
LL | let c = Bar::lol();
| ^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
|
LL | let c = <dyn Bar>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:19:18
|
LL | let c = Bar::lol();
| ^^^ function or associated item not found in `dyn Bar<_, _>`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:23:13
|
LL | let d = Bar::<usize, _>::lol();
| ^^^^^^^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
|
LL | let d = <dyn Bar::<usize, _>>::lol();
| ++++ +
error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<usize, _>` in the current scope
--> $DIR/unspecified-self-in-trait-ref.rs:23:30
|
LL | let d = Bar::<usize, _>::lol();
| ^^^ function or associated item not found in `dyn Bar<usize, _>`
warning: trait objects without an explicit `dyn` are deprecated
--> $DIR/unspecified-self-in-trait-ref.rs:27:13
|
LL | let e = Bar::<usize>::lol();
| ^^^^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
|
LL | let e = <dyn Bar::<usize>>::lol();
| ++++ +
error[E0393]: the type parameter `A` must be explicitly specified
--> $DIR/unspecified-self-in-trait-ref.rs:27:13
|
LL | pub trait Bar<X=usize, A=Self> {
| ------------------------------ type parameter `A` must be specified for this
...
LL | let e = Bar::<usize>::lol();
| ^^^^^^^^^^^^ missing reference to `A`
|
= note: because the parameter default references `Self`, the parameter must be specified on the trait object type
error: aborting due to 5 previous errors; 5 warnings emitted
Some errors have detailed explanations: E0393, E0599.
For more information about an error, try `rustc --explain E0393`.