Pass the whole GenericArgs to Interner::for_each_relevant_impl()#156295
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (f3ca1e1): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 3.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 497.449s -> 499.373s (0.39%) |
This comment has been minimized.
This comment has been minimized.
c9f8bab to
41cb440
Compare
This comment has been minimized.
This comment has been minimized.
|
How does this help rust-analyzer in finding impls inside fn bodies? |
|
Basically, instead of considering the block of the trait and |
|
At the risk of stating the obvious, in rustc, IINM I assume that you also only use |
|
rust-analyzer has different treatment for impls in bodies, for both performance and incrementality reasons we can't access all impls literally. We special case |
| trait_def_id: DefId, | ||
| self_ty: Ty<'tcx>, | ||
| args: ty::GenericArgsRef<'tcx>, |
There was a problem hiding this comment.
pass in the TraitRef instead
There was a problem hiding this comment.
The reason I didn't is that for some predicates (normalization) retrieving the trait predicate requires knowing what args belong to the parent trait which require calling the interner, which might have a performance effect.
There was a problem hiding this comment.
oh, that's subtle. So the args here can also contain the GAT arguments. I think that's slightly confusing and I am fairly confident that computing the TraitRef is cheap enough to not have a perf impact, would you mind trying that. with this and green perf, r=me
currently switching the new solver back to eager norm, at which point all args of the trait_ref will be fully normalized |
This comment has been minimized.
This comment has been minimized.
And not just the self type. rustc does not make use of this, but rust-analyzer needs it to support impls in the same block as args, see https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/non.20local.20impls.20for.20generic.20args/with/593629693. I'm not entirely sure this covers all cases (e.g. an unnormalized alias), and wants feedback from a types team member.
41cb440 to
abbfd2c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (6ee476e): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (secondary 6.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 511.037s -> 490.637s (-3.99%) |
|
@bors r=lcnr |
…uwer Rollup of 11 pull requests Successful merges: - #155722 (Introduce aarch64-unknown-linux-pauthtest target) - #156230 (tests: check wasm compiler_builtins object architecture) - #156295 (Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()`) - #158375 (Support `DefKind::InlineConst` in `ConstKind::Unevaluated`) - #158556 (delegation: store child segment flag in `PathSegment`) - #158081 (trait-system: Recover deferred closure calls after errors) - #158468 (Include default-stability info in rustdoc JSON.) - #158543 (Note usage of documentation hard links in `core::io`) - #158564 (fix `-Z min-recursion-limit` unstable chapter name) - #158568 (llvm-wrapper: use accessors for private fields in LLVM 23+) - #158582 (Comment on needed RAM in huge-stacks.rs)
…uwer Rollup of 11 pull requests Successful merges: - #155722 (Introduce aarch64-unknown-linux-pauthtest target) - #156230 (tests: check wasm compiler_builtins object architecture) - #156295 (Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()`) - #158375 (Support `DefKind::InlineConst` in `ConstKind::Unevaluated`) - #158556 (delegation: store child segment flag in `PathSegment`) - #158081 (trait-system: Recover deferred closure calls after errors) - #158468 (Include default-stability info in rustdoc JSON.) - #158543 (Note usage of documentation hard links in `core::io`) - #158564 (fix `-Z min-recursion-limit` unstable chapter name) - #158568 (llvm-wrapper: use accessors for private fields in LLVM 23+) - #158582 (Comment on needed RAM in huge-stacks.rs)
…uwer Rollup of 11 pull requests Successful merges: - #155722 (Introduce aarch64-unknown-linux-pauthtest target) - #156230 (tests: check wasm compiler_builtins object architecture) - #156295 (Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()`) - #158375 (Support `DefKind::InlineConst` in `ConstKind::Unevaluated`) - #158556 (delegation: store child segment flag in `PathSegment`) - #158081 (trait-system: Recover deferred closure calls after errors) - #158468 (Include default-stability info in rustdoc JSON.) - #158543 (Note usage of documentation hard links in `core::io`) - #158564 (fix `-Z min-recursion-limit` unstable chapter name) - #158568 (llvm-wrapper: use accessors for private fields in LLVM 23+) - #158582 (Comment on needed RAM in huge-stacks.rs)
Rollup merge of #156295 - ChayimFriedman2:for-each-impl-args, r=lcnr Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()` Pass the whole `GenericArgs` to `Interner::for_each_relevant_impl()` And not just the self type. rustc does not make use of this, but rust-analyzer needs it to support impls in the same block as args, see https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/non.20local.20impls.20for.20generic.20args/with/593629693. I'm not entirely sure this covers all cases (e.g. an unnormalized alias), and want feedback from a types team member. r? types
View all comments
Pass the whole
GenericArgstoInterner::for_each_relevant_impl()And not just the self type.
rustc does not make use of this, but rust-analyzer needs it to support impls in the same block as args, see https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/non.20local.20impls.20for.20generic.20args/with/593629693.
I'm not entirely sure this covers all cases (e.g. an unnormalized alias), and want feedback from a types team member.
r? types