summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2021-10-02resolve: Avoid comparing modules by optional def-idVadim Petrochenkov-1/+1
It makes all block modules identical during comparison
2021-09-30Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, ↵Manish Goregaokar-2/+36
r=estebank Suggest similarly named associated items in trait impls Fix #85942 Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-29Suggest similarly named assoc items in trait implsHirochika Matsumoto-2/+36
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
2021-09-28More tracing instrumentationOli Scherer-0/+3
2021-09-27suggest path for tuple structTakayuki Maeda-1/+7
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-10Keep a parent LocalDefId in SpanData.Camille GILLOT-0/+1
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-03Detect bare blocks with type ascription that were meant to be a `struct` literalEsteban Kuber-0/+10
Address part of #34255. Potential improvement: silence the other knock down errors in `issue-34255-1.rs`.
2021-08-31some low hanging clippy::perf fixesMatthias Krüger-3/+5
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-3/+3
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-3/+7
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-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-3/+7
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-13move Constness into TraitPredicateDeadbeef-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-7/+45
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-09Fix the ICE described in #83693Fabian Wolff-3/+2
2021-06-28Fix garbled suggestion for missing lifetime specifierFabian Wolff-0/+2
2021-06-07Remove lifetime hackCameron Steffen-9/+1
2021-05-13Auto merge of #85041 - mibac138:suggest-generics, r=estebankbors-5/+14
Suggest adding a type parameter for impls Add a new suggestion upon encountering an unknown type in a `impl` that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter. ```rust struct X<const C: ()>(); impl X<C> {} ``` suggests ``` error[E0412]: cannot find type `C` in this scope --> bar.rs:2:8 | 1 | struct X<const C: ()>(); | ------------------------ similarly named struct `X` defined here 2 | impl X<C> {} | ^ | help: a struct with a similar name exists | 2 | impl X<X> {} | ^ help: you might be missing a type parameter | 2 | impl<C> X<C> {} | ^^^ ``` After adding a type parameter the code now becomes ```rust struct X<const C: ()>(); impl<C> X<C> {} ``` and the error now fully steers the user towards the correct code ``` error[E0747]: type provided when a constant was expected --> bar.rs:2:11 | 2 | impl<C> X<C> {} | ^ | help: consider changing this type parameter to be a `const` generic | 2 | impl<const C: ()> X<C> {} | ^^^^^^^^^^^ ``` r? `@estebank` Somewhat related #84946
2021-05-13Auto merge of #83759 - SkiFire13:fix-diag, r=estebankbors-6/+28
Handle more span edge cases in generics diagnostics This should fix invalid suggestions that didn't account for empty bracket pairs (`<>`) or type bindings.
2021-05-12Fix diagnostics spans for missing lifetimes in edge casesGiacomo Stevanato-6/+28
2021-05-12Auto merge of #83813 - cbeuw:remap-std, r=michaelwoeristerbors-1/+1
Fix `--remap-path-prefix` not correctly remapping `rust-src` component paths and unify handling of path mapping with virtualized paths This PR fixes #73167 ("Binaries end up containing path to the rust-src component despite `--remap-path-prefix`") by preventing real local filesystem paths from reaching compilation output if the path is supposed to be remapped. `RealFileName::Named` introduced in #72767 is now renamed as `LocalPath`, because this variant wraps a (most likely) valid local filesystem path. `RealFileName::Devirtualized` is renamed as `Remapped` to be used for remapped path from a real path via `--remap-path-prefix` argument, as well as real path inferred from a virtualized (during compiler bootstrapping) `/rustc/...` path. The `local_path` field is now an `Option<PathBuf>`, as it will be set to `None` before serialisation, so it never reaches any build output. Attempting to serialise a non-`None` `local_path` will cause an assertion faliure. When a path is remapped, a `RealFileName::Remapped` variant is created. The original path is preserved in `local_path` field and the remapped path is saved in `virtual_name` field. Previously, the `local_path` is directly modified which goes against its purpose of "suitable for reading from the file system on the local host". `rustc_span::SourceFile`'s fields `unmapped_path` (introduced by #44940) and `name_was_remapped` (introduced by #41508 when `--remap-path-prefix` feature originally added) are removed, as these two pieces of information can be inferred from the `name` field: if it's anything other than a `FileName::Real(_)`, or if it is a `FileName::Real(RealFileName::LocalPath(_))`, then clearly `name_was_remapped` would've been false and `unmapped_path` would've been `None`. If it is a `FileName::Real(RealFileName::Remapped{local_path, virtual_name})`, then `name_was_remapped` would've been true and `unmapped_path` would've been `Some(local_path)`. cc `@eddyb` who implemented `/rustc/...` path devirtualisation
2021-05-11improve diagnosts for GATsb-naber-18/+114
2021-05-11Split span_to_string into span_to_diagnostic/embeddable_stringAndy Wang-1/+1
2021-05-10More minor fixes suggested by @jackh726Fabian Wolff-2/+4
2021-05-09Implement @jackh726's suggestionsFabian Wolff-76/+64
2021-05-07Fix suggestions for missing return type lifetime parametersFabian Wolff-150/+216
2021-05-07Fix impl type parameter suggestion involving constsmibac138-1/+8
2021-05-05Suggest adding a type parameter for implsmibac138-4/+6
2021-05-02add suggestion for unit enum variant when matched with a paternAliénore Bouttefeux-12/+31