Uh oh!
There was an error while loading. Please reload this page.
Tweak impl signature mismatch errors involving RegionKind::ReVar lifetimes - #67460
Conversation
estebank
commented
Dec 20, 2019
CC @rust-lang/wg-diagnostics we should probably have a follow up to detect these cases in particular and explain that the |
This comment has been minimized.
This comment has been minimized.
estebank
commented
Dec 22, 2019
7bcc539 to
a4967d9CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
7ad6d8f to
7c00f7aCompareRegionKind::ReVar lifetimes in diagnostics RegionKind::ReVar lifetimes
This comment has been minimized.
This comment has been minimized.
RegionKind::ReVar lifetimesRegionKind::ReVar lifetimes
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
this seems sort of misleading, no?
That is, I think the proper fix here is
impl<'a>HaveRelationship<&'aProofReader>forArticle{fnget_relation(&self) -> &'aProofReader{//~^ ERROR `impl` item signature doesn't match `trait` item signature&self.proof_reader}}but I'm not sure how the new error would lead me there....
There was a problem hiding this comment.
But that doesn't work either because HaveRelationship needs a lifetime so that get_relation takes a &'a self instead of &self. Shouldn't the correct change be?:
pubtraitHaveRelationship<'a,To:'a>{fnget_relation(&'aself) -> To;}impl<'a>HaveRelationship<'a,&'aProofReader>forArticle{fnget_relation(&'aself) -> &'aProofReader{&self.proof_reader}}There was a problem hiding this comment.
Let's discuss this in the issue :)
bors
commented
Feb 4, 2020
☔ The latest upstream changes (presumably #68377) made this pull request unmergeable. Please resolve the merge conflicts. |
e2049ee to
bcf34c7Compare
This comment has been minimized.
This comment has been minimized.
8fb857d to
63c56d4Compareestebank
commented
May 28, 2020
bors
commented
May 28, 2020
📌 Commit f213acf has been approved by |
estebank
commented
May 28, 2020
@bors r=nikomatsakis @nikomatsakis made tiny tweak to account for |
bors
commented
May 28, 2020
📌 Commit 1bd6970 has been approved by |
Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes Fixrust-lang#66406, fixrust-lang#72106. ``` error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-param-without-lifetime-constraint.rs:14:5 | LL | fn get_relation(&self) -> To; | ----------------------------- expected `fn(&Article) -> &ProofReader` ... LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader` | = note: expected `fn(&Article) -> &ProofReader` found `fn(&Article) -> &ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/trait-param-without-lifetime-constraint.rs:10:31 | LL | fn get_relation(&self) -> To; | ^^ consider borrowing this type parameter in the trait ``` r? @nikomatsakis
Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes Fixrust-lang#66406, fixrust-lang#72106. ``` error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-param-without-lifetime-constraint.rs:14:5 | LL | fn get_relation(&self) -> To; | ----------------------------- expected `fn(&Article) -> &ProofReader` ... LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader` | = note: expected `fn(&Article) -> &ProofReader` found `fn(&Article) -> &ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/trait-param-without-lifetime-constraint.rs:10:31 | LL | fn get_relation(&self) -> To; | ^^ consider borrowing this type parameter in the trait ``` r? @nikomatsakis
Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes Fixrust-lang#66406, fixrust-lang#72106. ``` error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-param-without-lifetime-constraint.rs:14:5 | LL | fn get_relation(&self) -> To; | ----------------------------- expected `fn(&Article) -> &ProofReader` ... LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader` | = note: expected `fn(&Article) -> &ProofReader` found `fn(&Article) -> &ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/trait-param-without-lifetime-constraint.rs:10:31 | LL | fn get_relation(&self) -> To; | ^^ consider borrowing this type parameter in the trait ``` r? @nikomatsakis
bors
commented
May 29, 2020
⌛ Testing commit 1bd6970 with merge 7173e7b8fe4935c4d2567a0144469d4166541af5... |
Dylan-DPC-zz
commented
May 29, 2020
@bors retry yield |
Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes Fixrust-lang#66406, fixrust-lang#72106. ``` error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-param-without-lifetime-constraint.rs:14:5 | LL | fn get_relation(&self) -> To; | ----------------------------- expected `fn(&Article) -> &ProofReader` ... LL | fn get_relation(&self) -> &ProofReader { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&Article) -> &ProofReader` | = note: expected `fn(&Article) -> &ProofReader` found `fn(&Article) -> &ProofReader` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/trait-param-without-lifetime-constraint.rs:10:31 | LL | fn get_relation(&self) -> To; | ^^ consider borrowing this type parameter in the trait ``` r? @nikomatsakis
Rollup of 9 pull requests Successful merges: - rust-lang#67460 (Tweak impl signature mismatch errors involving `RegionKind::ReVar` lifetimes) - rust-lang#71095 (impl From<[T; N]> for Box<[T]>) - rust-lang#71500 (Make pointer offset methods/intrinsics const) - rust-lang#71804 (linker: Support `-static-pie` and `-static -shared`) - rust-lang#71862 (Implement RFC 2585: unsafe blocks in unsafe fn) - rust-lang#72103 (borrowck `DefId` -> `LocalDefId`) - rust-lang#72407 (Various minor improvements to Ipv6Addr::Display) - rust-lang#72413 (impl Step for char (make Range*<char> iterable)) - rust-lang#72439 (NVPTX support for new asm!) Failed merges: r? @ghost
bors
commented
May 30, 2020
☔ The latest upstream changes (presumably #72756) made this pull request unmergeable. Please resolve the merge conflicts. |


Fix#66406, fix#72106.
r? @nikomatsakis