about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-31Make `span_extend_to_prev_str()` more robustFabian Wolff-19/+19
2022-01-27Store def_id_to_hir_id as variant in hir_owner.Camille GILLOT-9/+1
If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0. If the HIR node does not exist, we store Phantom. Otherwise, we store the HirId associated to the LocalDefId.
2022-01-25Return an indexmap in `all_local_trait_impls` querypierwill-2/+2
The data structure previously used here required Ord. As part of #90317, we do not want DefId to implement Ord.
2022-01-25rustdoc: Pre-calculate traits that are in scope for doc linksVadim Petrochenkov-2/+13
This eliminates one more late use of resolver
2022-01-23rustc_lint: Reuse the set of registered tools from resolverVadim Petrochenkov-3/+9
2022-01-21Rollup merge of #93046 - est31:let_else, r=davidtwcoMatthias Krüger-41/+38
Use let_else in even more places Followup of #89933, #91018, #91481.
2022-01-19Only suggest adding `!` to expressions that can be macro invocationEsteban Kuber-1/+14
2022-01-18Use let_else in even more placesest31-41/+38
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-40/+5
2022-01-16rustc_metadata: Switch all decoder methods from vectors to iteratorsVadim Petrochenkov-10/+10
Also remove unnecessary `is_proc_macro_crate` checks from decoder
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-44/+36
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-5/+5
2022-01-15Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasperbors-23/+89
Link impl items to corresponding trait items in late resolver. Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items. This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later. r? `@matthewjasper` Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.
2022-01-12Ensure res and module are consistent with each other.Camille GILLOT-23/+13
The `record_used` parameter changes the result, so we must pass the same value for initial and module resolution.
2022-01-09Compute most of Public/Exported access level in rustc_resolveLamb-4/+256
Mak DefId to AccessLevel map in resolve for export hir_id to accesslevel in resolve and applied in privacy using local def id removing tracing probes making function not recursive and adding comments Move most of Exported/Public res to rustc_resolve moving public/export res to resolve fix missing stability attributes in core, std and alloc move code to access_levels.rs return for some kinds instead of going through them Export correctness, macro changes, comments add comment for import binding add comment for import binding renmae to access level visitor, remove comments, move fn as closure, remove new_key fmt fix rebase fix rebase fmt fmt fix: move macro def to rustc_resolve fix: reachable AccessLevel for enum variants fmt fix: missing stability attributes for other architectures allow unreachable pub in rustfmt fix: missing impl access level + renaming export to reexport Missing impl access level was found thanks to a test in clippy
2022-01-09Auto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgrbors-3/+10
Rollup of 8 pull requests Successful merges: - #92055 (Add release notes for 1.58) - #92490 (Move crate drop-down to search results page) - #92510 (Don't resolve blocks in foreign functions) - #92573 (expand: Refactor InvocationCollector visitor for better code reuse) - #92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes) - #92657 (Implemented const casts of raw pointers) - #92671 (Make `Atomic*::from_mut` return `&mut Atomic*`) - #92673 (Remove useless collapse toggle on "all items" page) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-09Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillotMatthias Krüger-3/+10
Don't resolve blocks in foreign functions Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does. Fixes #91370. r? ``@cjgillot``
2022-01-09rustc_middle: Rename `Export` to `ModChild` and add some commentsVadim Petrochenkov-12/+12
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
2022-01-09rustc_metadata: Rename `item_children(_untracked)` to ↵Vadim Petrochenkov-1/+1
`module_children(_untracked)` And `each_child_of_item` to `for_each_module_child`
2022-01-08Simplify error reporting.Camille GILLOT-38/+42
2022-01-08Link impl items to corresponding trait items in late resolver.Camille GILLOT-16/+88
2022-01-06rustc_metadata: Make attribute decoding slightly faster and stricterVadim Petrochenkov-5/+7
Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions
2022-01-05Do not resolve blocks in foreign functionsinquisitivecrystal-3/+10
2022-01-05ast: Always keep a `NodeId` in `ast::Crate`Vadim Petrochenkov-8/+7
This makes it more uniform with other expanded nodes
2022-01-03Rollup merge of #92402 - pr2502:while-let-typo, r=oli-obkMatthias Krüger-0/+2
Suggest while let x = y when encountering while x = y Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
2021-12-29Suggest while let x = y when encountering while x = yametisf-0/+2
Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
2021-12-29Rollup merge of #92237 - compiler-errors:issue-92100, r=cjgillotMatthias Krüger-1/+4
Visit expressions in-order when resolving pattern bindings [edited:] Visit the pattern's sub-expressions before defining any bindings. Otherwise, we might get into a case where a Lit/Range expression in a pattern has a qpath pointing to a Ident pattern that is defined after it, causing an ICE when lowering to HIR. I have a more detailed explanation in the issue linked. Fixes #92100
2021-12-28Rollup merge of #92333 - compiler-errors:elided-lifetime-spans, r=cjgillotMatthias Krüger-3/+6
Tighten span when suggesting lifetime on path This is kind of a hack. Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that. Fixes #92324 r? `@cjgillot`
2021-12-27Tighten span when suggesting lifetime on pathMichael Goulet-3/+6
2021-12-27Rollup merge of #92161 - petrochenkov:misclean, r=cjgillotMatthias Krüger-20/+14
resolve: Minor miscellaneous cleanups from #89059 `@bors` rollup=always
2021-12-27Visit patterns' literal expressions before binding new identsMichael Goulet-1/+4
2021-12-22rustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind`Vadim Petrochenkov-4/+1
Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag
2021-12-21resolve: Minor miscellaneous cleanups from #89059Vadim Petrochenkov-20/+14
2021-12-21Rollup merge of #91770 - TaKO8Ki:suggest-adding-cfg-test, r=joshtriplettMatthias Krüger-2/+20
Suggest adding a `#[cfg(test)]` to to a test module closes #88138
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-15/+14
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-18hir: Do not introduce dummy type names for `extern` blocks in def pathsVadim Petrochenkov-1/+1
Use a separate nameless `DefPathData` variant instead
2021-12-16suggest adding a `#[cfg(test)]` to test modulesTakayuki Maeda-2/+20
remove a empty line import `module_to_string` use `contains("test")` show a suggestion in case module starts_with/ends_with "test" replace `parent` with `containing`
2021-12-16Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiserbors-4/+1
Include rustc version in `rustc_span::StableCrateId` `rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design. In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable. In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.) Closes #85142.
2021-12-15Rollup merge of #91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnrMatthias Krüger-5/+4
Handle unordered const/ty generics for object lifetime defaults *feel like I should have a PR description but cant think of what to put here* r? ```@lcnr```
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-4/+4
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-3/+3
2021-12-15Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - #91859 (Iterator::cycle() — document empty iterator special case) - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - #91881 (Stabilize `iter::zip`) - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - #91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-9/+8
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-14Rollup merge of #91798 - bugadani:issue-91783, r=michaelwoeristerMatthias Krüger-1/+6
Avoid suggest adding `self` in visibility spec Fixes #91783
2021-12-14awdawdawdEllen-5/+4
2021-12-13Include rustc version in `rustc_span::StableCrateId`pierwill-4/+1
Normalize symbol hashes in compiletest. Remove DefId sorting
2021-12-12Avoid suggesting self in visibility specDániel Buga-1/+6
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-12-11Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726Matthias Krüger-0/+5
Do not ICE when suggesting elided lifetimes on non-existent spans. Fixes https://github.com/rust-lang/rust/issues/91763 r? `@jackh726`