summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2021-04-23Auto merge of #83729 - JohnTitor:issue-43913, r=estebankbors-13/+11
Add a suggestion when using a type alias instead of trait alias Fixes #43913 r? `@estebank`
2021-04-19fix suggestion for unsized function parameterslcnr-2/+2
2021-04-18Auto merge of #84065 - c410-f3r:tests-tests-tests, r=petrochenkovbors-0/+210
Move some tests to more reasonable directories - 6 cc #73494 r? `@petrochenkov` git mv bad/bad-const-type.* static/ git mv bad/bad-crate-name.* extern git mv bad/bad-env-capture* fn/ git mv bad/bad-expr-lhs.* expr/ git mv bad/bad-expr-path* expr/ git mv bad/bad-extern-link-attrs.* extern/ git mv bad/bad-intrinsic-monomorphization.* intrinsics/ git mv bad/bad-lint-cap* lint/ git mv bad/bad-main.* fn git mv bad/bad-method-typaram-kind.* type/ git mv bad/bad-mid-path-type-params.* fn git mv bad/bad-module.* modules/ git mv bad/bad-sized.* type/ git mv bad/bad-type-env-capture.* fn
2021-04-17Move some tests to more reasonable directories - 6Caio-0/+210
2021-04-17Auto merge of #84113 - SNCPlay42:suggestion-extern-crate, r=petrochenkovbors-0/+39
Detect when suggested paths enter extern crates more rigorously When reporting resolution errors, the compiler tries to avoid suggesting importing inaccessible paths from other crates. However, the search for suggestions only recognized when it was entering a crate root directly, and so failed to recognize a path like `crate::module::private_item`, where `module` was imported from another crate with `use other_crate::module`, as entering another crate. Fixes #80079 Fixes #84081
2021-04-11detect when suggested paths enter extern crates more rigorouslySNCPlay42-0/+39
2021-04-07Added additional comments and minor editsK-2/+2
2021-04-01Fixed diagnostic and added test for issue 81508Kevin Jiang-0/+43
2021-04-01Add a suggestion when using a type alias instead of trait aliasYuki Okushi-13/+11
2021-03-30Add a regression test for issue-82865JohnTitor-0/+34
2021-03-20Move some tests to more reasonable directories - 5Caio-0/+83
2021-03-07diagnostics: Differentiate between edition meanings of ::foo in resolve ↵Manish Goregaokar-3/+3
diagnostics for ::foo::Bar
2021-03-06Move some tests to more suitable subdirsYuki Okushi-0/+22
2021-02-24clarifies error when finding mismatched returned types for async functionsNell Shamrell-1/+2
Signed-off-by: Nell Shamrell <nellshamrell@gmail.com>
2021-02-18Fix popping singleton paths in when generating E0433Ömer Sinan Ağacan-0/+12
Fixes #82156
2021-01-31Move some tests to more reasonable directoriesCaio-0/+21
2021-01-18Add tests for resolution changesRyan Levick-0/+30
2021-01-13Auto merge of #77524 - Patryk27:fixes/66228, r=estebankbors-0/+6
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-11Move some tests to more reasonable directoriesCaio-0/+21
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-0/+6
2020-12-26update testsBastian Kauschke-1/+0
2020-12-07Move some tests to subdirectoriesVadim Petrochenkov-0/+104
2020-11-24Auto merge of #79294 - petrochenkov:determ, r=varkorbors-0/+7
resolve: Do not put macros into `module.unexpanded_invocations` unless necessary Macro invocations in modules <sup>(*)</sup> need to be tracked because they can produce named items when expanded. We cannot give definite answer to queries like "does this module declare name `n`?" until all macro calls in that module are expanded. Previously we marked too many macros as potentially producing named items. E.g. in this example ```rust mod m { const C: u32 = line!(); } ``` `line!()` cannot emit any items into module `m`, but it was still marked. This PR fixes that and marks macro calls as "unexpanded in module" only if they can actually emit named items into that module. Diagnostics in UI test outputs have different order now because this change affects macro expansion order. <sup>*</sup> Any containers for named items are called modules in resolve (that includes blocks, traits and enums in addition to `mod` items).
2020-11-22Drop support for cloudabi targetsLzu Tao-10/+6
2020-11-22resolve: Do not put macros into `module.unexpanded_invocations` unless necessaryVadim Petrochenkov-11/+3
2020-11-22Add test for an unmotivated "cannot determine resolution" errorVadim Petrochenkov-0/+15
2020-11-01Auto merge of #78420 - estebank:suggest-assoc-fn, r=petrochenkovbors-21/+68
Suggest calling associated `fn` inside `trait`s When calling a function that doesn't exist inside of a trait's associated `fn`, and another associated `fn` in that trait has that name, suggest calling it with the appropriate fully-qualified path. Expand the label to be more descriptive. Prompted by the following user experience: https://users.rust-lang.org/t/cannot-find-function/50663
2020-10-27Add unsized_fn_params featureSantiago Pastorino-3/+3
2020-10-26Suggest calling associated `fn` inside `trait`sEsteban Küber-21/+68
When calling a function that doesn't exist inside of a trait's associated `fn`, and another associated `fn` in that trait has that name, suggest calling it with the appropriate fully-qualified path. Expand the label to be more descriptive. Prompted by the following user experience: https://users.rust-lang.org/t/cannot-find-function/50663
2020-10-20review commentsEsteban Küber-1/+1
2020-10-20Tweak "object unsafe" errorsEsteban Küber-3/+4
Fix #77598.
2020-10-17Rollup merge of #77925 - JohnTitor:sugg-min-features, r=davidtwco,oli-obkYuki Okushi-0/+1
Suggest minimal subset features in `incomplete_features` lint This tells users that we have a minimal subset feature of it and they can fix the lint warning without allowing it. The wording improvement is helpful :) Fixes #77913
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+1
2020-10-15resolve: suggest variants with placeholdersDavid Wood-10/+102
This commit improves the diagnostic modified in rust-lang/rust#77341 to suggest not only those variants which do not have fields, but those with fields (by suggesting with placeholders). Signed-off-by: David Wood <david@davidtw.co>
2020-10-07Auto merge of #77341 - davidtwco:issue-73427-you-might-have-meant-variant, ↵bors-35/+8
r=estebank resolve: improve "try using the enum's variant" Fixes #73427. This PR improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. All of the diagnostic logic introduced by this PR is separated from the normal code path for a successful compilation. r? `@estebank`
2020-10-02Fix span for incorrect pattern field and add labelEsteban Küber-2/+4
2020-09-29resolve: improve "try using the enum's variant"David Wood-35/+8
This commit improves the "try using the enum's variant" suggestion: - Variants in suggestions would not result in more errors (e.g. use of a struct variant is only suggested if the suggestion can trivially construct that variant). Therefore, suggestions are only emitted for variants that have no fields (since the suggestion can't know what value fields would have). - Suggestions include the syntax for constructing the variant. If a struct or tuple variant is suggested, then it is constructed in the suggestion - unless in pattern-matching or when arguments are already provided. - A help message is added which mentions the variants which are no longer suggested. Signed-off-by: David Wood <david@davidtw.co>
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-3/+3
Improve unresolved use error message "use of undeclared type or module `foo`" doesn't mention that it could be a crate. This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate. I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-16/+16
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-09-01Clarify message about unresolved useKornel-3/+3
2020-08-13Suggest adding `&self` when accessing `self` in static assoc `fn`Esteban Küber-14/+13
2020-08-10Add missing primary labelEsteban Küber-1/+1
2020-08-10Point at item definition in foreign cratesEsteban Küber-0/+5
2020-08-10Do not suggest similarly named enclosing itemEsteban Küber-7/+0
2020-08-10Tweak ordering of suggestionsEsteban Küber-20/+20
Modify logic to make it easier to follow and recover labels that would otherwise be lost.
2020-07-27mv std libs to library/mark-1/+1
2020-07-14Rollup merge of #74228 - estebank:unsized-param, r=davidtwcoManish Goregaokar-2/+4
Provide structured suggestion on unsized fields and fn params * Suggest borrowing or boxing unsized fields * Suggest borrowing fn parameters * Remove some verbosity of unsized errors * Remove `on_unimplemented` note from `trait Sized` Fix #23286, fix #28653. r? @davidtwco
2020-07-14Suggest borrowing in more unsized fn param casesEsteban Küber-1/+4
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-1/+0
2020-07-14Suggest struct pat on incorrect unit or tuple patEsteban Küber-12/+18
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.