rust/compiler/rustc_middle/src
Matthias Krüger bcc9aa01b5
Rollup merge of #110577 - compiler-errors:drop-impl-fulfill, 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 #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 #110557
2023-05-06 13:30:03 +02:00
..
dep_graph Allow LocalDefId as the argument to def_path_str 2023-04-21 22:27:20 +00:00
hir Remove unused TypeFoldable/TypeVisitable impls. 2023-04-26 15:19:50 +10:00
infer Rollup merge of #110386 - nnethercote:clean-up-traversal-macros, r=lcnr 2023-04-17 18:13:35 +02:00
middle Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
mir Rollup merge of #111100 - BoxyUwU:array_repeat_expr_wf, r=compiler-errors 2023-05-04 19:18:21 +02:00
query Remove unneeded encode/decode methods. 2023-05-04 13:11:52 +10:00
thir offset_of 2023-04-21 02:14:02 -07:00
traits Use fulfillment to check Drop impl compatibility 2023-05-04 18:05:58 +00:00
ty Rollup merge of #111173 - nnethercote:still-more-Encoder-cleanups, r=cjgillot 2023-05-05 12:46:27 +09:00
util Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
arena.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
error.rs fix(middle): emit error rather than delay bug when reaching limit 2023-04-03 11:08:14 +08:00
lib.rs Switch impl_tag! from explicit tags to ${index()} 2023-04-24 16:48:37 +00:00
lint.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
macros.rs Simplify CloneLiftImpls and TrivialTypeTraversalImpls. 2023-04-16 14:19:50 +10:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Remove unused TypeFoldable/TypeVisitable impls. 2023-04-26 15:19:50 +10:00
values.rs Avoid ICEing miri on layout query cycles 2023-05-02 16:14:20 +00:00