Repository navigation
Bad diagnostics for GATs in trait paths #81801
Copy link
Copy link
Closed
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
The diagnostics introduced by #77524 are wrong in some cases, e.g. in gat-trait-path-missing-lifetime we get the following stderr:
error[E0107]: missing generics for associated type `X::Y`
--> src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs:5:8
|
5 | type Y<'a>;
| ^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> src/test/ui/generic-associated-types/gat-trait-path-missing-lifetime.rs:5:8
|
5 | type Y<'a>;
| ^ --
help: use angle brackets to add missing lifetime argument
|
5 | type Y<'a><'a>;
| ^^^^
error: aborting due to previous error; 1 warning emitted
Originally posted by @b-naber in #79554 (comment)
Reacted by Henry Boisdequin, Esteban Kuber, Mingwei Samuel and Felipe S. S. Schneider
Reacted by Martin Habovštiak and Felipe S. S. Schneider
Metadata
Metadata
Assignees
Labels
A-GATsArea: Generic associated types (GATs)Area: Generic associated types (GATs)A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATs`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Activity
henryboisdequin commentedon Feb 10, 2021
The fix to this would be pointing to
fn foo<'a, T1: X<Y = T1>>(t : T1) -> T1::Y<'a>and emmiting the error there right?b-naber commentedon Feb 11, 2021
Yes.
estebank commentedon Feb 14, 2021
Another case:
Auto merge of rust-lang#82272 - b-naber:gat_diag, r=estebank,jackh726