about summary refs log tree commit diff
path: root/compiler/rustc_resolve
AgeCommit message (Collapse)AuthorLines
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-02Auto merge of #87535 - lf-:authors, r=Mark-Simulacrumbors-1/+0
rfc3052 followup: Remove authors field from Cargo manifests Since RFC 3052 soft deprecated the authors field, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information for contributors, we may as well remove it from crates in this repo.
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-29rfc3052: Remove authors field from Cargo manifestsJade-1/+0
Since RFC 3052 soft deprecated the authors field anyway, hiding it from crates.io, docs.rs, and making Cargo not add it by default, and it is not generally up to date/useful information, we should remove it from crates in this repo.
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
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-18/+11
2021-07-25Add generic arg inferkadmin-0/+4
2021-07-17Compute a better `lint_node_id` during expansionAaron Hill-10/+6
When we need to emit a lint at a macro invocation, we currently use the `NodeId` of its parent definition (e.g. the enclosing function). This means that any `#[allow]` / `#[deny]` attributes placed 'closer' to the macro (e.g. on an enclosing block or statement) will have no effect. This commit computes a better `lint_node_id` in `InvocationCollector`. When we visit/flat_map an AST node, we assign it a `NodeId` (earlier than we normally would), and store than `NodeId` in current `ExpansionData`. When we collect a macro invocation, the current `lint_node_id` gets cloned along with our `ExpansionData`, allowing it to be used if we need to emit a lint later on. This improves the handling of `#[allow]` / `#[deny]` for `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` and some `asm!`-related lints. The 'legacy derive helpers' lint retains its current behavior (I've inlined the now-removed `lint_node_id` function), since there isn't an `ExpansionData` readily available.
2021-07-17Use LocalExpnId where possible.Camille GILLOT-59/+84
2021-07-15Rollup merge of #87134 - BoxyUwU:cgd-self-ty-error, r=lcnrYuki Okushi-5/+5
Make SelfInTyParamDefault wording not be specific to type defaults r? ```@lcnr```
2021-07-14Change type param -> generic paramEllen-5/+5
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-1/+1
2021-07-13Cache expansion hash.Camille GILLOT-19/+65
2021-07-10rustc_span: Revert addition of `proc_macro` field to `ExpnKind::Macro`Vadim Petrochenkov-10/+4
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-09Fix the ICE described in #83693Fabian Wolff-3/+2
2021-07-06Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, ↵bors-1/+1
r=michaelwoerister Reland "Merge CrateDisambiguator into StableCrateId" Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse. r? `@Mark-Simulacrum`