about summary refs log tree commit diff
path: root/src/test/ui/suggestions
AgeCommit message (Collapse)AuthorLines
2022-03-07fixouz-a-0/+92
2022-03-05Update tests.Mara Bos-58/+113
2022-03-03Tweak move errorEsteban Kuber-11/+31
Point at method definition that causes type to be consumed. Fix #94056.
2022-02-23Rollup merge of #94240 - compiler-errors:pathbuf-display, r=lcnrMatthias Krüger-2/+16
Suggest calling .display() on `PathBuf` too Fixes #94210
2022-02-21Suggest calling .display() on PathBuf tooMichael Goulet-2/+16
2022-02-21Do not suggest wrapping an item if it has ambiguous un-imported methodsMichael Goulet-0/+41
2022-02-14further update `fuzzy_match_tys`lcnr-12/+8
2022-02-14fuzzify `fuzzy_match_tys`lcnr-0/+12
2022-02-14Make `find_similar_impl_candidates` a little fuzzier.Ben Reeves-0/+3
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-81/+45
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-07Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakisbors-45/+81
Lazy type-alias-impl-trait Previously opaque types were processed by 1. replacing all mentions of them with inference variables 2. memorizing these inference variables in a side-table 3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing. This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around. Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing * https://github.com/rust-lang/rfcs/pull/2515 much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities). r? `@nikomatsakis` fixes #93411 fixes #88236
2022-02-07Rollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelidMara Bos-14/+78
Suggest 1-tuple parentheses on exprs without existing parens A follow-on from #86116, split out from #90677. This alters the suggestion to add a trailing comma to create a 1-tuple - previously we would only apply this if the relevant expression was parenthesised. We now make the suggestion regardless of parentheses, which reduces the fragility of the check (w.r.t formatting). e.g. ```rust let a: Option<(i32,)> = Some(3); ``` gets the below suggestion: ```rust let a: Option<(i32,)> = Some((3,)); // ^ ^^ ``` This change also improves the suggestion in other ways, such as by only making the suggestion if the types would match after the suggestion is applied and making the suggestion a multipart suggestion.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-45/+81
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2022-02-02Detect `::` -> `:` typo in type argumentEsteban Kuber-0/+60
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
2022-01-31Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgrbors-0/+30
Rollup of 8 pull requests Successful merges: - #90277 (Improve terminology around "after typeck") - #92918 (Allow eliding GATs in expression position) - #93039 (Don't suggest inaccessible fields) - #93155 (Switch pretty printer to block-based indentation) - #93214 (Respect doc(hidden) when suggesting available fields) - #93347 (Make `char::DecodeUtf16::size_hist` more precise) - #93392 (Clarify documentation on char::MAX) - #93444 (Fix some CSS warnings and errors from VS Code) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-31Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwcoMatthias Krüger-4/+4
Improve suggestion for escaping reserved keywords r? `@davidtwco`
2022-01-31Rollup merge of #93039 - terrarier2111:fix-field-help, r=nagisaMatthias Krüger-0/+30
Don't suggest inaccessible fields Fixes: https://github.com/rust-lang/rust/issues/92999
2022-01-29Rollup merge of #88205 - danii:e0772, r=GuillaumeGomezMatthias Krüger-2/+4
Add Explanation For Error E0772 I've added an error explanation for the error code E0772. Assists with #61137
2022-01-29Test 1-tuple parentheses wrappingRob Pilling-14/+78
2022-01-28Add Explanation For Error E0772Daniel Conley-2/+4
2022-01-27Improve suggestion for escaping reserved keywordsNoah Lev-4/+4
2022-01-26Don't suggest inaccessible fieldsthreadexception-0/+30
2022-01-25Remove 1-tuple unreachable caseRob Pilling-2/+13
2022-01-25Handle generics with ParamEnvRob Pilling-2/+52
2022-01-25Compare tuple element & arg types before suggesting a tupleRob Pilling-10/+48
2022-01-25Test tuple suggestions, including tuple-as-function-argumentRob Pilling-0/+88
2022-01-18generic_arg_infer: placeholder in signature errlcnr-4/+4
2022-01-17Rollup merge of #92876 - compiler-errors:fix-turbofish-lifetime-suggestion, ↵Matthias Krüger-6/+6
r=nagisa Fix suggesting turbofish with lifetime arguments Now we suggest turbofish correctly given exprs like `foo<'_>`. Also fix suggestion when we have `let x = foo<bar, baz>;` which was broken.
2022-01-13Fix suggesting turbofish with lifetime argumentsMichael Goulet-6/+6
2022-01-12suggest deref/unboxing before wrapping variantMichael Goulet-4/+4
2022-01-11Deduplicate box deref and regular deref suggestionsMichael Goulet-5/+5
2021-12-29Suggest while let x = y when encountering while x = yametisf-0/+54
Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
2021-12-18Rollup merge of #91928 - fee1-dead:constification1, r=oli-obkMatthias Krüger-2/+2
Constify (most) `Option` methods r? ``@oli-obk``
2021-12-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-4/+94
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`
2021-12-17Bless ui testsDeadbeef-2/+2
2021-12-15Auto merge of #86986 - lcnr:simplify_type, r=nikomatsakis,oli-obkbors-3/+0
extend `simplify_type` might cause a slight perf inprovement and imo more accurately represents what types there are. considering that I was going to use this in #85048 it seems like we might need this in the future anyways :shrug:
2021-12-15update testslcnr-3/+0
2021-12-14Stabilize `destructuring_assignment`Jacob Pratt-110/+13
2021-12-14Rollup merge of #91798 - bugadani:issue-91783, r=michaelwoeristerMatthias Krüger-0/+44
Avoid suggest adding `self` in visibility spec Fixes #91783
2021-12-12Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnrbors-4/+4
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
2021-12-12Avoid suggesting self in visibility specDániel Buga-0/+44
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-12-11Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obkbors-1/+1
Tweak assoc type obligation spans * Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors r? `@oli-obk` This is a(n uncontroversial) subset of #85799.
2021-12-11Tweak assoc type obligation spansEsteban Kuber-1/+1
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-10bless testsEllen-4/+4
2021-12-10Tweak wordingEsteban Kuber-11/+11
2021-12-08Rollup merge of #91531 - notriddle:notriddle/issue-87647-expected-semicolon, ↵Matthias Krüger-0/+28
r=estebank Do not add `;` to expected tokens list when it's wrong There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff). Fixes #87647
2021-12-07Rollup merge of #87614 - notriddle:notriddle-count2len, r=Mark-SimulacrumMatthias Krüger-0/+44
Recommend fix `count()` -> `len()` on slices Fixes #87302
2021-12-06Recommend fix `count()` -> `len()` on slicesMichael Howell-0/+44
Fixes #87302
2021-12-06Expect extern fn with no body when parsingMichael Howell-0/+28
Also add a test case for inserting a semicolon on extern fns. Without this fix, we got an error like this: error: expected one of `->`, `where`, or `{`, found `}` --> chk.rs:3:1 | 2 | fn foo() | --- - expected one of `->`, `where`, or `{` | | | while parsing this `fn` 3 | } | ^ unexpected token Since this is inside an extern block, you're required to write function prototypes with no body. This fixes a regression, and adds a test case for it.
2021-12-04Bless tests.Camille GILLOT-2/+82