mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
d8456855f5
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. |
||
---|---|---|
.. | ||
auxiliary | ||
incomplete-fn-in-struct-definition.rs | ||
incomplete-fn-in-struct-definition.stderr | ||
issue-80853.rs | ||
issue-80853.stderr | ||
large-records.rs | ||
method-chain-expression-failure.rs | ||
method-chain-expression-failure.stderr | ||
multi-line-fru-suggestion.rs | ||
multi-line-fru-suggestion.stderr | ||
rhs-type.rs | ||
struct-base-wrong-type.rs | ||
struct-base-wrong-type.stderr | ||
struct-duplicate-comma.fixed | ||
struct-duplicate-comma.rs | ||
struct-duplicate-comma.stderr | ||
struct-field-cfg.rs | ||
struct-field-cfg.stderr | ||
struct-field-init-syntax.rs | ||
struct-field-init-syntax.stderr | ||
struct-field-privacy.rs | ||
struct-field-privacy.stderr | ||
struct-fields-decl-dupe.rs | ||
struct-fields-decl-dupe.stderr | ||
struct-fields-dupe.rs | ||
struct-fields-dupe.stderr | ||
struct-fields-hints-no-dupe.rs | ||
struct-fields-hints-no-dupe.stderr | ||
struct-fields-hints.rs | ||
struct-fields-hints.stderr | ||
struct-fields-missing.rs | ||
struct-fields-missing.stderr | ||
struct-fields-shorthand-unresolved.rs | ||
struct-fields-shorthand-unresolved.stderr | ||
struct-fields-shorthand.rs | ||
struct-fields-shorthand.stderr | ||
struct-fields-too-many.rs | ||
struct-fields-too-many.stderr | ||
struct-fields-typo.rs | ||
struct-fields-typo.stderr | ||
struct-fn-in-definition.rs | ||
struct-fn-in-definition.stderr | ||
struct-missing-comma.fixed | ||
struct-missing-comma.rs | ||
struct-missing-comma.stderr | ||
struct-pat-derived-error.rs | ||
struct-pat-derived-error.stderr | ||
struct-path-alias-bounds.rs | ||
struct-path-alias-bounds.stderr | ||
struct-path-associated-type.rs | ||
struct-path-associated-type.stderr | ||
struct-path-self-type-mismatch.rs | ||
struct-path-self-type-mismatch.stderr | ||
struct-path-self.rs | ||
struct-path-self.stderr | ||
struct-record-suggestion.fixed | ||
struct-record-suggestion.rs | ||
struct-record-suggestion.stderr | ||
struct-tuple-field-names.rs | ||
struct-tuple-field-names.stderr | ||
struct-variant-privacy-xc.rs | ||
struct-variant-privacy-xc.stderr | ||
struct-variant-privacy.rs | ||
struct-variant-privacy.stderr | ||
structure-constructor-type-mismatch.rs | ||
structure-constructor-type-mismatch.stderr | ||
suggest-private-fields.rs | ||
suggest-private-fields.stderr | ||
suggest-replacing-field-when-specifying-same-type.rs | ||
suggest-replacing-field-when-specifying-same-type.stderr | ||
unresolved-struct-with-fru.rs | ||
unresolved-struct-with-fru.stderr |