about summary refs log tree commit diff
path: root/tests/ui/resolve
AgeCommit message (Collapse)AuthorLines
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-2/+2
2023-12-06Auto merge of #118687 - matthiaskrgr:rollup-317ztgu, r=matthiaskrgrbors-0/+19
Rollup of 6 pull requests Successful merges: - #117981 (Remove deprecated `--check-cfg` syntax) - #118177 (Suppress warnings in LLVM wrapper when targeting MSVC) - #118317 (tip for define macro name after `macro_rules!`) - #118504 (Enforce `must_use` on associated types and RPITITs that have a must-use trait in bounds) - #118660 (rustc_arena: add `alloc_str`) - #118681 (Fix is_foreign_item for StableMIR instance ) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-06tip for define macro name after `macro_rules!`bohan-0/+19
2023-12-06Use the glob binding in resolve_rustdoc_path processr0cky-0/+20
2023-11-30generic_const_exprs: suggest to add the feature, not use itRalf Jung-1/+1
2023-11-27Dont suggest `!` for path in function call if it has generic argsMichael Goulet-0/+13
2023-11-24Show number in error message even for one errorNilstrieb-71/+71
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-07When not finding assoc fn on type, look for builder fnEsteban Küber-0/+26
When we have a resolution error when looking at a fully qualified path on a type, look for all associated functions on inherent impls that return `Self` and mention them to the user. Fix #69512.
2023-10-16Rollup merge of #116257 - estebank:issue-101351, r=b-naberMatthias Krüger-2/+52
Suggest trait bounds for used associated type on type param Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-13Stabilize AFIT and RPITITMichael Goulet-31/+2
2023-10-13Suggest trait bounds for used associated type on type paramEsteban Küber-2/+52
Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-02Rollup merge of #114454 - Nilstrieb:no-evil-sorting, r=cjgillotTyler Mandry-21/+21
Replace `HashMap` with `IndexMap` in pattern binding resolve fixes https://github.com/rust-lang/rust/pull/114332#discussion_r1284189179
2023-10-02Replace `HashMap` with `IndexMap` in pattern binding resolveNilstrieb-21/+21
It will be iterated over, so we should avoid using `HashMap`.
2023-10-01Auto merge of #116228 - bvanjoi:fix-116164, r=cjgillotbors-0/+33
resolve: skip underscore character during candidate lookup Fixes #116164 In use statement, an underscore is merely a placeholder symbol and does not bind to any name. Therefore, it can be safely ignored.
2023-09-28resolve: skip underscore character during candidate lookupbohan-0/+33
2023-09-25Point at field definition when unresolved name exists in `Self`Esteban Küber-14/+32
2023-09-25When suggesting `self.x` for `S { x }`, use `S { x: self.x }`Esteban Küber-37/+174
Tweak output. Fix #115992.
2023-09-24Rollup merge of #116086 - estebank:issue-115992, r=compiler-errorsMatthias Krüger-3/+39
More accurate suggestion for `self.` and `Self::` Detect that we can't suggest `self.` in an associated function without `&self` receiver. Partially address #115992. r? ``@compiler-errors``
2023-09-23Add testEsteban Küber-0/+36
2023-09-23Tweak wording and logicEsteban Küber-3/+3
2023-09-19rustc_hir_analysis: add a helper to check function the signature mismatchesEduardo Sánchez Muñoz-4/+4
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-11Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errorsMatthias Krüger-67/+168
Improve diagnostic for generic params from outer items (E0401) Generalize the wording of E0401 to talk about *outer items* instead of *outer functions* since the current phrasing is outdated. The outer item can be a function, constant, trait, ADT or impl block (see the new UI test for the more exotic examples). Further, don't suggest introducing generic parameters to constant items unless the feature `generic_const_items` is enabled. Lastly, make E0401 translatable while we're at it. Fixes #115720.
2023-09-10Do not suggest generic const items unless enabledLeón Orell Valerian Liehr-0/+101
2023-09-10Generalize E0401León Orell Valerian Liehr-67/+67
2023-09-07Find lowest span out of use + attrsMichael Goulet-1/+1
2023-09-07Test showing it doesnt workMichael Goulet-0/+45
2023-08-28Move testsCaio-0/+20
2023-08-18Bless test changesGary Guo-9/+9
2023-08-06Rollup merge of #114503 - ↵Matthias Krüger-0/+10
chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors Remove invalid lint when there is a generic argument in prefix path Fixes #114433
2023-08-05Remove invalid lint when there is a generic argument in prefix pathyukang-0/+10
2023-08-02Resolve visibility paths as modules not as types.Camille GILLOT-0/+20
2023-07-29fix(resolve): update the ambiguity glob binding as warning recursivelybohan-4/+20
2023-07-20Auto merge of #113622 - RickleAndMortimer:issue-113184-fix, r=oli-obkbors-0/+1
add links to query documentation for E0391 This PR adds links to https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for the rustc --explain E0391 and within the compiler error itself. Fixes: #113184
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-5/+1
2023-07-18added links as a notenxya-1/+1
2023-07-18add links to query documentation for E0391nxya-1/+1
2023-07-18added links as a notenxya-1/+6
2023-07-18add links to query documentation for E0391nxya-1/+1
2023-07-18Fix removal span calculation of unused_qualifications suggestion许杰友 Jieyou Xu (Joe)-6/+101
2023-07-15Check entry type as part of item type checking.Camille GILLOT-12/+12
2023-07-13Add machine-applicable suggestion for `unused_qualifications` lint许杰友 Jieyou Xu (Joe)-0/+75
2023-07-10Rollup merge of #113331 - chenyukang:yukang-fix-112590-false-positive, ↵Matthias Krüger-10/+131
r=estebank Add filter with following segment while lookup typo for path From the discussion: https://github.com/rust-lang/rust/pull/112917#discussion_r1239150173 Seems we can not get the assoc items for `Struct`, `Enum` in the resolving phase. A obvious filter is avoid suggesting the same name with the following segment path. Use `following_seg` can extend the function `smart_resolve_partial_mod_path_errors` for more scenarios, such as `std::sync_error::atomic::AtomicBool` in test case. r? `@estebank`
2023-07-08Remove `default_free_fn` featureYuki Okushi-15/+6
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-07-07smart_resolve_partial_mod_path_errors should not suggest parentyukang-10/+0
2023-07-07Add filter with next segment while lookup typo for pathyukang-0/+131
2023-07-04Auto merge of #112917 - chenyukang:yukang-fix-112590, r=estebankbors-1/+35
Suggest importing for partial mod path matching in name resolving Fixes #112590
2023-07-03Don't perform selection if IATs are not enabledLeón Orell Valerian Liehr-15/+15
2023-07-02add testcase for 112590yukang-1/+30
2023-06-22Tweak privacy errors to account for reachable itemsEsteban Küber-2/+6
Suggest publicly accessible paths for items in private mod: When encountering a path in non-import situations that are not reachable due to privacy constraints, search for any public re-exports that the user could use instead. Track whether an import suggestion is offering a re-export. When encountering a path with private segments, mention if the item at the final path segment is not publicly accessible at all. Add item visibility metadata to privacy errors from imports: On unreachable imports, record the item that was being imported in order to suggest publicly available re-exports or to be explicit that the item is not available publicly from any path. In order to allow this, we add a mode to `resolve_path` that will not add new privacy errors, nor return early if it encounters one. This way we can get the `Res` corresponding to the final item in the import, which is used in the privacy error machinery.
2023-06-22suggest importing for partial mod path in name resolvingyukang-0/+5