Repository navigation
Lifetime bound error when using the indexing operator with an associated type containing a lifetime #32382
Description
Activity
also @rust-lang/compiler
- addedregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
on Mar 21, 2016 - addedT-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 team
on Jun 23, 2016 I will look at this.
marking as P-medium nonetheless, since I am not convinced this needs to high priority...
- addedA-type-systemArea: Type systemArea: Type systemA-borrow-checkerArea: The borrow checkerArea: The borrow checkerand removedA-borrow-checkerArea: The borrow checkerArea: The borrow checker
on Sep 13, 2016 2 remaining items
@pnkfelix You are currently assigned to this, are you still investigating?
cc @nikomatsakis as well
I'm running into this issue as well when trying to convert
get().unwrap()to an index operation on this line:
https://github.com/JelteF/derive_more/blob/2e37e7f8181ba333df9503088222772b77c83d91/src/from.rs#L103It indeed works fine when manually calling
index().- addedfixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.
on Oct 4, 2018 I just tried this out with the 2018 edition and it works there. Or on the nightly compiler, one can add
#![feature(nll)]to get the fix.We should add a regression test before closing though.
- addedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Oct 4, 2018 - added a commit that references this issue
on Oct 4, 2018 - added a commit that references this issue
on Oct 6, 2018 #54812 added the test.
- removedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Nov 9, 2018 NLL (migrate mode) is enabled in all editions as of PR #59114. Verified that test case compiled in Nightly 2015 edition; closing as fixed.
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.