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

Introduce Lifetime::Error #809

Merged
merged 1 commit into from
Apr 5, 2024
Merged

Introduce Lifetime::Error #809

merged 1 commit into from
Apr 5, 2024

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Apr 2, 2024

r-a has some rudimentary lifetime support now, but due to the lack of an error variant we are using Static for this right now. This results in worse UX as we now show 'static when it's actually some other possibly non 'static lifetime

@@ -555,14 +555,16 @@ bitflags! {
const HAS_CT_PROJECTION = 1 << 9;
/// Does the type contain an error
const HAS_ERROR = 1 << 10;
/// Does the type contain an error lifetime
const HAS_RE_ERROR = 1 << 11;
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to differentiate between the two on the r-a side for filtering reasons wrt to diagnostics and assists

Copy link
Member

Choose a reason for hiding this comment

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

Can you be more specific here? I'm not totally certain why RE_ERROR should be distinct f rom HAS_ERROR; the Rust compiler doesn't distinguish them, so this may complicate later unification.

Copy link
Member Author

@Veykril Veykril Apr 4, 2024

Choose a reason for hiding this comment

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

This is only needed temporarily until we have proper lifetime inference and elision as currently we only support 'static and named lifetimes. Because of that lack of inference and elision the majority of lifetimes will be error lifetimes which would cause us to discard a bunch of diagnostics (we discard them / not compute them on error containing types to not report too many follow up errors).

The bigger one being that exhaustiveness checking on anything containing an error lifetime will be skipped (and skipping an error containing type is required here as the exhaustiveness checking code is likely to panic otherwise).

So, it is not absolutely strictly needed, but it would be nice if we could carry this split for a bit until we have basic lifetime inference and elision implemented.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. I'm happy with this as long as we're okay with the temporary nature of the flag, and possibly more work for r-a to migrate off of this in the future (e.g. if r-a starts using rustc_type_ir, which does not make this distinction and I'm very certain we would not like to introduce this distinction to rustc_type_ir in the future).

@Veykril
Copy link
Member Author

Veykril commented Apr 2, 2024

r? @jackh726

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 5, 2024

📌 Commit 60330f1 has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Apr 5, 2024

⌛ Testing commit 60330f1 with merge 20a72e0...

@bors
Copy link
Contributor

bors commented Apr 5, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 20a72e0 to master...

@bors bors merged commit 20a72e0 into rust-lang:master Apr 5, 2024
7 checks passed
@Veykril Veykril deleted the lt-error branch April 5, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants