This commit removes all logic which marks parameters as used based on
their presence in predicates - given rust-lang/rust#75675, this will
enable more polymorphization and avoid the symbol clashes that predicate
logic previously sidestepped.
Signed-off-by: David Wood <david@davidtw.co>
This commit modifies polymorphization's handling of predicates so that
if any generic parameter is used in a predicate then all parameters in
that predicate are used.
Signed-off-by: David Wood <david@davidtw.co>
This commit adjusts polymorphization's handling of predicates so that
after ensuring that `T` is used in `I: Foo<T>` if `I` is used, it now
ensures that `I` is used if `T` is used in `I: Foo<T>`. This is
necessary to mark generic parameters that only exist in impl parameters
as used - thereby avoiding symbol clashes when using the new mangling
scheme.
Signed-off-by: David Wood <david@davidtw.co>
This commit disables polymorphisation to resolve regressions related to
closures which inherit unused generic parameters and are then used in
casts or reflection.
Signed-off-by: David Wood <david@davidtw.co>
This commit replaces the `-Z polymorphize-errors` debugging flag with a
`#[rustc_polymorphize_error]` attribute for use on functions.
Signed-off-by: David Wood <david@davidtw.co>
This commit implements the `unused_generic_params` query, an initial
version of polymorphization which detects when an item does not use
generic parameters and is being needlessly monomorphized as a result.
Signed-off-by: David Wood <david@davidtw.co>