about summary refs log tree commit diff
path: root/src/test/ui/async-await
AgeCommit message (Collapse)AuthorLines
2020-01-08review commentsEsteban Küber-3/+6
2020-01-08Point at opaque and closure type definitions in type errorsEsteban Küber-0/+9
2020-01-05Add backticks to various diagnosticsvarkor-2/+2
2020-01-03Auto merge of #67828 - JohnTitor:rollup-qmswkkl, r=JohnTitorbors-1/+1
Rollup of 10 pull requests Successful merges: - #67450 (Allow for setting a ThinLTO import limit during bootstrap) - #67595 (Suggest adding a lifetime constraint for opaque type) - #67636 (allow rustfmt key in [build] section) - #67736 (Less-than is asymmetric, not antisymmetric) - #67762 (Add missing links for insecure_time) - #67783 (Warn for bindings named same as variants when matching against a borrow) - #67796 (Ensure that we process projections during MIR inlining) - #67807 (Use drop instead of the toilet closure `|_| ()`) - #67816 (Clean up err codes) - #67825 (Minor: change take() docs grammar to match other docs) Failed merges: r? @ghost
2020-01-02Use drop instead of the toilet closure `|_| ()`Lzu Tao-1/+1
2019-12-31Revert "core: add IntoFuture trait and support for await"Wesley Wiser-32/+7
This reverts commit f35517ee861dc012ccc26083dd4520045e2c4f6f.
2019-12-28Ignore i586-unknown-linux-gnu and i586-unknown-musl in testsEsteban Küber-7/+10
2019-12-27core: add IntoFuture trait and support for awaitSean McArthur-7/+32
2019-12-22test falloutMark Rousskov-1/+1
2019-12-20Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, ↵Mazdak Farrokhzad-1/+1
r=estebank Indicate origin of where type parameter for uninferred types Based on #65951 (which is not merge yet), fixes #67277. This PR improves a little the diagnostic for code like: ``` async fn foo() { bar().await; } async fn bar<T>() -> () {} ``` by showing: ``` error[E0698]: type inside `async fn` body must be known in this context --> unresolved_type_param.rs:9:5 | 9 | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ... ``` (The ``` declared on the function `bar` ``` part is new) A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`. r? @estebank
2019-12-15Rollup merge of #67289 - estebank:unnamed-closure, r=CentrilMazdak Farrokhzad-0/+46
Do not ICE on unnamed future Fix #67252.
2019-12-14Do not ICE on unnamed futureEsteban Küber-0/+46
2019-12-14Indicate origin of where type parameter for uninferred typesOhad Ravid-1/+1
2019-12-13Auto merge of #65951 - estebank:type-inference-error, r=nikomatsakisbors-2/+2
Point at method call when type annotations are needed - Point at method call instead of whole expression when type annotations are needed. - Suggest use of turbofish on function and methods. Fix #49391, fix #46333, fix #48089. CC #58517, #63502, #63082. Fixes https://github.com/rust-lang/rust/issues/40015 r? @nikomatsakis
2019-12-11Add more context for type parametersEsteban Küber-2/+2
2019-12-11Auto merge of #65345 - ↵bors-58/+253
davidtwco:issue-64130-async-send-sync-error-improvements, r=nikomatsakis async/await: improve not-send errors, part 2 Part of #64130. Fixes #65667. This PR improves the errors introduced in #64895 so that they have specialized messages for `Send` and `Sync`. r? @nikomatsakis
2019-12-09Auto merge of #67004 - estebank:issue-66958, r=eddybbors-0/+28
Do not ICE on async fn with non-Copy infered type arg Fix #66958.
2019-12-08async/await: correct diag note for `async move`David Wood-2/+2
This commit corrects the diagnostic note for `async move {}` so that `await` is mentioned, rather than `yield`. Signed-off-by: David Wood <david@davidtw.co>
2019-12-08async/await: more improvements to non-send errorsDavid Wood-58/+253
Signed-off-by: David Wood <david@davidtw.co>
2019-12-06review commentsEsteban Küber-0/+28
2019-12-03Emit coercion suggestions in more placesAaron Hill-1/+40
Fixes #66910 We have several different kinds of suggestions we can try to make when type coercion fails. However, we were previously only emitting these suggestions from `demand_coerce_diag`. This resulted in the compiler failing to emit applicable suggestions in several different cases, such as when the implicit return value of a function had the wrong type. This commit adds a new `emit_coerce_suggestions` method, which tries to emit a number of related suggestions. This method is called from both `demand_coerce_diag` and `CoerceMany::coerce_inner`, which covers a much wider range of cases than before. We now suggest using `.await` in more cases where it is applicable, among other improvements.
2019-12-03Rollup merge of #66651 - Areredify:on-unimplemented-scope, r=davidtwcoMazdak Farrokhzad-6/+24
Add `enclosing scope` parameter to `rustc_on_unimplemented` Adds a new parameter to `#[rustc_on_unimplemented]`, `enclosing scope`, which highlights the function or closure scope with a message. The wip part refers to adding this annotation to `Try` trait to improve ergonomics (which I don't know how to do since I change both std and librustc) Closes #61709.
2019-12-01Rollup merge of #66679 - mark-i-m:fix-anon-lifetime-errors, r=matthewjasperMazdak Farrokhzad-2/+2
Improve lifetime errors with implicit trait object lifetimes r? @matthewjasper cc @estebank I still think the ideal solution would be to construct a `BrAnon`, but that seems like a more invasive change, and can be done later. This at least gets rid of the hack in `OutliveSuggestion` and is slightly more principled.
2019-11-29Rollup merge of #66793 - matthewjasper:record-static-refs, r=cramertjRalf Jung-0/+24
Record temporary static references in generator witnesses Closes #66695 * Record the pointer to static's type in MIR. * Normalize the static's type (so that constants can be compared correctly).
2019-11-29improve lifetime errors with implicit trait object lifetimesMark Mansi-2/+2
2019-11-29Ignore wasm for panic testsDavid Haig-0/+6
2019-11-28Moved tests and fixed merge conflictDavid Haig-0/+117
2019-11-27Add async fn test for #66695Matthew Jasper-0/+24
2019-11-25added enclosing_scope attr to Try trait and fixed ui tests accordinglyMikhail Babenko-6/+24
2019-11-24Auto merge of #66592 - estebank:raw-raw-ah-ah-ah, r=cramertjbors-5/+0
Rework raw ident suggestions Use heuristics to determine whethersuggesting raw identifiers is appropriate. Account for raw identifiers when printing a path in a `use` suggestion. Fix #66126.
2019-11-24Rollup merge of #64856 - jonhoo:format-temporaries, r=sfacklerMazdak Farrokhzad-0/+22
Scope format! temporaries This places the temporaries that `format!` generates to refer to its arguments (through `&dyn Trait`) in a short-lived scope surrounding just the invocation of `format!`. This enables `format!` to be used in generators without the temporaries preventing the generator from being `Send` (due to `dyn Trait` not being `Sync`). See rust-lang/rust#64477 for details.
2019-11-23Rework raw ident suggestionsEsteban Küber-5/+0
Use heuristics to determine whethersuggesting raw identifiers is appropriate. Account for raw identifiers when printing a path in a `use` suggestion.
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-32/+20
Specific labels when referring to "expected" and "found" types
2019-11-21Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakisMazdak Farrokhzad-4/+64
Suggest to add lifetime constraint at explicit ouput of functions Closes #62097
2019-11-20Rollup merge of #66526 - estebank:async-fn-trait-information, r=CentrilMazdak Farrokhzad-1/+33
Add more context to `async fn` trait error Follow up to #65937. Fix #65899.
2019-11-18fix rebaseEsteban Küber-3/+1
2019-11-18Add error code documentationEsteban Küber-1/+3
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+2
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-18Reword help and add testEsteban Küber-0/+30
2019-11-18Surround types with backticks in type errorsEsteban Küber-9/+9
2019-11-18Remove E0308 note when primary label has all infoEsteban Küber-10/+0
2019-11-18review comments: tweak prefix stringsEsteban Küber-12/+12
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-8/+8
2019-11-14review commentsEsteban Küber-0/+2
2019-11-13Do not ICE in `if` without `else` in `async fn`Esteban Küber-0/+24
2019-11-13Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPCYuki Okushi-0/+2
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
2019-11-13update suggestion ui testcsmoe-4/+45
2019-11-11add ui test for issue-62097csmoe-0/+19
2019-11-10Make error and warning annotations mandatory in UI testsTomasz Miąsko-0/+1
This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations.
2019-11-08Rollup merge of #66007 - estebank:remove-here, r=CentrilMazdak Farrokhzad-4/+4
Remove "here" from "expected one of X here"