Uh oh!
There was an error while loading. Please reload this page.
Reference lang items during AST lowering - #75145
Conversation
DefIds for lang itemspetrochenkov
commented
Aug 9, 2020
(I'll review this next weekend or during the week.) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This commit adds support for lang items (`#[lang = "..."]` attributes) on enum variants. Signed-off-by: David Wood <david@davidtw.co>
This commit adds a test for rust-lang#61019 where a extern crate is imported as `std` which results in name resolution to fail due to the uses of `std` types introduced from lowering. Signed-off-by: David Wood <david@davidtw.co>
This commit adds new lang items which will be used in AST lowering once `QPath::LangItem` is introduced. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (rust-lang#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
This commit implements support for `QPath::LangItem` and `GenericBound::LangItemTrait` in save analysis. Signed-off-by: David Wood <david@davidtw.co>
This commit simplifies `is_range_literal` by checking for `QPath::LangItem` containing range-related lang items, rather than using a heuristic. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
This commit modifies name resolution to ensure that new scopes are introduced from lang-item generic bounds. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
This commit adds support for cleaning `QPath::LangItem` and `hir::GenericBound::LangItemTrait` in rustdoc. `QPath::LangItem` does not require lowering, and `hir::GenericBound::LangItemTrait` is lowered to a `GenericBound::TraitBound`. Signed-off-by: David Wood <david@davidtw.co>
8d886c4 to
bde529fComparepetrochenkov
commented
Aug 16, 2020
@bors r+ |
bors
commented
Aug 16, 2020
📌 Commit bde529f has been approved by |
…efid-for-lang-items, r=petrochenkov Preallocate `DefId`s for lang items Fixesrust-lang#60607 and fixesrust-lang#61019. This PR introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols: - Credit for much of this work goes to @matthewjasper, I basically just [rebased their earlier work](matthewjasper@a227c70#diff-c0f791ead38d2d02916faaad0f56f41d). - Changes to Clippy might not be correct, they compile but attempting to run tests through `./x.py` produced failures which appeared spurious, so I didn't run any clippy tests. - Changes to save analysis might not be correct - tests pass but I don't have a lot of confidence in those changes being correct. - I've used `GenericBounds::LangItemTrait` rather than changing `PolyTraitRef`, as suggested by @matthewjasper [in this comment](matthewjasper@a227c70#r40107992) but I'd prefer that be left for a follow-up. - I've split things into smaller commits fairly arbitrarily to make the diff easier to review, each commit should compile but might not pass tests until the final commit. r? @oli-obk cc @matthewjasper
eddyb
commented
Aug 16, 2020
You can use |
eddyb
commented
Aug 16, 2020
Btw the title still says "Preallocate (the alternative to this would be doing lang item collection before the HIR, but I think this solution is nicer) Also, surely this has perf implications? @bors try @rust-timer queue |
bors
commented
Aug 16, 2020
🙅 Please do not |
rust-timer
commented
Aug 16, 2020
Awaiting bors try build completion |
bors
commented
Aug 16, 2020
⌛ Trying commit bde529f with merge 48b5808e9529407d15e12c40168e01ce15a6e9db... |
bors
commented
Aug 16, 2020
☀️ Try build successful - checks-actions, checks-azure |
rust-timer
commented
Aug 16, 2020
Queued 48b5808e9529407d15e12c40168e01ce15a6e9db with parent 9b4db69, future comparison URL. |
rust-timer
commented
Aug 17, 2020
Finished benchmarking try commit (48b5808e9529407d15e12c40168e01ce15a6e9db): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Perhaps unsurprisingly, this is a nice win for |
petrochenkov
commented
Aug 17, 2020
It's |
This commit updates clippy with the introduction of `QPath::LangItem` so that it still compiles. Signed-off-by: David Wood <david@davidtw.co>
bde529f to
f1ce294Comparedavidtwco
commented
Aug 17, 2020
Alright - I've ran the clippy tests now and fixed all of the issues that this introduced. |
DefIds for lang itemspetrochenkov
commented
Aug 17, 2020
@bors r+ |
bors
commented
Aug 17, 2020
📌 Commit f1ce294 has been approved by |
bors
commented
Aug 17, 2020
bors
commented
Aug 17, 2020
☀️ Test successful - checks-actions, checks-azure |
Final perf results show a small win as expected. Nice work! |
Fixes#60607 and fixes#61019.
This PR introduces
QPath::LangItemto the HIR and uses it in AST lowering instead of constructing ahir::Pathfrom a slice of symbols:Changes to Clippy might not be correct, they compile but attempting to run tests through./x.pyproduced failures which appeared spurious, so I didn't run any clippy tests.GenericBounds::LangItemTraitrather than changingPolyTraitRef, as suggested by @matthewjasperin this comment but I'd prefer that be left for a follow-up.r? @oli-obk
cc @matthewjasper