summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2019-12-14resolve: Always resolve visibilities on impl itemsVadim Petrochenkov-0/+34
2019-10-31update ui testsGuillaume Gomez-0/+1
2019-10-30Update ui testsGuillaume Gomez-1/+1
2019-10-29Change E0741 into E0742Guillaume Gomez-2/+2
2019-10-29Update ui testsGuillaume Gomez-2/+3
2019-10-27Point at local similarly named element and tweak references to variantsEsteban Küber-27/+122
Point at the span for the definition of ADTs internal to the current crate. Look at the leading char of the ident to determine whether we're expecting a likely fn or any of a fn, a tuple struct or a tuple variant. Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+29
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-17Point at enclosing function without `self` receiverEsteban Küber-4/+14
2019-10-17Refer to "associated functions" instead of "static methods"Esteban Küber-2/+2
2019-10-15Rollup merge of #65308 - GuillaumeGomez:long-err-explanation-E0574, ↵Tyler Mandry-0/+1
r=matthewjasper Add long error explanation for E0574 Part of #61137.
2019-10-14Rollup merge of #65398 - estebank:capitalization-only, r=varkorTyler Mandry-3/+3
Bring attention to suggestions when the only difference is capitalization CC #65386.
2019-10-14Use heuristics for capitalization warning in suggestionsEsteban Küber-1/+1
2019-10-13Bring attention to suggestions when the only difference is capitalizationEsteban Küber-4/+4
2019-10-13Update ui testsGuillaume Gomez-0/+1
2019-10-11resolve: shorten wording on private constructor errorDan Aloni-6/+6
2019-10-11resolve: fix error title regarding private constructorsDan Aloni-12/+12
The constructor is private, not the type. Idea credit to @petrochenkov, discussed at #65153
2019-10-10Auto merge of #65153 - da-x:issue-58017, r=petrochenkovbors-10/+20
Improve message when attempting to instantiate tuple structs with private fields Fixes #58017, fixes #39703. ``` error[E0603]: tuple struct `Error` is private --> main.rs:22:16 | 2 | pub struct Error(usize, pub usize, usize); | ----- ----- field is private | | | field is private ... 22 | let x = a::Error(3, 1, 2); | ^^^^^ | = note: a tuple struct constructor is private if any of its fields is private ```
2019-10-09resolve: Use field spans for reporting the private constructor errorVadim Petrochenkov-10/+20
2019-10-08resolve: prohibit foreign statics w/ genericsDavid Wood-0/+104
This commit modifies resolve to disallow foreign statics that use parent generics. `improper_ctypes` is not written to support type parameters, as these are normally disallowed before the lint is run. Thus, type parameters in foreign statics must be prohibited before the lint. The only other case where this *could* have occured is in functions, but typeck prohibits this with a "foreign items may not have type parameters" error - a similar error did not exist for statics, because statics cannot have type parameters, but they can use any type parameters that are in scope (which isn't the case for functions). Signed-off-by: David Wood <david@davidtw.co>
2019-09-29Rollup merge of #64691 - estebank:unexpected-variant, r=CentrilMazdak Farrokhzad-12/+51
Point at definition when misusing ADT When given `struct Foo(usize)` and using it as `Foo {}` or `Foo`, point at `Foo`'s definition in the error.
2019-09-28Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centrilbors-1/+1
Add Long error explanation for E0531 Part of #61137.
2019-09-25update ui testsGuillaume Gomez-1/+1
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