about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
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
2021-08-22Suggest importing the right kind of macro.Mara Bos-3/+1
2021-08-21Remove `NonMacroAttr.mark_used`Aaron Hill-10/+4
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-9/+12
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-18review comment: use newtype to deduplicate logicEsteban Kuber-32/+70
2021-08-18review comment: reduce duplicationEsteban Kuber-24/+27
2021-08-18Use more accurate spans when proposing adding lifetime to itemEsteban Kuber-7/+32
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-1/+1
2021-08-15Auto merge of #87975 - m-ou-se:unused-import-attributes, r=nagisabors-1/+1
Include attributes in removal span for unused imports. Fixes https://github.com/rust-lang/rust/issues/87973
2021-08-13move Constness into TraitPredicateDeadbeef-1/+1
2021-08-12Include attributes in removal span for unused imports.Mara Bos-1/+1
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-11/+6
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-06Add hint for unresolved associated trait items if the trait has a single itemJakub Beránek-26/+88
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-1/+1
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-27Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnrbors-0/+6
Add hir::GenericArg::Infer In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-26Actually infer args in visitorskadmin-1/+3
2021-07-25Auto merge of #86438 - FabianWolff:issue-83693, r=jackh726bors-3/+2
Fix the ICE described in #83693 This pull request fixes #83693 and fixes #84768.
2021-07-25clippy::useless_formatMatthias Krüger-1/+1