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

Fix early param lifetimes in generic_const_exprs #118035

Merged
merged 1 commit into from Nov 21, 2023

Conversation

ouz-a
Copy link
Contributor

@ouz-a ouz-a commented Nov 18, 2023

In cases like below, we never actually be able to capture region name for two reasons, first 'static becomes anonymous lifetime and second we never capture region if it doesn't have a name so this results in ICE.

struct DataWrapper<'static> {
    data: &'a [u8; Self::SIZE],
}

impl DataWrapper<'a> {

Fixes #118021

@rustbot
Copy link
Collaborator

rustbot commented Nov 18, 2023

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 18, 2023
.or_else(|| self.give_name_if_anonymous_region_appears_in_arg_position_impl_trait(fr));

.or_else(|| self.give_name_if_anonymous_region_appears_in_arg_position_impl_trait(fr))
.or_else(|| self.give_name_if_anonymous_region_appears_in_early_param(fr));
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is the most efficient approach, since I don't ever think we expect this branch to be encountered unless we have a pre-existing error, at which point, suggestions are kinda moot in the first place.

Can we just handle the unwrap in #118021 more responsibly? We could perhaps just delay a bug, or report something a bit more vague, or just use unwrap_or_else(|| String::from("'_")).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My initial solution was that but it felt kinda hacky, will do something similar thanks for suggestion!

Copy link
Member

Choose a reason for hiding this comment

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

If you think it's hacky, then I can probably leave more feedback when I can see the changes implemented.

I just don't think we should implement something that looks like "good-path" code that we only expect to implement when errors are co-occurring.

@compiler-errors
Copy link
Member

Fix this, squash it into one commit, and please make the explanation comment a bit longer. r=me after.

@ouz-a
Copy link
Contributor Author

ouz-a commented Nov 20, 2023

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Nov 20, 2023

📌 Commit f68c6c9 has been approved by compiler-errors

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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 20, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 21, 2023
Rollup of 6 pull requests

Successful merges:

 - rust-lang#116085 (rustdoc-search: add support for traits and associated types)
 - rust-lang#117522 (Remove `--check-cfg` checking of command line `--cfg` args)
 - rust-lang#118029 (Expand Miri's BorTag GC to a Provenance GC)
 - rust-lang#118035 (Fix early param lifetimes in generic_const_exprs)
 - rust-lang#118083 (Remove i686-apple-darwin cross-testing)
 - rust-lang#118091 (Remove now deprecated target x86_64-sun-solaris.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 4bb3ae3 into rust-lang:master Nov 21, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 21, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 21, 2023
Rollup merge of rust-lang#118035 - ouz-a:november_ice2, r=compiler-errors

Fix early param lifetimes in generic_const_exprs

In cases like below, we never actually be able to capture region name for two reasons, first `'static` becomes anonymous lifetime and second we never capture region if it doesn't have a name so this results in ICE.
```
struct DataWrapper<'static> {
    data: &'a [u8; Self::SIZE],
}

impl DataWrapper<'a> {
```

Fixes rust-lang#118021
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: None in region_errors
5 participants