about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2021-09-24resolve: Rename some expansion def scope methodsVadim Petrochenkov-23/+19
2021-09-24resolve: Cleanup module allocationVadim Petrochenkov-56/+73
Construction of all modules is now centralized and performed by `fn new_module`.
2021-09-24resolve: Do not cache nearest parent mod in `ModuleData`Vadim Petrochenkov-57/+36
2021-09-25change the order of path suggestionsTakayuki Maeda-0/+6
2021-09-21Rollup merge of #89078 - camsteffen:map-ref, r=cjgillotthe8472-2/+1
Cleanup: Remove needless reference in ParentHirIterator It forces an intermediate binding of `Map` which is a Copy type.
2021-09-19Rollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkovYuki Okushi-1/+5
Check for shadowing issues involving block labels
2021-09-18Remove needless hir Map refCameron Steffen-2/+1
2021-09-18Auto merge of #88650 - sapessi:issue-77175-fix, r=estebankbors-1/+22
Skip single use lifetime lint for generated opaque types Fix: #77175 The opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The DefId for the lifetimes in the opaque type are different from the ones in the originating async function - as they should be, as far as I understand, and could therefore be considered a single use lifetimes, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition. More info in the comments on the original issue: 1 and 2
2021-09-15Check for shadowing issues involving block labelsTomasz Miąsko-1/+5
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-11/+6
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-6/+6
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-11Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkovbors-11/+25
Encode spans relative to the enclosing item The aim of this PR is to avoid recomputing queries when code is moved without modification. MCP at https://github.com/rust-lang/compiler-team/issues/443 This is achieved by : 1. storing the HIR owner LocalDefId information inside the span; 2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache; 3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation. Since all client code uses `Span`, step 3 ensures that all manipulations of span byte positions actually create the dependency edge between the caller and the `source_span(LocalDefId)`. This query return the actual absolute span of the parent item. As a consequence, any source code motion that changes the absolute byte position of a node will either: - modify the distance to the parent's beginning, so change the relative span's hash; - dirty `source_span`, and trigger the incremental recomputation of all code that depends on the span's absolute byte position. With this scheme, I believe the dependency tracking to be accurate. For the moment, the spans are marked during lowering. I'd rather do this during def-collection, but the AST MutVisitor is not practical enough just yet. The only difference is that we attach macro-expanded spans to their expansion point instead of the macro itself.
2021-09-11don't clone types that are Copy (clippy::clone_on_copy)Matthias Krüger-1/+1
2021-09-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-6/+6
Local variables can never be exported.
2021-09-10Record call_site parent for macros.Camille GILLOT-1/+11
2021-09-10Encode spans relative to their parent.Camille GILLOT-0/+10
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-0/+1
2021-09-10Keep def_spans collected by resolution.Camille GILLOT-10/+3
2021-09-06Move `confused_type_with_std_module` to `ResolverOutputs`Aaron Hill-3/+7
This eliminates untracked global state from `Session`.
2021-09-04Skip single use lifetime lint for generated opaque typesStefano Buliani-1/+22
As reported in issue #77175, the opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The definition ID for the lifetimes in the opaque method is different from the one in the originating async function and it could therefore be considered a single use of the lifetimne, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition.
2021-09-04Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiserbors-0/+26
Detect bare blocks with type ascription that were meant to be a `struct` literal Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-03Auto merge of #88597 - cjgillot:lower-global, r=petrochenkovbors-4/+49
Move global analyses from lowering to resolution Split off https://github.com/rust-lang/rust/pull/87234 r? `@petrochenkov`
2021-09-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+26
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-09-02Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, ↵bors-3/+5
r=jyn514,GuillaumeGomez some low hanging clippy::perf fixes
2021-09-01Compute proc_macros in resolutions.Camille GILLOT-0/+12
2021-09-01Compute all_traits_impls during resolution.Camille GILLOT-2/+13
2021-09-01Compute item_generics_num_lifetimes during resolution.Camille GILLOT-2/+24
2021-08-31some low hanging clippy::perf fixesMatthias Krüger-3/+5
2021-08-30Add let-else to ASTCameron Steffen-2/+9
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-9/+6
2021-08-30rename const_evaluatable_checked to generic_const_exprsEllen-8/+4
:sparkles:
2021-08-29Rollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebankGuillaume Gomez-1/+0
Remove `Session.if_let_suggestions` We can instead if either the LHS or RHS types contain `TyKind::Error`. In addition to covering the case where we would have previously updated `if_let_suggestions`, this might also prevent redundant errors in other cases as well.
2021-08-28Treat macros as HIR itemsinquisitivecrystal-0/+1
2021-08-27Remove `Session.if_let_suggestions`Aaron Hill-1/+0
We can instead if either the LHS or RHS types contain `TyKind::Error`. In addition to covering the case where we would have previously updated `if_let_suggestions`, this might also prevent redundant errors in other cases as well.
2021-08-24Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiserbors-19/+16
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor` Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-23Rollup merge of #88232 - m-ou-se:macro-name-imported-but-not-macro, r=estebankMara Bos-0/+52
Add notes to macro-not-found diagnostics to point out how things with the same name were not a match. This adds notes like: ``` error: cannot find derive macro `Serialize` in this scope --> $DIR/issue-88206.rs:22:10 | LL | #[derive(Serialize)] | ^^^^^^^^^ | note: `Serialize` is imported here, but it is not a derive macro --> $DIR/issue-88206.rs:17:11 | LL | use hey::{Serialize, Deserialize}; | ^^^^^^^^^ ``` Fixes https://github.com/rust-lang/rust/issues/88206 Includes https://github.com/rust-lang/rust/pull/88229 r? `@estebank`
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-5/+5
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-23Improve wording of macro-not-found-but-name-exists note.Mara Bos-8/+18
2021-08-23Show what things are, but also what they are not.Mara Bos-1/+7
2021-08-23Don't confuse the user with notes about tool modules.Mara Bos-5/+5
2021-08-23Clarify what attribute and derive macros look like.Mara Bos-1/+2
2021-08-23Say what things are, instead of what they are not.Mara Bos-10/+9
2021-08-23Silence confusing 'unused import' warnings.Mara Bos-0/+3
2021-08-23Look for macro names in all namespaces for diagnostics.Mara Bos-19/+34
2021-08-23Add note to 'macro not found' to point to identically-named imports.Mara Bos-1/+19
2021-08-22Rollup merge of #88238 - m-ou-se:used-imports-no-track-namespace, r=estebankGuillaume Gomez-17/+14
Stop tracking namespace in used_imports. This changes `used_imports` from a `FxHashSet<(NodeId, Namespace)>` to a `FxHashSet<NodeId>`, as the Namespace information isn't used. The only point that uses it did three lookups, `|=`'ing them together. r? `@estebank`
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-08-22Stop tracking namespce in used_imports.Mara Bos-17/+14
The information was tracked, but unused.
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-08-22Fix typos “a”→“an”Frank Steffahn-3/+3