-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Lifetime bound error when using the indexing operator with an associated type containing a lifetime #32382
Copy link
Copy link
Closed
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-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.T-langRelevant to the language teamRelevant to the language teamfixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-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.T-langRelevant to the language teamRelevant to the language teamfixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Please consider the following code:
which fails with the following error:
So if I use
.index()and use an associated type it compiles fine. If I use[]and replace the associated type with the underlying type it also compiles fine. Logic would have it that if I use[]and I'll leave the associated type as-is it should also compile fine, but alas, I get an error, which doesn't really make any sense.Rust version: rustc 1.9.0-nightly (b12b4e4 2016-03-17)
This is a regression; this code used to compile on at least 1.4, 1.5 and 1.6; it broke at 1.7.