about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
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
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`
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-1/+1
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-06Store macro parent module in ExpnData.Camille GILLOT-15/+13
2021-06-28Fix garbled suggestion for missing lifetime specifierFabian Wolff-0/+2
2021-06-24Auto merge of #85427 - ehuss:fix-use-placement, r=jackh726bors-8/+8
Fix use placement for suggestions near main. This fixes an edge case for the suggestion to add a `use`. When running with `--test`, the `main` function will be annotated with an `#[allow(dead_code)]` attribute. The `UsePlacementFinder` would end up using the dummy span of that synthetic attribute. If there are top-level inner attributes, this would place the `use` in the wrong position. The solution here is to ignore attributes with dummy spans. In the process of working on this, I discovered that the `use_suggestion_placement` test was broken. `UsePlacementFinder` is unaware of active attributes. Attributes like `#[derive]` don't exist in the AST since they are removed. Fixing that is difficult, since the AST does not retain enough information. I considered trying to place the `use` towards the top of the module after any `extern crate` items, but I couldn't find a way to get a span for the start of a module block (the `mod` span starts at the `mod` keyword, and it seems tricky to find the spot just after the opening bracket and past inner attributes). For now, I just put some comments about the issue. This appears to have been a known issue in #44215 where the test for it was introduced, and the fix seemed to be deferred to later.
2021-06-20expand: Move some more derive logic to `rustc_builtin_macros`Vadim Petrochenkov-1/+1
2021-06-15Rollup merge of #85608 - scottmcm:stabilize-control-flow-enum-basics, r=m-ou-seYuki Okushi-1/+0
Stabilize `ops::ControlFlow` (just the type) Tracking issue: https://github.com/rust-lang/rust/issues/75744 (which also tracks items *not* closed by this PR). With the new `?` desugar implemented, [it's no longer possible to mix `Result` and `ControlFlow`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=13feec97f5c96a9d791d97f7de2d49a6). (At the time of making this PR, godbolt was still on the 2021-05-01 nightly, where you can see that [the mixing example compiled](https://rust.godbolt.org/z/13Ke54j16).) That resolves the only blocker I know of, so I'd like to propose that `ControlFlow` be considered for stabilization. Its basic existence was part of https://github.com/rust-lang/rfcs/pull/3058, where it got a bunch of positive comments (examples [1](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-758277325) [2](https://github.com/rust-lang/rfcs/pull/3058#pullrequestreview-592106494) [3](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-784444155) [4](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-797031584)). Its use in the compiler has been well received (https://github.com/rust-lang/rust/pull/78182#issuecomment-713695594), and there are ecosystem updates interested in using it (https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589, https://github.com/jonhoo/rust-imap/issues/194). As this will need an FCP, picking a libs member manually: r? `@m-ou-se` ## Stabilized APIs ```rust #[derive(Debug, Clone, Copy, PartialEq)] pub enum ControlFlow<B, C = ()> { /// Exit the operation without running subsequent phases. Break(B), /// Move on to the next phase of the operation as normal. Continue(C), } ``` As well as using `?` on a `ControlFlow<B, _>` in a function returning `ControlFlow<B, _>`. (Note, in particular, that there's no `From::from`-conversion on the `Break` value, the way there is for `Err`s.) ## Existing APIs *not* stabilized here All the associated methods and constants: `break_value`, `is_continue`, `map_break`, [`CONTINUE`](https://doc.rust-lang.org/nightly/std/ops/enum.ControlFlow.html#associatedconstant.CONTINUE), etc. Some of the existing methods in nightly seem reasonable, some seem like they should be removed, and some need more discussion to decide. But none of them are *essential*, so [as in the RFC](https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#methods-on-controlflow), they're all omitted from this PR. They can be considered separately later, as further usage demonstrates which are important.
2021-06-11Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillotbors-1/+1
Don't use a generator for BoxedResolver The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow. Based on #85810 as it touches rustc_interface too.
2021-06-10Add support for using qualified paths with structs in expression and patternRyan Levick-5/+5
position.
2021-06-08Store boxed metadata loader in CrateLoaderbjorn3-1/+1
2021-06-08Rollup merge of #86103 - camsteffen:lifetime-hack, r=jackh726Yuki Okushi-9/+1
Remove lifetime hack It compiles without the hack. But I don't know why. I can't get the example in the referenced issue to compile...
2021-06-07Remove lifetime hackCameron Steffen-9/+1
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-1/+1
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-03Rollup merge of #85896 - BoxyUwU:remove-fixme-fwd-declared-const-default, ↵Yuki Okushi-3/+3
r=petrochenkov Add test for forward declared const param defaults
2021-06-01Make trait_map an Option.Camille GILLOT-15/+6
2021-06-01Rename take_trait_map.Camille GILLOT-1/+1
2021-06-01Check that trait_map is not moved twice.Camille GILLOT-0/+9
2021-06-01Only compute the trait_map once.Camille GILLOT-2/+2
2021-06-01Add test for forward declared const param defaultsEllen-3/+3
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-11/+2
2021-05-30Rename take_trait_map.Camille GILLOT-1/+1
2021-05-30Check that trait_map is not moved twice.Camille GILLOT-0/+9
2021-05-30Only compute the trait_map once.Camille GILLOT-2/+2