about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2019-01-22Fix some cross crate existential type ICEsOliver Scherer-0/+1
2019-01-20Remove unnecessary dummy span checksEsteban Küber-9/+5
The emitter already verifies wether a given span note or span label can be emitted to the output. If it can't, because it is a dummy span, it will be either elided for labels or emitted as an unspanned note/help when applicable.
2019-01-19Rollup merge of #57699 - euclio:applicability-ify, r=petrochenkovMazdak Farrokhzad-3/+15
add applicability to remaining suggestions Fixes #50723. I noticed that the suggestion methods on `DiagnosticBuilder` weren't actually deprecated due to #57679. This PR deprecates them properly and fixes the remaining usages. There's also a PR for clippy at rust-lang/rust-clippy#3667.
2019-01-19Rollup merge of #57502 - nikomatsakis:fix-trait-alias-1b, r=nikomatsakisMazdak Farrokhzad-0/+3
make trait-aliases work across crates This is rebase of a small part of @alexreg's PR #55994. It focuses just on the changes that integrate trait aliases properly into crate metadata, excluding the stylistic edits and the trait objects. The stylistic edits I also rebased and can open a separate PR. The trait object stuff I found challenging and decided it basically needed to be reimplemented. For now I've excluded it. Since this is really @alexreg's work (I really just rebased) I am going to make it r=me once it is working. Fixes #56488. Fixes #57023.
2019-01-18Rollup merge of #57725 - estebank:parens, r=michaelwoeristerMazdak Farrokhzad-5/+37
Use structured suggestion to surround struct literal with parenthesis
2019-01-18Rollup merge of #57635 - euclio:path-separators, r=michaelwoeristerMazdak Farrokhzad-5/+19
use structured macro and path resolve suggestions
2019-01-17Use structured suggestion to surround struct literal with parenthesisEsteban Küber-5/+37
2019-01-17properly deprecate suggestion methodsAndy Russell-3/+15
2019-01-16Auto merge of #57392 - Xanewok:always-calc-glob-map, r=petrochenkovbors-16/+7
Always calculate glob map but only for glob uses Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance. Main motivation is to get rid of some of the moving pieces and simplify the compilation interface - this would allow us to entirely remove `CrateAnalysis`. Later, we could easily expose a relevant query, similar to the likes of `maybe_unused_trait_import` (so using precomputed data from the resolver, but which could be rewritten to be on-demand). r? @nikomatsakis Local perf run showed mostly noise (except `ctfe-stress-*`) but I'd appreciate if we could do a perf run run here and double-check that this won't regress performance.
2019-01-15use structured macro and path resolve suggestionsAndy Russell-5/+19
2019-01-14stabilize extern_crate_selfRyan Leckey-5/+1
2019-01-14Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkovMazdak Farrokhzad-5/+4
Unaccept `extern_in_paths` Based on completed fcp-close in https://github.com/rust-lang/rust/issues/55600, this removes `extern_in_path` (e.g. `extern::foo::bar`) from the language. The changes are primarily reversing https://github.com/rust-lang/rust/commit/32db83b16e06cb5cca72d0e6a648a8008eda0fac. Closes https://github.com/rust-lang/rust/issues/55600 r? @petrochenkov
2019-01-14Rollup merge of #57477 - euclio:clarify-lev-suggestion, r=zackmdavisMazdak Farrokhzad-18/+69
clarify resolve typo suggestion Include the kind of the binding that we're suggesting, and use a structured suggestion. Fixes #53445.
2019-01-13remove extern_in_paths.Mazdak Farrokhzad-5/+4
2019-01-13Always calculate glob map but only for glob usesIgor Matuszewski-16/+7
Previously calculating glob map was *opt-in*, however it did record node id -> ident use for every use directive. This aims to see if we can unconditionally calculate the glob map and not regress performance.
2019-01-13Rollup merge of #57560 - petrochenkov:selfinmac, r=alexregMazdak Farrokhzad-9/+7
hygiene: Do not treat `Self` ctor as a local variable Fixes https://github.com/rust-lang/rust/issues/57523
2019-01-13Rollup merge of #57557 - petrochenkov:ecused, r=varkorMazdak Farrokhzad-0/+3
resolve: Mark extern crate items as used in more cases Fixes https://github.com/rust-lang/rust/issues/57421
2019-01-13hygiene: Do not treat `Self` ctor as a local variableVadim Petrochenkov-9/+7
2019-01-13resolve: Mark extern crate items as used in more casesVadim Petrochenkov-0/+3
2019-01-12Fix a hole in generic parameter import future-proofingVadim Petrochenkov-5/+26
Add some tests for buggy derive helpers
2019-01-12Stabilize `uniform_paths`Vadim Petrochenkov-19/+10
2019-01-12resolve: Prohibit use of imported tool modulesVadim Petrochenkov-0/+7
2019-01-12resolve: Prohibit use of imported non-macro attributesVadim Petrochenkov-1/+18
2019-01-12resolve: Prohibit use of uniform paths in macros originating from 2015 editionVadim Petrochenkov-4/+9
...while still keeping ambiguity errors future-proofing for uniform paths. This corner case is not going to be stabilized for 1.32 and needs some more general experiments about retrofitting 2018 import rules to 2015 edition
2019-01-12resolve: Assign `pub` and `pub(crate)` visibilities to `macro_rules` itemsVadim Petrochenkov-3/+7
2019-01-10integrate trait aliases into def-paths / metadataNiko Matsakis-0/+3
Co-authored-by: Alexander Regueiro <alexreg@me.com>
2019-01-09clarify resolve typo suggestionAndy Russell-18/+69
Include the kind of the binding that we're suggesting, and use a structured suggestion.
2019-01-03Fix repeated word typosWiktor Kuchta-1/+1
Found with `git grep -P '\b([a-z]+)\s+\1\b'`
2019-01-01Auto merge of #57199 - petrochenkov:ambig, r=estebankbors-52/+50
resolve: Simplify treatment of ambiguity errors If we have a glob conflict like this ```rust mod m1 { struct S; } mod m2 { struct S; } use m1::*; use m2::*; ``` we treat it as a special "ambiguity item" that's not an error by itself, but produces an error when actually used. ```rust use m1::*; // primary use m2::*; // secondary => ambiguity S(m1::S, m2::S); ``` Ambiguity items were *sometimes* treated as their primary items for error recovery, but pretty irregularly. After this PR they are always treated as their primary items, except that - If an ambiguity item is marked as used, then it still produces an error. - Ambiguity items are still filtered away when exported to other crates (which is also a use in some sense).
2018-12-31Auto merge of #57208 - estebank:issue-57198, r=petrochenkovbors-2/+5
Do not complain about missing crate named as a keyword Fix #57198.
2018-12-30Address review comments: Remove new `PathResult` variantEsteban Küber-15/+6
2018-12-30Auto merge of #57185 - petrochenkov:impice4, r=estebankbors-0/+4
resolve: Fix one more ICE in import validation So if you have an unresolved import ```rust mod m { use foo::bar; } ``` error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors. The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g. ```rust mod m { use baz::*; // imports real existing `bar` use foo::bar; } ``` causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like https://github.com/rust-lang/rust/issues/57015. This PR stops overwriting real successful resolutions with `Def::Err`s. Fixes https://github.com/rust-lang/rust/issues/57015
2018-12-29Do not complain about missing crate named as a keywordEsteban Küber-5/+17
2018-12-29Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkovbors-1/+1
Implement RFC 2338, "Type alias enum variants" This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following. ```rust #![feature(type_alias_enum_variants)] enum Foo { Bar(i32), Baz { i: i32 }, } type Alias = Foo; fn main() { let t = Alias::Bar(0); let t = Alias::Baz { i: 0 }; match t { Alias::Bar(_i) => {} Alias::Baz { i: _i } => {} } } ``` Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern. Fixes issues #56199 and #56611. N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible. ```rust Option::<u8>::None; // OK Option::None::<u8>; // OK, but lint in near future (hard error next edition?) Alias::<u8>::None; // OK Alias::None::<u8>; // Error ``` I do not know if this will need an FCP, but let's start one if so.
2018-12-29resolve: Simplify treatment of ambiguity errorsVadim Petrochenkov-52/+50
2018-12-29Auto merge of #57181 - petrochenkov:impice3, r=estebankbors-5/+5
resolve: Fix another ICE in import validation Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`. As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved. Fixes https://github.com/rust-lang/rust/issues/56596
2018-12-29Auto merge of #57160 - petrochenkov:impice2, r=estebankbors-6/+12
resolve: Fix an ICE in import validation Fixes ICE reported in the comment https://github.com/rust-lang/rust/issues/56596#issuecomment-449866807
2018-12-29resolve: Never override real bindings with `Def::Err`s from error recoveryVadim Petrochenkov-0/+4
2018-12-29resolve: Fix another ICE in import validationVadim Petrochenkov-5/+5
2018-12-28Auto merge of #57155 - petrochenkov:dcrate3, r=dtolnaybors-13/+23
Resolve `$crate`s for pretty-printing at more appropriate time Doing it in `BuildReducedGraphVisitor` wasn't a good idea, identifiers wasn't actually visited half of the time. As a result some `$crate`s weren't resolved and were therefore pretty-printed as `$crate` literally, which turns into two tokens during re-parsing of the pretty-printed text. Now we are visiting and resolving `$crate` identifiers in an item right before sending that item to a proc macro attribute or derive. Fixes https://github.com/rust-lang/rust/issues/57089
2018-12-28resolve: Fix an ICE in import validationVadim Petrochenkov-6/+12
2018-12-28Resolve `$crate`s for pretty-printing at more appropriate timeVadim Petrochenkov-13/+23
2018-12-27Address review comments and CI failuresVadim Petrochenkov-1/+1
2018-12-27Do not abort compilation if expansion produces errorsVadim Petrochenkov-12/+26
Fix a number of uncovered deficiencies in diagnostics
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-71/+0
2018-12-24Rollup merge of #57074 - Zoxc:pq-rec-limits, r=oli-obkMazdak Farrokhzad-0/+2
Fix recursion limits r? @michaelwoerister
2018-12-23Fix recursion limitsJohn Kåre Alsaker-0/+2
2018-12-22adjust enum type instead of variant suggestions for prelude enumsZack M. Davis-1/+11
The present author regrets not thinking of a more eloquent way to do this.
2018-12-22enum type instead of variant suggestion unificationZack M. Davis-18/+28
Weirdly, we were deciding between a help note and a structured suggestion based on whether the import candidate span was a dummy—but we weren't using that span in any case! The dummy-ness of the span (which appears to be a matter of this-crate vs. other-crate definition) isn't the right criterion by which we should decide whether it's germane to mention that "there is an enum variant"; instead, let's use the someness of `def` (which is used as the `has_unexpected_resolution` argument to `error_code`). Since `import_candidate_to_paths` has no other callers, we are free to stop returning the span and rename the function. By using `span_suggestions_`, we leverage the max-suggestions output limit already built in to the emitter, thus resolving #56028. In the matter of message wording, "you can" is redundant (and perhaps too informal); prefer the imperative.