Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay span bug when we can't map lifetimes back in collect_trait_impl_trait_tys #103409

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

compiler-errors
Copy link
Member

When a lifetime is late-bound in a trait signature, but early-bound in an impl signature, we already emit an error -- however, we also ICE in collect_trait_impl_trait_tys, so just delay a bug here.

Fixes #103407

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 22, 2022
@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 22, 2022
Comment on lines 10 to 11
= note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error kinda sucks, but it's not really RPITIT's fault.

@compiler-errors compiler-errors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 23, 2022
@compiler-errors
Copy link
Member Author

This needs blessing after #103414 lands

notriddle added a commit to notriddle/rust that referenced this pull request Oct 23, 2022
…jgillot

Pretty print lifetimes captured by RPIT

This specifically makes the output in rust-lang#103409 change from:

```diff
  error: `impl` item signature doesn't match `trait` item signature
    --> $DIR/signature-mismatch.rs:15:5
     |
  LL |     fn async_fn(&self, buff: &[u8]) -> impl Future<Output = Vec<u8>>;
     |     ----------------------------------------------------------------- expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
  ...
  LL |     fn async_fn<'a>(&self, buff: &'a [u8]) -> impl Future<Output = Vec<u8>> + 'a {
-  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
+  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
     |
     = note: expected `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
-               found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>>`
+               found `fn(&'1 Struct, &'2 [u8]) -> impl Future<Output = Vec<u8>> + '2`
     = help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait`
     = help: verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output

  error: aborting due to previous error
```

Along with the UI tests in this PR, which I think are all improvements!

r? `@oli-obk` though feel free to re-roll
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, then r=me

compiler/rustc_hir_analysis/src/check/compare_method.rs Outdated Show resolved Hide resolved
@compiler-errors compiler-errors force-pushed the rpitit-signature-mismatch branch from 4530a06 to fa5cf90 Compare October 24, 2022 18:46
@compiler-errors
Copy link
Member Author

@bors r=lcnr rollup

@bors
Copy link
Contributor

bors commented Oct 24, 2022

📌 Commit fa5cf90 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 24, 2022
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Oct 24, 2022
…ismatch, r=lcnr

Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`

When a lifetime is late-bound in a trait signature, but early-bound in an impl signature, we already emit an error -- however, we also ICE in `collect_trait_impl_trait_tys`, so just delay a bug here.

Fixes rust-lang#103407
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 25, 2022
Rollup of 11 pull requests

Successful merges:

 - rust-lang#103333 (Fix assertion failed for break_last_token and trailing token)
 - rust-lang#103350 (Change terminology for assoc method suggestions when they are not called)
 - rust-lang#103382 (Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`)
 - rust-lang#103409 (Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`)
 - rust-lang#103410 (-Z docs: Add link to unstable book)
 - rust-lang#103462 (rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`)
 - rust-lang#103465 (E0210 explanation: remove redundant sentence)
 - rust-lang#103486 (Use functions in highlight-colors rustdoc GUI test)
 - rust-lang#103493 (rustdoc: remove unused `.sidebar-logo` DOM on source pages)
 - rust-lang#103494 (rustdoc: remove redundant CSS `a.test-arrow:hover`)
 - rust-lang#103495 (rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 12babb6 into rust-lang:master Oct 25, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 25, 2022
@compiler-errors compiler-errors deleted the rpitit-signature-mismatch branch November 2, 2022 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE with RPITIT and lifetimes
5 participants