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

Erase regions in New Abstract Consts #98499

Merged
merged 1 commit into from
Jun 29, 2022
Merged

Conversation

JulianKnodt
Copy link
Contributor

@JulianKnodt JulianKnodt commented Jun 25, 2022

When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile.

Fixes #98452

r? @lcnr

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

Some changes occured in const_evaluatable.rs

cc @lcnr

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2022
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.

can you add an assert here

for n in self.nodes.iter() {
if let Node::Leaf(ct) = n {
if let ty::ConstKind::Unevaluated(ct) = ct.kind() {
// `AbstractConst`s should not contain any promoteds as they require references which
// are not allowed.
assert_eq!(ct.promoted, None);
}
}
}

that all regions from inside the abstract const are also erased, so something like assert_eq!(ct, self.tcx.erase_regions(ct));

then r=me

@rustbot
Copy link
Collaborator

rustbot commented Jun 29, 2022

Some changes occurred in const_evaluatable.rs

cc @lcnr

@lcnr
Copy link
Contributor

lcnr commented Jun 29, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 29, 2022

📌 Commit 1e40200 has been approved by lcnr

@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 Jun 29, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 29, 2022
Erase regions in New Abstract Consts

When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile.

Fixes rust-lang#98452

r? `@lcnr`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 29, 2022
Erase regions in New Abstract Consts

When an abstract const is constructed, we previously included lifetimes in the set of substitutes, so it was not able to unify two abstract consts if their lifetimes did not match but the values did, despite the values not depending on the lifetimes. This caused code that should have compiled to not compile.

Fixes rust-lang#98452

r? ``@lcnr``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#98415 (Migrate some `rustc_borrowck` diagnostics to `SessionDiagnostic`)
 - rust-lang#98479 (Add `fetch_not` method on `AtomicBool`)
 - rust-lang#98499 (Erase regions in New Abstract Consts)
 - rust-lang#98516 (library: fix uefi va_list type definition)
 - rust-lang#98554 (Fix box with custom allocator in miri)
 - rust-lang#98607 (Clean up arg mismatch diagnostic, generalize tuple wrap suggestion)
 - rust-lang#98625 (emit Retag for compound types with reference fields)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7b9a7ef into rust-lang:master Jun 29, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jun 29, 2022
@JulianKnodt JulianKnodt deleted the erase_lifetime branch June 30, 2022 06:12
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.

gce: try_unify doesn't always ignore lifetimes
5 participants