Commit Graph

380 Commits

Author SHA1 Message Date
Aaron Hill 404402430d Move confused_type_with_std_module to ResolverOutputs
This eliminates untracked global state from `Session`.
2021-09-06 11:20:59 -05:00
bors b4e8596e3e Auto merge of #88598 - estebank:type-ascription-can-die-in-a-fire, r=wesleywiser
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-04 01:40:36 +00:00
bors 577a76f003 Auto merge of #88597 - cjgillot:lower-global, r=petrochenkov
Move global analyses from lowering to resolution

Split off https://github.com/rust-lang/rust/pull/87234

r? `@petrochenkov`
2021-09-03 14:47:13 +00:00
Esteban Kuber 12ce6e9c60 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-03 14:43:04 +00:00
bors 64929313f5 Auto merge of #88516 - matthiaskrgr:clippy_perf_end_august, r=jyn514,GuillaumeGomez
some low hanging clippy::perf fixes
2021-09-02 10:27:44 +00:00
Camille GILLOT f8efe5d822 Compute proc_macros in resolutions. 2021-09-01 20:13:16 +02:00
Camille GILLOT 635978041d Compute all_traits_impls during resolution. 2021-09-01 20:13:16 +02:00
Camille GILLOT 26eeec0baf Compute item_generics_num_lifetimes during resolution. 2021-09-01 20:13:16 +02:00
Matthias Krüger 7f2df9ad65 some low hanging clippy::perf fixes 2021-08-31 20:29:04 +02:00
Cameron Steffen 89d2600d01 Add let-else to AST 2021-08-30 20:17:45 -05:00
lcnr 0c28e028b6 feature(const_generics) -> feature(const_param_types) 2021-08-30 11:00:21 +02:00
Ellen fcc2badf9b rename const_evaluatable_checked to generic_const_exprs
2021-08-30 11:00:21 +02:00
Guillaume Gomez b7388024eb Rollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebank
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-29 16:25:35 +02:00
inquisitivecrystal 8c62fa0575 Treat macros as HIR items 2021-08-28 00:16:34 -07:00
Aaron Hill 672d370764 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-27 18:28:22 -05:00
bors f66e825f73 Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiser
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-24 03:58:22 +00:00
Mara Bos c31e02a24c Rollup merge of #88232 - m-ou-se:macro-name-imported-but-not-macro, r=estebank
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-23 20:45:50 +02:00
Mara Bos 5cf025f076 Rollup merge of #88230 - steffahn:a_an, r=oli-obk
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-23 20:45:49 +02:00
Mara Bos 908ce2fd1f Improve wording of macro-not-found-but-name-exists note. 2021-08-23 16:57:59 +02:00
Mara Bos 4e22bf47d0 Show what things are, but also what they are not. 2021-08-23 16:57:59 +02:00
Mara Bos a13c66e0a5 Don't confuse the user with notes about tool modules. 2021-08-23 16:57:59 +02:00
Mara Bos 4bd415f70a Clarify what attribute and derive macros look like. 2021-08-23 16:57:58 +02:00
Mara Bos 5dea5d7549 Say what things are, instead of what they are not. 2021-08-23 16:57:58 +02:00
Mara Bos d834d2a742 Silence confusing 'unused import' warnings. 2021-08-23 16:57:58 +02:00
Mara Bos 7977cb43b0 Look for macro names in all namespaces for diagnostics. 2021-08-23 16:43:54 +02:00
Mara Bos fed6131c41 Add note to 'macro not found' to point to identically-named imports. 2021-08-23 16:43:54 +02:00
Guillaume Gomez 3e8e8d2dad Rollup merge of #88238 - m-ou-se:used-imports-no-track-namespace, r=estebank
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-22 20:52:56 +02:00
Frank Steffahn 2396fad095 Fix more “a”/“an” typos 2021-08-22 17:27:18 +02:00
Mara Bos abab99e02b Stop tracking namespce in used_imports.
The information was tracked, but unused.
2021-08-22 16:50:59 +02:00
Frank Steffahn be9d2699ca Fix more “a”/“an” typos 2021-08-22 16:35:29 +02:00
Frank Steffahn bf88b113ea Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00
Mara Bos bcc5ecb969 Suggest importing the right kind of macro. 2021-08-22 14:07:41 +02:00
Aaron Hill 17aef21b30 Remove NonMacroAttr.mark_used 2021-08-21 13:27:29 -05:00
Aaron Hill af46699f81 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-21 13:27:27 -05:00
Esteban Kuber 9349046ed5 review comment: use newtype to deduplicate logic 2021-08-18 14:05:15 +00:00
Esteban Kuber 12a776b41d review comment: reduce duplication 2021-08-18 11:29:29 +00:00
Esteban Kuber 14add46e94 Use more accurate spans when proposing adding lifetime to item 2021-08-18 10:25:15 +00:00
Caio 6aa9937a76 Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
bors dfe5fd0902 Auto merge of #87975 - m-ou-se:unused-import-attributes, r=nagisa
Include attributes in removal span for unused imports.

Fixes https://github.com/rust-lang/rust/issues/87973
2021-08-15 07:40:53 +00:00
Deadbeef 32390a0df6 move Constness into TraitPredicate 2021-08-13 09:26:33 +00:00
Mara Bos f1860d1901 Include attributes in removal span for unused imports. 2021-08-12 17:35:52 +02:00
Jakub Beránek d0d4947775 Add hint for unresolved associated trait items if the trait has a single item 2021-08-06 11:31:52 +02:00
bors b53a93db2d Auto merge of #87535 - lf-:authors, r=Mark-Simulacrum
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-02 05:49:17 +00:00
bors aadd6189ad Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisa
more clippy::complexity fixes

(also a couple of clippy::perf fixes)
2021-08-01 09:15:15 +00:00
Jade 3cf820e17d rfc3052: Remove authors field from Cargo manifests
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-29 14:56:05 -07:00
bors fd853c00e2 Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr
Add hir::GenericArg::Infer

In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-27 16:24:45 +00:00
kadmin 8759f00c73 Actually infer args in visitors 2021-07-26 21:15:18 +00:00
bors 478126c0f3 Auto merge of #86438 - FabianWolff:issue-83693, r=jackh726
Fix the ICE described in #83693

This pull request fixes #83693 and fixes #84768.
2021-07-25 16:17:58 +00:00
Matthias Krüger 3fd8cbb404 clippy::useless_format 2021-07-25 12:26:03 +02:00
Camille GILLOT 36a28060f1 Merge the BTreeMap in hir::Crate. 2021-07-25 12:18:56 +02:00