Conversation
This comment has been minimized.
This comment has been minimized.
src/librustc/ty/instance.rs
Outdated
There was a problem hiding this comment.
I forget where/if I left a comment, but the current situation with Instance's types and Instance::ty_env in particular is pretty bad and we should probably require passing ParamEnv around a lot (or maybe start using ParamEnvAnd<Instance>?).
|
Why does this use |
Using Also, if the parameters are truly unused then we might get away without a |
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>
This commit normalizes function signatures for instances before substituting, a workaround for polymorphization considering parameters unused when they show up in the signature, but not the body (due to being normalized). Unfortunately, this causes test output to change with the parallel compiler only. Signed-off-by: David Wood <david@davidtw.co>
This commit records the results of `unused_generic_params` in crate metadata, hopefully improving performance. 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 introduces a `FiniteBitSet` type which replaces the manual bit manipulation which was being performed in polymorphization. Signed-off-by: David Wood <david@davidtw.co>
912db12 to
4b99699
Compare
|
@bors r=eddyb |
|
📌 Commit 4b99699 has been approved by |
|
🌲 The tree is currently closed for pull requests below priority 5, this pull request will be tested once the tree is reopened |
|
☀️ Test successful - checks-actions, checks-azure |
Tested on commit rust-lang/rust@b52522a. Direct link to PR: <rust-lang/rust#69749> 💔 miri on windows: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung). 💔 miri on linux: test-pass → build-fail (cc @oli-obk @eddyb @RalfJung).
rustup Following rust-lang/rust#69749 I added some `ty::ParamEnv::reveal_all()` even though @eddyb advised me in the past to avoid those.
|
This was a perf loss on landing, as expected. |
This PR implements an analysis to detect when functions could remain polymorphic during code generation.
Fixes #46477
r? @eddyb
cc @rust-lang/wg-mir-opt @nikomatsakis @pnkfelix