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
Use fulfillment to check Drop
impl compatibility
#110577
Conversation
06d9150
to
85d8079
Compare
r? @lcnr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after nits
85d8079
to
c691133
Compare
wait, not r=me 😅 time for fcp 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some tests showing how we now check Drop
semantically
thinking of some interesting cases:
- adding a
'static: 'a
bound - explicitly require a super trait
- have an additional
Vec<T>: Clone
bound implied byT: Clone
- explicitly state transitive dependency for outlives,
'a, 'b: 'a, 'c: 'b
, adding'c: 'a
in theDrop
impül - different way to specify equality of a group of lifetimes, e.g.
'a: 'b, 'b: 'c, 'c: 'a
vs'a: 'b + 'c, 'b: 'a, 'c: 'a
- implied lt bound in the definition, explicit one in the impl
with this we need an FCP as reverting this change will be breaking. I do really prefer this over the status quo. We already need some hacks here as e.g. unevaluated constants are never structurally eqiual so we need at least some sort of semantic equality her.
Added tests. Per description and lcnr's comment above, this PR changes the way we do the Since we now accept more I can't see any reason why we would prefer the check that we have right now or ever move back to it-- it's both fragile to experimental and future trait system features (constification, changes to implied bounds, non-lifetime-binders, generic const exprs) and also more confusing to understand since it's one of the only places in the type-checking layer that we actually care about syntactic rather than semantic implication. So with that... @rfcbot fcp merge |
This comment was marked as duplicate.
This comment was marked as duplicate.
Oh, lol, it didn't start a compiler fcp luckily. @rfcbot fcp merge |
Team member @compiler-errors has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit f302ed27f4c28968f630ef1edd12aba3675ebcf5 with merge 516aada95cba5f300f9ea07f80a58cd961ea7736... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (516aada95cba5f300f9ea07f80a58cd961ea7736): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
|
@rfcbot fcp reviewed cc @spastorino this is relevant to the "always applicable negative impls" discussion we were having recently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after oli's review
f302ed2
to
f4c77b8
Compare
@bors r=lcnr |
📌 Commit f4c77b8f45098ba57cf99a7850c752847cb6ba1f has been approved by It is now in the queue for this repository. |
☔ The latest upstream changes (presumably #111174) made this pull request unmergeable. Please resolve the merge conflicts. |
f4c77b8
to
2e346b6
Compare
@bors r=lcnr |
@bors rollup=maybe |
… r=lcnr Use fulfillment to check `Drop` impl compatibility Use an `ObligationCtxt` to ensure that a `Drop` impl does not have stricter requirements than the ADT that it's implemented for, rather than using a `SimpleEqRelation` to (more or less) syntactically equate predicates on an ADT with predicates on an impl. r? types ### Some background The old code reads: ```rust // An earlier version of this code attempted to do this checking // via the traits::fulfill machinery. However, it ran into trouble // since the fulfill machinery merely turns outlives-predicates // 'a:'b and T:'b into region inference constraints. It is simpler // just to look for all the predicates directly. ``` I'm not sure what this means, but perhaps in the 8 years since that this comment was written (cc rust-lang#23638) it's gotten easier to process region constraints after doing fulfillment? I don't know how this logic differs from anything we do in the `compare_impl_item` module. Ironically, later on it says: ```rust // However, it may be more efficient in the future to batch // the analysis together via the fulfill (see comment above regarding // the usage of the fulfill machinery), rather than the // repeated `.iter().any(..)` calls. ``` Also: * Removes `SimpleEqRelation` which was far too syntactical in its relation. * Fixes rust-lang#110557
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#110577 (Use fulfillment to check `Drop` impl compatibility) - rust-lang#110610 (Add Terminator conversion from MIR to SMIR, part #1) - rust-lang#110985 (Fix spans in LLVM-generated inline asm errors) - rust-lang#110989 (Make the BUG_REPORT_URL configurable by tools ) - rust-lang#111167 (debuginfo: split method declaration and definition) - rust-lang#111230 (add hint for =< as <=) - rust-lang#111279 (More robust debug assertions for `Instance::resolve` on built-in traits with non-standard trait items) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Use an
ObligationCtxt
to ensure that aDrop
impl does not have stricter requirements than the ADT that it's implemented for, rather than using aSimpleEqRelation
to (more or less) syntactically equate predicates on an ADT with predicates on an impl.r? types
Some background
The old code reads:
I'm not sure what this means, but perhaps in the 8 years since that this comment was written (cc #23638) it's gotten easier to process region constraints after doing fulfillment? I don't know how this logic differs from anything we do in the
compare_impl_item
module. Ironically, later on it says:Also:
SimpleEqRelation
which was far too syntactical in its relation.bound types encountered in super_relate_tys
#110557