Skip to content

Erase regions in New Abstract Consts - #98499

Merged
bors merged 1 commit into
rust-lang:masterfrom
JulianKnodt:erase_lifetime
Jun 29, 2022
Merged

Erase regions in New Abstract Consts#98499
bors merged 1 commit into
rust-lang:masterfrom
JulianKnodt:erase_lifetime

Conversation

@JulianKnodt

@JulianKnodtJulianKnodt commented Jun 25, 2022

Copy link
Copy Markdown
Contributor

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

@rustbotrustbot 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
Copy Markdown
Contributor

Some changes occured in const_evaluatable.rs

cc @lcnr

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2022

@lcnrlcnr left a comment

Copy link
Copy Markdown
Contributor

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 inself.nodes.iter(){
ifletNode::Leaf(ct) = n {
iflet 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
Copy Markdown
Collaborator

Some changes occurred in const_evaluatable.rs

cc @lcnr

@lcnr

lcnr commented Jun 29, 2022

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@bors

bors commented Jun 29, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 1e40200 has been approved by lcnr

@borsbors 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.
Fixesrust-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.
Fixesrust-lang#98452
r? ``@lcnr``
@Dylan-DPCDylan-DPC mentioned this pull request Jun 29, 2022
@Dylan-DPCDylan-DPC mentioned this pull request Jun 29, 2022
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:masterJun 29, 2022
@rustbotrustbot 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@JulianKnodt@rust-highfive@rustbot@lcnr@bors