about summary refs log tree commit diff
path: root/src/test/ui/resolve
AgeCommit message (Collapse)AuthorLines
2021-10-08testsb-naber-0/+37
2021-09-30Rollup merge of #88838 - FabianWolff:issue-88472, r=estebankManish Goregaokar-38/+108
Do not suggest importing inaccessible items Fixes #88472. For this example: ```rust mod a { struct Foo; } mod b { type Bar = Foo; } ``` rustc currently emits: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | help: consider importing this struct | 6 | use a::Foo; | ``` this is incorrect, as applying this suggestion leads to ``` error[E0603]: struct `Foo` is private --> test.rs:6:12 | 6 | use a::Foo; | ^^^ private struct | note: the struct `Foo` is defined here --> test.rs:2:5 | 2 | struct Foo; | ^^^^^^^^^^^ ``` With my changes, I get: ``` error[E0412]: cannot find type `Foo` in this scope --> test.rs:6:16 | 6 | type Bar = Foo; | ^^^ not found in this scope | = note: this struct exists but is inaccessible: a::Foo ``` As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.
2021-09-27suggest path for tuple structTakayuki Maeda-0/+45
2021-09-26Improve diagnostics for inaccessible itemsFabian Wolff-22/+51
2021-09-26Do not suggest importing inaccessible itemsFabian Wolff-44/+85
2021-09-15Move some tests to more reasonable directoriesCaio-0/+77
2021-09-03Auto merge of #88386 - estebank:unmatched-delims, r=jackh726bors-8/+8
Point at unclosed delimiters as part of the primary MultiSpan Both the place where the parser encounters a needed closed delimiter and the unclosed opening delimiter are important, so they should get the same level of highlighting in the output. _Context: https://twitter.com/mwk4/status/1430631546432675840_
2021-09-01Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebankbors-6/+6
Improve errors for recursive type aliases Fixes #17539.
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-18/+6
2021-08-27Point at unclosed delimiters as part of the primary MultiSpanEsteban Kuber-8/+8
Both the place where the parser encounters a needed closed delimiter and the unclosed opening delimiter are important, so they should get the same level of highlighting in the output.
2021-08-21Improve errors for recursive type aliasesNoah Lev-6/+6
2021-08-11Modify structured suggestion outputEsteban Küber-39/+39
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-4/+4
2021-07-27Permit deriving default on enums with `#[default]`Jacob Pratt-1/+1
2021-07-08Move [debug_]assert_matches to mod {core, std}::assert.Mara Bos-7/+7
2021-06-24Auto merge of #85427 - ehuss:fix-use-placement, r=jackh726bors-4/+50
Fix use placement for suggestions near main. This fixes an edge case for the suggestion to add a `use`. When running with `--test`, the `main` function will be annotated with an `#[allow(dead_code)]` attribute. The `UsePlacementFinder` would end up using the dummy span of that synthetic attribute. If there are top-level inner attributes, this would place the `use` in the wrong position. The solution here is to ignore attributes with dummy spans. In the process of working on this, I discovered that the `use_suggestion_placement` test was broken. `UsePlacementFinder` is unaware of active attributes. Attributes like `#[derive]` don't exist in the AST since they are removed. Fixing that is difficult, since the AST does not retain enough information. I considered trying to place the `use` towards the top of the module after any `extern crate` items, but I couldn't find a way to get a span for the start of a module block (the `mod` span starts at the `mod` keyword, and it seems tricky to find the spot just after the opening bracket and past inner attributes). For now, I just put some comments about the issue. This appears to have been a known issue in #44215 where the test for it was introduced, and the fix seemed to be deferred to later.
2021-05-19Disallow shadowing const parametersFabian Wolff-0/+77
2021-05-18Fix use placement for suggestions near main.Eric Huss-4/+50
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-1/+1
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
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.