-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add TyCtxt::is_lang_item
, use it in the compiler
#126491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in match lowering cc @Nadrieril Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_sanitizers cc @rust-lang/project-exploit-mitigations, @rcvalle Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Add `TyCtxt::is_lang_item`, use it in the compiler ```rust pub fn is_lang_item(self, def_id: DefId, lang_item: LangItem) -> bool; ``` Easier than having to use `Some(def_id) == tcx.lang_items().iterator_trait()` or something. Also makes it easier to turn into `TraitSolverLangItem` in the future. Hope it's not too bad for perf. r? `@lcnr` or `@oli-obk`
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
266754c
to
93ff86e
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Add `TyCtxt::is_lang_item`, use it in the compiler ```rust pub fn is_lang_item(self, def_id: DefId, lang_item: LangItem) -> bool; ``` Easier than having to use `Some(def_id) == tcx.lang_items().iterator_trait()` or something. Also makes it easier to turn into `TraitSolverLangItem` in the future. Hope it's not too bad for perf. r? `@lcnr` or `@oli-obk`
In my ideal world we'd be able to preregister def ids like we do with symbols, so lang items can be constant def ids that we can match on (instead of having if/elseif chains), but I don't know how to get there yet in a non-hacky way. Something like this is preferrable. If perf is an issue, maybe a macro to hide the boilerplate would work, too? |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (be24883): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 671.997s -> 672.355s (0.05%) |
That's barely anything lol |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (8217b41): comparison URL. Overall result: ❌ regressions - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)Results (primary -2.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (secondary 8.7%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (secondary -0.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 671.712s -> 671.15s (-0.08%) |
I assume this means that the regressions that were seen aren't considered severe enough. @rustbot label: +perf-regression-triaged |
Easier than having to use
Some(def_id) == tcx.lang_items().iterator_trait()
or something. Also makes it easier to turn intoTraitSolverLangItem
in the future. Hope it's not too bad for perf.r? @lcnr or @oli-obk