about summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2019-09-22Point at definition when misusing ADTEsteban Küber-12/+51
When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at `Foo`'s definition in the error.
2019-09-15resolve: Remove `!` from "cannot find" diagnostics for macrosVadim Petrochenkov-2/+2
2019-09-14Provide a span if main function is not present in crateMark Rousskov-6/+3
Unfortunately, the diagnotic machinery does not cope well with an empty span which can happen if the crate is empty, in which case we merely set a spanless note.
2019-09-07resolve: Adjust `hygienic_lexical_parent` to account for enum and trait modulesVadim Petrochenkov-0/+14
2019-09-02account for DUMMY_SP and correct wordingEsteban Küber-0/+2
2019-09-02On object safety violation, point at source when possibleEsteban Küber-2/+0
2019-09-02Refer to "`self` type" instead of "receiver type"Esteban Küber-1/+1
2019-08-12Rollup merge of #63406 - ↵Mazdak Farrokhzad-5/+113
jakubadamw:resolve-inconsistent-names-suggest-qualified-path, r=petrochenkov Suggest using a qualified path in patterns with inconsistent bindings A program like the following one: ```rust enum E { A, B, C } fn f(x: E) -> bool { match x { A | B => false, C => true } } ``` is rejected by the compiler due to `E` variant paths not being in scope. In this case `A`, `B` are resolved as pattern bindings and consequently the pattern is considered invalid as the inner or-patterns do not bind to the same set of identifiers. This is expected but the compiler errors that follow could be surprising or confusing to some users. This commit adds a help note explaining that if the user desired to match against variants or consts, they should use a qualified path. The help note is restricted to cases where the identifier starts with an upper-case sequence so as to reduce the false negatives. Since this happens during resolution, there's no clean way to check what it is the patterns match against. The syntactic criterium, however, is in line with the convention that's assumed by the `non-camel-case-types` lint. Fixes #50831.
2019-08-10Apply suggestions from code reviewJakub Adam Wieczorek-3/+3
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-08-10Suggest using a qualified path in patterns with inconsistent bindingsJakub Adam Wieczorek-5/+113
A program like the following one: ```rust enum E { A, B, C } fn f(x: E) -> bool { match x { A | B => false, C => true } } ``` is rejected by the compiler due to `E` variant paths not being in scope. In this case `A`, `B` are resolved as pattern bindings and consequently the pattern is considered invalid as the inner or-patterns do not bind to the same set of identifiers. This is expected but the compiler errors that follow could be surprising or confusing to some users. This commit adds a help note explaining that if the user desired to match against variants or consts, they should use a qualified path. The note is restricted to cases where the identifier starts with an upper-case sequence so as to reduce the false negatives. Since this happens during resolution, there's no clean way to check what the patterns match against. The syntactic criterium, however, is in line with the convention that's assumed by the `non-camel-case-types` lint.
2019-08-10diagnostics: Describe crate root modules in `DefKind::Mod` as "crate"Vadim Petrochenkov-3/+3
2019-08-10resolve: Address FIXME from the previous commitVadim Petrochenkov-4/+4
Make the `is_import` flag in `ScopeSet` independent from namespace Fix rebase
2019-08-10resolve: Move late resolution into a separate visitorVadim Petrochenkov-12/+37
Move `Resolver` fields specific to late resolution to the new visitor. The `current_module` field from `Resolver` is replaced with two `current_module`s in `LateResolutionVisitor` and `BuildReducedGraphVisitor`. Outside of those visitors `current_module` is replaced by passing `parent_scope` to more functions and using the parent module from it. Visibility resolution no longer have access to later resolution methods and has to use early resolution, so its diagnostics in case of errors regress slightly.
2019-08-10Rollup merge of #63423 - estebank:priv-tuple, r=zackmdavisMazdak Farrokhzad-0/+12
Mention that tuple structs are private if any of their fields are CC #39703
2019-08-09Mention that tuple structs are private if their fields areEsteban Küber-0/+12
2019-08-09review comments: typo and rewordingEsteban Küber-3/+3
2019-08-09Differentiate between tuple structs and tuple variantsEsteban Küber-3/+3
2019-08-09When suggesting fn call use an appropriate number of placeholder argumentsEsteban Küber-3/+3
2019-08-09Suggest calling function on type error when finding bare fnEsteban Küber-3/+21
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-5/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-18resolve: Visit all scopes to collect suggestion candidates for unresolved macrosVadim Petrochenkov-1/+1
2019-07-12Do not emit type errors after parse error in last statement of blockEsteban Küber-17/+3
When recovering from a parse error inside a block, do not emit type errors generating on that block's recovered return expression. Fix #57383.
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-1/+1
2019-05-29Update ui test suite to use dynmemoryruins-14/+14
2019-04-22Fix #58270, fix off-by-one error in error diagnostics.Xavier Denis-3/+2
2019-04-18review comments: change wordingEsteban Küber-3/+3
2019-04-18Change suggestion of field when not in self contextEsteban Küber-19/+10
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-18/+15
2019-04-17Resolve inconsistency in error messages between "parameter" and "variable".Eduard-Mihai Burtescu-4/+4
2019-04-10clarify what the item is in "not a module" errorAndy Russell-6/+6
2019-03-28Rollup merge of #59198 - estebank:recovered-pattern, r=zackmdavisMazdak Farrokhzad-9/+2
Do not complain about unmentioned fields in recovered patterns When the parser has to recover from malformed code in a pattern, do not complain about missing fields. Fix #59145.
2019-03-24Deduplicate code for path suggestionEsteban Küber-1/+1
2019-03-23Mark duplicate import removal suggestion tool onlyEsteban Küber-1/+0
2019-03-23Tweak unnecessary import suggestionEsteban Küber-4/+2
2019-03-21use suggestions for "enum instead of variant" errorAndy Russell-23/+42
2019-03-14Do not complain about unmentioned fields in recovered patternsEsteban Küber-9/+2
When the parser has to recover from malformed code in a pattern, do not complain about missing fields.
2019-03-14Moved issue tests to subdirs and normalised names.Alexander Regueiro-7/+10
2019-03-11Update testsVadim Petrochenkov-41/+41
2019-03-06Collect unclosed delimiters in parent parserEsteban Küber-25/+26
2019-03-06Emit missing unclosed delimiter errorsEsteban Küber-34/+31
2019-02-11Only suggest imports if not imported.David Wood-12/+3
This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant.
2019-02-09Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obkbors-20/+15
Deduplicate mismatched delimiter errors Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently. Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-07Make name resolution handle consts in GenericParamsFromOuterFunction properlyvarkor-16/+16
2019-02-07tweak wording based on in person feedbackEsteban Küber-1/+1
2019-02-07Add missing trailing newlineEsteban Küber-1/+1
2019-02-07Remove spurious complaint about missing expression for bare semicolonsEsteban Küber-8/+11
2019-02-07Deduplicate mismatched delimiter errorsEsteban Küber-21/+13
Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.
2019-01-31Add suggestion for duplicated import.David Wood-5/+4
This commit adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import.
2019-01-15use structured macro and path resolve suggestionsAndy Russell-14/+24
2019-01-14Rollup merge of #57477 - euclio:clarify-lev-suggestion, r=zackmdavisMazdak Farrokhzad-27/+46
clarify resolve typo suggestion Include the kind of the binding that we're suggesting, and use a structured suggestion. Fixes #53445.