diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-11-16 02:27:55 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-11-16 16:19:19 +0000 |
| commit | d8456855f5d65a2ed26b09a82c750535a09becdb (patch) | |
| tree | 0f394af2e892cd677570baa23aa7fa9ed948f24c /tests/rustdoc-js-std | |
| parent | a7e035ab899be54fda12c6bae6ef7ecbcce0aaea (diff) | |
| download | rust-d8456855f5d65a2ed26b09a82c750535a09becdb.tar.gz rust-d8456855f5d65a2ed26b09a82c750535a09becdb.zip | |
Suggest replacing `Self` with the right type on type error
When encountering a type error caused by the use of `Self`, suggest
using the actual type name instead.
```
error[E0308]: mismatched types
--> $DIR/struct-path-self-type-mismatch.rs:13:9
|
LL | impl<T> Foo<T> {
| - ------ this is the type of the `Self` literal
| |
| found type parameter
LL | fn new<U>(u: U) -> Foo<U> {
| - ------ expected `Foo<U>` because of return type
| |
| expected type parameter
LL | / Self {
LL | |
LL | | inner: u
LL | |
LL | | }
| |_________^ expected `Foo<U>`, found `Foo<T>`
|
= note: expected struct `Foo<U>`
found struct `Foo<T>`
= note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
= note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
help: use the type name directly
|
LL | Foo::<U> {
| ~~~~~~~~
```
Fix #76086.
Diffstat (limited to 'tests/rustdoc-js-std')
0 files changed, 0 insertions, 0 deletions
