about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2023-04-01slighty simplify a few boolean expressions (clippy::nonminimal_bool)Matthias Krüger-1/+1
2023-04-01fix clippy::iter_kv_mapMatthias Krüger-5/+4
2023-04-01diagnostics: account for glob shadowing when linting redundant importsMichael Howell-14/+21
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2023-03-31Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomezbors-3/+5
Rollup of 7 pull requests Successful merges: - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2) - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`) - #109680 (Fix subslice capture in closure) - #109798 (fluent_messages macro: don't emit the OS error in a note) - #109805 (Source map cleanups) - #109818 (rustdoc: Add GUI test for jump to collapsed item) - #109820 (rustdoc-search: update docs for comma in `?` help popover) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddleGuillaume Gomez-3/+5
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes` Fixes #88070. It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem. r? `@jyn514`
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-0/+2
Initial support for return type notation (RTN) See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/ 1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter. * I'd add this in a follow-up. 3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~ * I don't think we actually want this. 5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`. * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it. 7. ~I'm not in love with the feature gate name 😺~ * I renamed it to `return_type_notation` :heavy_check_mark: Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later. r? `@ghost`
2023-03-31resolve: Restore some effective visibility optimizationsVadim Petrochenkov-8/+28
Something similar was previously removed as a part of #104602, but after this PR all table changes should also be "locally correct" after every update.
2023-03-31Update doc(primitive) in rustc_resolveGuillaume Gomez-3/+5
2023-03-30Fix typoTom Martin-1/+1
2023-03-30Update non-derive macro error message to match suggestionTom Martin-9/+3
It's now split between two errors, one to remove the invalid derive macro and one suggesting adding a new non-derive macro
2023-03-28effvis: Stop considering crate root its own parentVadim Petrochenkov-7/+6
It helped to reuse `update_def` for the crate root, but it created confusion and caused some mistakes when I implemented #109500
2023-03-28effvis: Merge two similar code pathsVadim Petrochenkov-34/+23
2023-03-28Add `(..)` syntax for RTNMichael Goulet-0/+2
2023-03-27Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errorsGuillaume Gomez-3/+1
Remove the `NodeId` of `ast::ExprKind::Async` This is a followup to https://github.com/rust-lang/rust/pull/104833#pullrequestreview-1314537416. In my original attempt, I was using `LoweringContext::expr`, which was not correct as it creates a fresh `DefId`. It now uses the correct `DefId` for the wrapping `Expr`, and also makes forwarding `#[track_caller]` attributes more explicit.
2023-03-26Add suggestion to remove derive() if invoked macro is non-deriveTom Martin-5/+17
2023-03-24Auto merge of #107932 - petrochenkov:onlyexport, r=jyn514bors-2/+19
rustdoc: Skip doc link resolution for non-exported items
2023-03-24Rollup merge of #109536 - petrochenkov:qcstore3, r=cjgillotMatthias Krüger-3/+8
resolve: Rename some cstore methods to match queries and add comments about costs associated with replacing them with query calls. Supersedes https://github.com/rust-lang/rust/pull/108346. r? `@cjgillot`
2023-03-23Rollup merge of #109487 - GuillaumeGomez:move-useless-reexport-check, ↵Matthias Krüger-2/+40
r=petrochenkov Move useless_anynous_reexport lint into unused_imports As mentioned in https://github.com/rust-lang/rust/pull/109003, this check should have been merged with `unused_imports` in the start. r? `@petrochenkov`
2023-03-23Rollup merge of #107880 - jieyouxu:issue-107563, r=petrochenkovMatthias Krüger-20/+85
Lint ambiguous glob re-exports Attempts to fix #107563. We currently already emit errors for ambiguous re-exports when two names are re-exported *specifically*, i.e. not from glob exports. This PR attempts to emit deny-by-default lints for ambiguous glob re-exports.
2023-03-23resolve: Rename some cstore methods to match queries and add commentsVadim Petrochenkov-3/+8
about costs associated with replacing them with query calls.
2023-03-23Auto merge of #108221 - petrochenkov:cratecfg, r=michaelwoeristerbors-7/+8
rustc_interface: Add a new query `pre_configure` It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes. This is a continuation of https://github.com/rust-lang/rust/pull/92473 and one more step to very unstable crate-level proc macro attributes maybe actually working. Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
2023-03-23Auto merge of #109517 - matthiaskrgr:rollup-m3orqzd, r=matthiaskrgrbors-31/+18
Rollup of 7 pull requests Successful merges: - #108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - #109137 (resolve: Querify most cstore access methods (subset 2)) - #109380 (add `known-bug` test for unsoundness issue) - #109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - #109475 (Simpler checked shifts in MIR building) - #109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - #109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23rustdoc: Skip doc link resolution for non-exported itemsVadim Petrochenkov-2/+19
2023-03-23rustc_interface: Add a new query `pre_configure`Vadim Petrochenkov-7/+8
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-23Rollup merge of #109137 - petrochenkov:qcstore2, r=cjgillotMatthias Krüger-31/+18
resolve: Querify most cstore access methods (subset 2) These changes are less likely to cause perf regressions than the rest of https://github.com/rust-lang/rust/pull/108346.
2023-03-23Auto merge of #109503 - matthiaskrgr:rollup-cnp7kdd, r=matthiaskrgrbors-21/+19
Rollup of 9 pull requests Successful merges: - #108954 (rustdoc: handle generics better when matching notable traits) - #109203 (refactor/feat: refactor identifier parsing a bit) - #109213 (Eagerly intern and check CrateNum/StableCrateId collisions) - #109358 (rustc: Remove unused `Session` argument from some attribute functions) - #109359 (Update stdarch) - #109378 (Remove Ty::is_region_ptr) - #109423 (Use region-erased self type during IAT selection) - #109447 (new solver cleanup + implement coherence) - #109501 (make link clickable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-22Rollup merge of #109358 - petrochenkov:nosess, r=cjgillotMatthias Krüger-21/+19
rustc: Remove unused `Session` argument from some attribute functions (One auxiliary test file containing one of these functions was unused, so I removed it instead of updating.)
2023-03-22Auto merge of #109497 - matthiaskrgr:rollup-6txuxm0, r=matthiaskrgrbors-2/+1
Rollup of 10 pull requests Successful merges: - #109373 (Set LLVM `LLVM_UNREACHABLE_OPTIMIZE` to `OFF`) - #109392 (Custom MIR: Allow optional RET type annotation) - #109394 (adapt tests/codegen/vec-shrink-panik for LLVM 17) - #109412 (rustdoc: Add GUI test for "Auto-hide item contents for large items" setting) - #109452 (Ignore the vendor directory for tidy tests.) - #109457 (Remove comment about reusing rib allocations) - #109461 (rustdoc: remove redundant `.content` prefix from span/a colors) - #109477 (`HirId` to `LocalDefId` cleanup) - #109489 (More general captures) - #109494 (Do not feed param_env for RPITITs impl side) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-22Rollup merge of #109489 - est31:generalize_captures, r=WaffleLapkinMatthias Krüger-1/+1
More general captures This avoids repetition of the binding.
2023-03-22Rollup merge of #109457 - Veykril:ribstack, r=petrochenkovMatthias Krüger-1/+0
Remove comment about reusing rib allocations Perf indicates this to not be worth the complexity cc #4948
2023-03-23Rollup merge of #109312 - petrochenkov:docice5, r=GuillaumeGomezDylan DPC-8/+10
rustdoc: Cleanup parent module tracking for doc links Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary. Fixes https://github.com/rust-lang/rust/issues/108501. That issue could be fixed in a more local way, but this refactoring is something that I wanted to do since https://github.com/rust-lang/rust/pull/93805 anyway.
2023-03-22Move useless_anynous_reexport lint into unused_importsGuillaume Gomez-2/+40
2023-03-22More general capturesest31-1/+1
This avoids repetition
2023-03-22Remove comment about re-using Rib allocationsLukas Wirth-1/+0
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-21/+19
2023-03-21rustdoc: Cleanup parent module tracking for doc linksVadim Petrochenkov-8/+10
Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary.
2023-03-20Lint ambiguous glob re-exports许杰友 Jieyou Xu (Joe)-20/+85
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-3/+1
2023-03-19fix: modify the condition that `resolve_imports` stopsbohan-15/+23
2023-03-18Rollup merge of #109257 - petrochenkov:bindebug, r=WaffleLapkinMatthias Krüger-4/+12
resolve: Improve debug impls for `NameBinding` Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves. Noticed while reviewing https://github.com/rust-lang/rust/pull/108729.
2023-03-18Rollup merge of #109222 - chenyukang:yukang/fix-109143, r=petrochenkovMatthias Krüger-2/+3
Do not ICE for unexpected lifetime with ConstGeneric rib Fixes #109143 r? ````@petrochenkov```` Combining this test with the previous test will affect the previous diagnostics, so I added a separate test case.
2023-03-17resolve: Improve debug impls for `NameBinding`Vadim Petrochenkov-4/+12
Print at least the Some/None/Ok/Err status of the nested bindings if not the bindings themselves.
2023-03-17Do not ICE for unexpected lifetime with ConstGeneric ribyukang-2/+3
2023-03-16resolve: Minor cleanup to `Resolver::get_module`Vadim Petrochenkov-19/+16
2023-03-16resolve: Use `item_name` and `opt_parent` in `Resolver::get_module`Vadim Petrochenkov-12/+5
This is a cleanup that doesn't introduce new query calls, but this way `def_key` is decoded twice which may matter for performance or may not
2023-03-16resolve: Remove `item_attrs_untracked`Vadim Petrochenkov-4/+1
2023-03-16resolve: Remove `item_generics_num_lifetimes`Vadim Petrochenkov-1/+1
2023-03-15error-msg: impl better suggestion for `E0532`Ezra Shaw-16/+32
2023-03-13metadata/resolve: Minor refactoring to "tcx -> cstore" conversionsVadim Petrochenkov-3/+5
2023-03-13resolve: Remove `struct_field_names_untracked`Vadim Petrochenkov-48/+51