1
Fork 0
rust/compiler/rustc_lint/src
Matthias Krüger 5f10a99c7a
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:

acb4e8b625/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.
2024-08-31 10:08:57 +02:00
..
context Disallow setting built-in cfgs via set the command-line 2024-08-07 14:08:34 +02:00
nonstandard_style
async_closures.rs Make it into a structured suggestion, maybe-incorrect 2024-06-28 20:16:35 -04:00
async_fn_in_trait.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
builtin.rs Use a LocalDefId in ResolvedArg. 2024-08-22 01:17:01 +00:00
context.rs Make Span optional in BufferedEarlyLint 2024-08-07 14:08:34 +02:00
deref_into_dyn_supertrait.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
drop_forget_useless.rs Fix handling of macro arguments within the `dropping_copy_types lint 2024-08-22 13:32:01 +02:00
early.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
enum_intrinsics_non_enums.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
errors.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
expect.rs Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
for_loops_over_fallibles.rs Use is_lang_item more 2024-08-13 16:44:53 -04:00
foreign_modules.rs Don't use TyKind in lint 2024-08-24 17:16:39 -04:00
hidden_unicode_codepoints.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
impl_trait_overcaptures.rs Rollup merge of #129600 - traviscross:TC/tie-impl_trait_overcaptures-to-rust-2024, r=compiler-errors 2024-08-26 17:25:34 +02:00
internal.rs Refactor: diagnostic_outside_of_impl, untranslatable_diagnostic 2024-08-10 21:53:01 +03:00
invalid_from_utf8.rs Remove extern crate rustc_session from rustc_lint. 2024-04-29 13:57:41 +10:00
late.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
let_underscore.rs rustc_lint: make let-underscore-lock translatable 2024-07-30 00:34:27 +03:00
levels.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
lib.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
lints.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
macro_expr_fragment_specifier_2024_migration.rs Insert some blank lines. 2024-07-30 07:25:15 +10:00
map_unit_fn.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
methods.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
multiple_supertrait_upcastable.rs Stop using ty::GenericPredicates for non-predicates_of queries 2024-08-29 00:17:40 -04:00
non_ascii_idents.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
non_fmt_panic.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
non_local_def.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
nonstandard_style.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
noop_method_call.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
opaque_hidden_inferred_bound.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
pass_by_value.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
passes.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
precedence.rs Temporarily switch ambiguous_negative_literals lint to allow 2024-07-31 19:36:47 +02:00
ptr_nulls.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
redundant_semicolon.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
reference_casting.rs Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
shadowed_into_iter.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
tail_expr_drop_order.rs lint on tail expr drop order change in Edition 2024 2024-08-21 01:05:21 +08:00
tests.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
traits.rs Use is_lang_item more 2024-08-13 16:44:53 -04:00
types.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
unit_bindings.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
unused.rs Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00