summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2020-01-16resolve: Point at the private item definitions in privacy errorsVadim Petrochenkov-10/+70
2020-01-12Update `output-default.json` and rustdoc testvarkor-1/+1
2020-01-12Appease tidyvarkor-1/+2
2020-01-12Diagnostics should not end with a full stopvarkor-3/+3
2020-01-10Ignore platforms that can't point to stdEsteban Küber-8/+12
2020-01-10Use `def_span` to minimize definition span to first line when possibleEsteban Küber-10/+4
2020-01-10Point at the span for the definition of crate foreign ADTsEsteban Küber-2/+13
2020-01-03tweak wording of mismatched delimiter errorsAndy Russell-9/+9
2019-12-30refactor and fix this-expression-has-type noteMazdak Farrokhzad-0/+8
2019-12-11resolve: Always resolve visibilities on impl itemsVadim Petrochenkov-0/+34
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-12/+15
2019-11-18Surround types with backticks in type errorsEsteban Küber-4/+4
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-9/+0
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-7/+7
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-1/+1
Remove "here" from "expected one of X here"
2019-11-06Remove "here" from "expected one of X here"Esteban Küber-1/+1
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
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