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

permit drop impls with generic constants in where clauses #87770

Merged
merged 2 commits into from
Aug 6, 2021

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Aug 4, 2021

Fixes #79248

== is not sufficient to check for equality between unevaluated consts which causes the above issue because the const in [(); N - 1]: on the impl and the const in [(); N - 1]: on the struct def are not seen as equal. Any predicate that can contain an unevaluated const cant use == here as it will cause us to incorrectly emit an error.

I dont know much about chalk but it seems like we ought to be relating the TypeWellFormedFromEnv instead of == as it contains a Ty so I added that too...

r? @lcnr

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

one nit, apart from that r=me

(
ty::PredicateKind::TypeWellFormedFromEnv(a),
ty::PredicateKind::TypeWellFormedFromEnv(b),
) => relator.relate(predicate.rebind(a), p.rebind(b)).is_ok(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure whether TypeWellFormedFromEnv can be part of the generic bounds of either the struct decl or the drop impl.

So these should probably be unreachable, cc @jackh726

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we only generate these as part of the lowering proces for Chalk. If these show up anywhere else, it's a bug.

@lcnr
Copy link
Contributor

lcnr commented Aug 5, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 5, 2021

📌 Commit fa46715 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 Aug 5, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 6, 2021
permit drop impls with generic constants in where clauses

Fixes rust-lang#79248

`==` is not sufficient to check for equality between unevaluated consts which causes the above issue because the const in `[(); N - 1]:` on the impl and the const in `[(); N - 1]:` on the struct def are not seen as equal. Any predicate that can contain an unevaluated const cant use `==` here as it will cause us to incorrectly emit an error.

I dont know much about chalk but it seems like we ought to be relating the `TypeWellFormedFromEnv` instead of `==` as it contains a `Ty` so I added that too...

r? `````@lcnr`````
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 6, 2021
Rollup of 9 pull requests

Successful merges:

 - rust-lang#87561 (thread set_name haiku implementation.)
 - rust-lang#87715 (Add long error explanation for E0625)
 - rust-lang#87727 (explicit_generic_args_with_impl_trait: fix min expected number of generics)
 - rust-lang#87742 (Validate FFI-safety warnings on naked functions)
 - rust-lang#87756 (Add back -Zno-profiler-runtime)
 - rust-lang#87759 (Re-use std::sealed::Sealed in os/linux/process.)
 - rust-lang#87760 (Promote `aarch64-apple-ios-sim` to Tier 2)
 - rust-lang#87770 (permit drop impls with generic constants in where clauses)
 - rust-lang#87780 (alloc: Use intra doc links for the reserve function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8bad350 into rust-lang:master Aug 6, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 6, 2021
@lcnr lcnr added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't implement Drop on type with const_evaluatable_checked where bound
6 participants