about summary refs log tree commit diff
path: root/src/librustc_resolve/late
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-4458/+0
2020-08-23Account for async functions when suggesting new named lifetimeEsteban Küber-0/+3
Fix #75850.
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-1/+1
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-1/+1
2020-08-16resolve: support `GenericBound::LangItemTrait`David Wood-0/+28
This commit modifies name resolution to ensure that new scopes are introduced from lang-item generic bounds. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-2/+2
2020-08-14Rollup merge of #75448 - lcnr:rn-as_local_hir_id, r=davidtwcoTyler Mandry-7/+8
merge `as_local_hir_id` with `local_def_id_to_hir_id` `as_local_hir_id` was defined as just calling `local_def_id_to_hir_id` and I think that having two different ways to call the same method is somewhat confusing. Don't really care about which of these 2 methods we want to keep. Does this require an MCP, considering that these methods are fairly frequently used?
2020-08-14Rollup merge of #75509 - estebank:coming-merrily-from-java-land, r=lcnrTyler Mandry-4/+60
Tweak suggestion for `this` -> `self` * When referring to `this` in associated `fn`s always suggest `self`. * Point at ident for `fn` lacking `self` * Suggest adding `self` to assoc `fn`s when appropriate _Improvements based on the narrative in https://fasterthanli.me/articles/i-am-a-java-csharp-c-or-cplusplus-dev-time-to-do-some-rust_
2020-08-14review comment: suggestion message wordingEsteban Küber-1/+2
2020-08-13Suggest adding `&self` when accessing `self` in static assoc `fn`Esteban Küber-15/+46
2020-08-13Tweak suggestion for `this` -> `self`Esteban Küber-3/+27
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-7/+8
2020-08-13Rollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnrYuki Okushi-36/+172
Fix suggestion to use lifetime in type and in assoc const _Do not merge until #75363 has landed, as it has the test case for this._ * Account for associated types * Associated `const`s can't have generics (fix #74264) * Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix #72404)
2020-08-11Suggest using `'static` in assoc consts and suggest when multiple lts are neededEsteban Küber-6/+60
2020-08-11review comment: simplify code by using slice patEsteban Küber-9/+10
2020-08-11When suggesting `for` lts, consider existing lifetime namesEsteban Küber-20/+84
Fix #72404.
2020-08-11Assoc `const`s don't have genericsEsteban Küber-3/+14
Fix #74264.
2020-08-11Fix suggestion to use lifetime in typeEsteban Küber-1/+7
2020-08-11Detect tuple variants used as struct pattern and suggest correct patternEsteban Küber-1/+10
2020-08-11Rollup merge of #75353 - estebank:tiny, r=jyn514Yuki Okushi-3/+3
Tiny cleanup, remove unnecessary `unwrap` Remove unnecessary `unwrap`.
2020-08-10Add missing primary labelEsteban Küber-1/+5
2020-08-10Point at item definition in foreign cratesEsteban Küber-4/+16
2020-08-10Tweak ordering of suggestionsEsteban Küber-6/+10
Modify logic to make it easier to follow and recover labels that would otherwise be lost.
2020-08-09Small cleanupEsteban Küber-3/+3
Remove unnecessary `unwrap`.
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-9/+4
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-07-31Reduce verbosity of some type ascription errorsEsteban Küber-78/+117
* Deduplicate type ascription LHS errors * Remove duplicated `:` -> `::` suggestion from parse error * Tweak wording to be more accurate * Modify `current_type_ascription` to reduce span wrangling * remove now unnecessary match arm * Add run-rustfix to appropriate tests
2020-07-23cleanupBastian Kauschke-2/+2
2020-07-23fix ICE caused by wrongly ordered generic paramsBastian Kauschke-1/+4
2020-07-19disallow non-static lifetimes in const genericsGabriel Smith-0/+29
This has been put in place to patch over an ICE caused when we encounter a non-static lifetime in a const generic during borrow checking. This restriction may be relaxed in the future, but we need more discussion before then, and in the meantime we should still deal with this ICE. Fixes issue #60814
2020-07-18rustc_metadata: Make crate loading fully speculativeVadim Petrochenkov-5/+4
2020-07-15Auto merge of #74175 - nnethercote:more-static-symbols, r=oli-obkbors-3/+3
More static symbols These commits add some more static symbols and convert lots of places to use them. r? @oli-obk
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-15Add and use more static symbols.Nicholas Nethercote-1/+1
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.
2020-07-14Rollup merge of #74211 - estebank:struct-pat-as-unit, r=petrochenkovManish Goregaokar-11/+57
Structured suggestion when not using struct pattern r? @petrochenkov
2020-07-14Suggest struct pat on incorrect unit or tuple patEsteban Küber-11/+57
When encountering a unit or tuple pattern for a struct-like item, suggest using the correct pattern. Use `insert_field_names_local` when evaluating variants and store field names even when the list is empty in order to produce accurate structured suggestions.
2020-07-11Rollup merge of #74213 - pickfire:patch-1, r=jonas-schievinkManish Goregaokar-3/+1
Minor refactor for rustc_resolve diagnostics match Use `matches!` instead of old `if let`
2020-07-11Rollup merge of #74197 - estebank:self-sugg, r=petrochenkovManish Goregaokar-2/+2
Reword incorrect `self` token suggestion
2020-07-11Rollup merge of #74168 - JohnTitor:help-for-in-band-lifetimes, r=petrochenkovManish Goregaokar-0/+11
Add a help to use `in_band_lifetimes` in nightly Fixes #73775
2020-07-10Avoid "whitelist"Tamir Duberstein-1/+1
Other terms are more inclusive and precise.
2020-07-10Minor refactor for rustc_resolve diagnostics matchIvan Tham-3/+1
Use `matches!` instead of old `if let`
2020-07-10Tweak wordingYuki Okushi-1/+1
2020-07-10Add a help to use `in_band_lifetimes` in nightlyYuki Okushi-0/+11
2020-07-09Reword incorrect `self` token suggestionEsteban Küber-2/+2
2020-07-05Use for<'tcx> fn pointers in Providers, instead of having Providers<'tcx>.Eduard-Mihai Burtescu-1/+1
2020-07-02resolve: disallow label use through closure/asyncDavid Wood-1/+27
This commit modifies resolve to disallow `break`/`continue` to labels through closures or async blocks. This doesn't make sense and should have been prohibited anyway. Signed-off-by: David Wood <david@davidtw.co>
2020-06-23Rollup merge of #73587 - marmeladema:hir-id-ification-final, r=petrochenkovManish Goregaokar-3/+3
Move remaining `NodeId` APIs from `Definitions` to `Resolver` Implements https://github.com/rust-lang/rust/pull/73291#issuecomment-643515557 TL;DR: it moves all fields that are only needed during name resolution passes into the `Resolver` and keep the rest in `Definitions`. This effectively enforces that all references to `NodeId`s are gone once HIR lowering is completed. After this, the only remaining work for #50928 should be to adjust the dev guide. r? @petrochenkov
2020-06-22Rollup merge of #72623 - da-x:use-suggest-public-path, r=petrochenkovDylan DPC-1/+6
Prefer accessible paths in 'use' suggestions This PR addresses issue https://github.com/rust-lang/rust/issues/26454, where `use` suggestions are made for paths that don't work. For example: ```rust mod foo { mod bar { struct X; } } fn main() { X; } // suggests `use foo::bar::X;` ```
2020-06-21Move remaining `NodeId` APIs from `Definitions` to `Resolver`marmeladema-3/+3
2020-06-21Prefer accessible paths in 'use' suggestionsDan Aloni-1/+6
This fixes an issue with the following sample: mod foo { mod inaccessible { pub struct X; } pub mod avail { pub struct X; } } fn main() { X; } Instead of suggesting both `use crate::foo::inaccessible::X;` and `use crate::foo::avail::X;`, it should only suggest the latter. It is done by trimming the list of suggestions from inaccessible paths if accessible paths are present. Visibility is checked with `is_accessible_from` now instead of being hard-coded. - Some tests fixes are trivial, and others require a bit more explaining, here are my comments: src/test/ui/issues/issue-35675.stderr: Only needs to make the enum public to have the suggestion make sense. src/test/ui/issues/issue-42944.stderr: Importing the tuple struct won't help because its constructor is not visible, so the attempted constructor does not work. In that case, it's better not to suggest it. The case where the constructor is public is covered in `issue-26545.rs`.
2020-06-20Correctly handle binders inside trait predicatesMatthew Jasper-5/+8