about summary refs log tree commit diff
path: root/src/test/ui/suggestions
AgeCommit message (Collapse)AuthorLines
2022-07-21And for patterns tooMichael Goulet-1/+71
2022-07-21Do if-expression obligation stuff less eagerlyMichael Goulet-29/+28
2022-07-20Rollup merge of #98784 - compiler-errors:forgot-to-return-binding, r=estebankDylan DPC-0/+135
Suggest returning local on "expected `ty`, found `()`" due to expr-less block Putting this up for _initial_ review. Notably, this doesn't consider if the value has possibly been moved, or whether the type is `Copy`. It also provides a structured suggestion if there's one "preferred" binding that matches the type (i.e. one binding in the block or its parent), otherwise it just points them out if there's fewer than 4 of them. Fixes #98177 r? `@estebank`
2022-07-20Suggest returning binding from block or enclosing scope on ↵Michael Goulet-0/+135
coerce_forced_unit error
2022-07-19Mention first and last macro in backtraceMichael Goulet-10/+10
2022-07-17use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when ↵Michael Goulet-0/+34
rendering path
2022-07-16Be more precise when suggesting removal of parens on unit adt ctorMichael Goulet-0/+17
2022-07-15Fix suggestion regression with incorrect syntactic combination of trait boundsWill Crichton-3/+13
2022-07-15Propagate Expectation around binop typeck code to construct more precise ↵Will Crichton-2/+2
trait obligations for binops.
2022-07-15Rollup merge of #99119 - TaKO8Ki:remove-string-matching-about-methods, ↵Dylan DPC-31/+72
r=cjgillot Refactor: remove a string matching about methods This patch remove a string matching about methods and adds some rustfix tests.
2022-07-15Rollup merge of #98869 - compiler-errors:stop_guessing_head_span, r=cjgillotDylan DPC-3/+3
Remove some usages of `guess_head_span` No need to pass things through `guess_head_span` if they already point to the head span. Only major change is that we point to the head span of `enum`s on some errors now, which I prefer. r? `@cjgillot`
2022-07-15Remove some usages of guess_head_span from typeckMichael Goulet-3/+3
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-41/+41
r=cjgillot gather body owners Issue #96341
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-41/+41
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13Add feature gate.Camille GILLOT-2/+90
2022-07-13Always use CreateParameter mode for function definitions.Camille GILLOT-7/+14
2022-07-11Do not mention private Self types from other cratesMichael Goulet-0/+47
2022-07-11remove a string matching about methodsTakayuki Maeda-31/+72
2022-07-08distinguish the method and associated function diagnostic informationYiming Lei-5/+5
Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr
2022-07-08Auto merge of #98816 - estebank:implicit-sized, r=oli-obkbors-11/+11
Track implicit `Sized` obligations in type params When we evaluate `ty::GenericPredicates` we introduce the implicit `Sized` predicate of type params, but we do so with only the `Predicate` its `Span` as context, we don't have an `Obligation` or `ObligationCauseCode` we could influence. To try and carry this information through, we add a new field to `ty::GenericPredicates` that tracks both which predicates come from a type param and whether that param has any bounds already (to use in suggestions). We also suggest adding a `?Sized` bound if appropriate on E0599. Address part of #98539.
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-11/+11
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-07Shorten span for closures.Camille GILLOT-432/+284
2022-07-06use `named_span` in case of tuple variantTakayuki Maeda-1/+1
2022-07-06replace `guess_head_span` with `def_span`Takayuki Maeda-3/+36
2022-07-04Fix wrap parenthesis suggestion for async closureMichael Goulet-2/+22
2022-07-01Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomezbors-3/+3
Rollup of 5 pull requests Successful merges: - #97249 (`<details>`/`<summary>` UI fixes) - #98418 (Allow macOS to build LLVM as shared library) - #98460 (Use CSS variables to handle theming) - #98497 (Improve some inference diagnostics) - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests) Failed merges: - #98761 (more `need_type_info` improvements) r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Rollup merge of #98497 - compiler-errors:span-inference-note, r=lcnrGuillaume Gomez-3/+3
Improve some inference diagnostics - Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span. - Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference `&'a ()`" when the given type has no inference variables.
2022-07-01Auto merge of #93967 - cjgillot:short-struct-span, r=petrochenkovbors-20/+14
Shorten def_span for more items. The `def_span` query only returns the signature span for functions. Struct/enum/union definitions can also have a very long body. This PR shortens the associated span.
2022-07-01Show source of ambiguity in a few more placesMichael Goulet-3/+3
2022-07-01Shorten def_span for more items.Camille GILLOT-20/+14
2022-06-30ui: improve suggestion test by addig the help messageVincenzo Palazzo-15/+37
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-06-30ui test: add test of blanklet implementationVincenzo Palazzo-0/+143
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-06-29Rollup merge of #98607 - compiler-errors:tuple-wrap-suggestion, r=oli-obkDylan DPC-5/+5
Clean up arg mismatch diagnostic, generalize tuple wrap suggestion This is based on top of #97542, so just look at the last commit which contains the relevant changes. 1. Remove `final_arg_types` which was one of the last places we were using raw (`usize`) indices instead of typed indices in the arg mismatch suggestion code. 2. Improve the tuple wrap suggestion, now we suggest things like `call(a, b, c, d)` -> `call(a, (b, c), d)` :smiley_cat: 3. Folded in fix #98645
2022-06-29Rollup merge of #98603 - compiler-errors:minor-borrowck-diagnostic-fixes, ↵Dylan DPC-6/+20
r=davidtwco Some borrowck diagnostic fixes 1. Remove some redundant `.as_ref` suggestion logic from borrowck, this has the consequence of also not suggesting `.as_ref` after `Option` methods, but (correctly) before. 2. Fix a bug where we were replacing a binding's name with a type. Instead, make it a note. This is somewhat incomplete. See `src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs` for more improvements.
2022-06-29Rollup merge of #98277 - compiler-errors:issue-93596, r=estebankDylan DPC-4/+39
Fix trait object reborrow suggestion Fixes #93596 Slightly generalizes the logic we use to suggest fix first implemented in #95609, specifically when we have a `Sized` obligation that comes from a struct's unsized tail.
2022-06-29Rollup merge of #97542 - compiler-errors:arg-mismatch, r=jackh726Dylan DPC-2/+2
Use typed indices in argument mismatch algorithm I kinda went overboard with the renames, but in general, "arg" is renamed to "expected", and "input" is renamed to "provided", and we use new typed indices to make sure we're indexing into the right sized array. Other drive-by changes: 1. Factor this logic into a new function, so we don't need to `break 'label` to escape it. 1. Factored out dependence on `final_arg_types`, which is never populated for arguments greater than the number of expected args. Instead, we just grab the final coerced expression type from `in_progress_typeck_results`. 1. Adjust the criteria we use to print (provided) type names, before we didn't suggest anything that had infer vars, but now we suggest thing that have infer vars but aren't `_`. ~Also, sorry in advance, I kinda want to backport this but I know I have folded in a lot of unnecessary drive-by changes that might discourage that. I would be open to brainstorming how to get some of these changes on beta at least.~ edit: Minimized the ICE-fixing changes to #97557 cc `@jackh726` as author of #92364, and `@estebank` as reviewer of the PR. fixes #97484
2022-06-28Remove redundant logic to suggest `as_ref`Michael Goulet-6/+20
2022-06-28Note concrete type being coerced into objectMichael Goulet-5/+5
2022-06-28Fix trait object reborrow suggestionMichael Goulet-0/+35
2022-06-28Remove `final_arg_types`, improve tuple wrapping suggestionMichael Goulet-5/+5
2022-06-27Use typed indices in argument mismatch algorithmMichael Goulet-2/+2
2022-06-28Auto merge of #98222 - cjgillot:single-wf, r=michaelwoeristerbors-35/+35
Only keep a single query for well-formed checking There are currently 3 queries to perform wf checks on different item-likes. This complexity is not required. This PR replaces the query by: - one query per item; - one query to invoke it for a whole module. This allows to remove HIR `ParItemLikeVisitor`.
2022-06-27Rollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obkMatthias Krüger-3/+47
Fix span issues in object safety suggestions Fixes #98500
2022-06-25diagnostics: consider parameter count when suggesting smart pointersMichael Howell-0/+24
2022-06-25Fix span issues in object safety suggestionsMichael Goulet-3/+47
2022-06-25Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, ↵Matthias Krüger-11/+15
r=compiler-errors Point to type parameter definition when not finding variant, method and associated item fixes #77391
2022-06-22point to type param definition when not finding variant, method and assoc typeTakayuki Maeda-11/+15
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span` use `body_id.owner` directly add description to label
2022-06-21Improve suggestion for calling closure on type mismatchMichael Goulet-7/+7
2022-06-21Only keep a single well-formed query.Camille GILLOT-35/+35
2022-06-19Make missing argument placeholder more obvious that it's a placeholderMichael Goulet-6/+6