Commit Graph

6 Commits

Author SHA1 Message Date
David Wood
da2b69b614 polymorphize: remove predicate logic
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>
2021-10-01 16:34:18 +00:00
David Wood
5703b2863e
polymorphize: ∃ used param ∈ predicate → all used
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>
2020-08-17 14:13:58 +01:00
David Wood
bf3ef26713
polymorphize: I used if T used in I: Foo<T>
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>
2020-08-14 23:01:14 +01:00
David Wood
f39ed207fe
sess: disable polymorphisation
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>
2020-07-22 15:36:24 +01:00
David Wood
b1f8bd6356
mir: use attribute over -Z polymorphize-errors
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>
2020-07-20 19:35:35 +01:00
David Wood
2989fea88a
mir: unused_generic_params query
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>
2020-07-20 19:35:30 +01:00