diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-31 10:08:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-31 10:08:57 +0200 |
| commit | 5f10a99c7a0186994059f05a580e26070168ed58 (patch) | |
| tree | 0a59d023ce2558c65d356637fd236eafc0f861dc /compiler/rustc_interface/src | |
| parent | 44185520cf0b86e4c0b1fc0340076355baa316b8 (diff) | |
| parent | 92004523dbcb0336d2f752cd30c300ae6d8df8b9 (diff) | |
| download | rust-5f10a99c7a0186994059f05a580e26070168ed58.tar.gz rust-5f10a99c7a0186994059f05a580e26070168ed58.zip | |
Rollup merge of #129725 - compiler-errors:predicates-of, r=fmease
Stop using `ty::GenericPredicates` for non-predicates_of queries `GenericPredicates` is a struct of several parts: A list of of an item's own predicates, and a parent def id (and some effects related stuff, but ignore that since it's kinda irrelevant). When instantiating these generic predicates, it calls `predicates_of` on the parent and instantiates its predicates, and appends the item's own instantiated predicates too: https://github.com/rust-lang/rust/blob/acb4e8b6251f1d8da36f08e7a70fa23fc581839e/compiler/rustc_middle/src/ty/generics.rs#L407-L413 Notice how this should result in a recursive set of calls to `predicates_of`... However, `GenericPredicates` is *also* misused by a bunch of *other* queries as a convenient way of passing around a list of predicates. For these queries, we don't ever set the parent def id of the `GenericPredicates`, but if we did, then this would be very easy to mistakenly call `predicates_of` instead of some other intended parent query. Given that footgun, and the fact that we don't ever even *use* the parent def id in the `GenericPredicates` returned from queries like `explicit_super_predicates_of`, It really has no benefit over just returning `&'tcx [(Clause<'tcx>, Span)]`. This PR additionally opts to wrap the results of `EarlyBinder`, as we've tended to use that in the return type of these kinds of queries to properly convey that the user has params to deal with, and it also gives a convenient way of iterating over a slice of things after instantiating.
Diffstat (limited to 'compiler/rustc_interface/src')
0 files changed, 0 insertions, 0 deletions
