about summary refs log tree commit diff
path: root/tests/ui/async-await
AgeCommit message (Collapse)AuthorLines
2023-12-19Add additional tests and update existing testsEric Holk-1/+109
2023-12-19Desugar for await loopsEric Holk-0/+24
2023-12-19Plumb awaitness of for loopsEric Holk-0/+25
2023-12-14Rollup merge of #118948 - compiler-errors:noop, r=eholkJubilee-44/+31
Use the `Waker::noop` API in tests Avoids the need to duplicate this code over and over again r? eholk
2023-12-14Use the Waker::noop API in testsMichael Goulet-44/+31
2023-12-14update use of feature flagslcnr-2/+2
2023-12-12Coroutine variant fields can be uninitializedTomasz Miąsko-3/+11
Wrap coroutine variant fields in MaybeUninit to indicate that they might be uninitialized. Otherwise an uninhabited field will make the entire variant uninhabited and introduce undefined behaviour. The analogous issue in the prefix of coroutine layout was addressed by 6fae7f807146e400fa2bbd1c44768d9bcaa57c4c.
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-2/+2
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2023-12-11Improve `print_tts` by changing `tokenstream::Spacing`.Nicholas Nethercote-2/+2
`tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-12-08Rollup merge of #118730 - jyn514:cmp_refs, r=estebank,compiler-errorsMatthias Krüger-2/+2
recurse into refs when comparing tys for diagnostics before: ![image](https://github.com/rust-lang/rust/assets/23638587/bf6abd62-c7f3-4c09-a47e-31b6e129de19) after: ![image](https://github.com/rust-lang/rust/assets/23638587/b704d728-ddba-4204-aebe-c07dcbbcb55c) this diff from the test suite is also quite nice imo: ```diff `@@` -4,8 +4,8 `@@` error[E0308]: mismatched types LL | debug_assert_eq!(iter.next(), Some(value)); | ^^^^^^^^^^^ expected `Option<<I as Iterator>::Item>`, found `Option<&<I as Iterator>::Item>` | - = note: expected enum `Option<<I as Iterator>::Item>` - found enum `Option<&<I as Iterator>::Item>` + = note: expected enum `Option<_>` + found enum `Option<&_>` ```
2023-12-07recurse into refs when comparing tys for diagnosticsjyn-2/+2
2023-12-07Resolve assoc item bindings by namespaceLeón Orell Valerian Liehr-5/+10
If a const is expected, resolve a const. If a type is expected, resolve a type. Don't try to resolve a type first falling back to consts.
2023-11-28Fix spans for bad await in inline constMichael Goulet-47/+8
2023-11-28Eagerly return ExprKind::Err on yield/await in wrong coroutine contextMichael Goulet-4/+0
2023-11-24Show number in error message even for one errorNilstrieb-90/+90
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-19Rollup merge of #117110 - estebank:deref-field-suggestion, r=b-naberTakayuki Maeda-8/+20
Suggest field typo through derefs Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-18tweak logic of "unknown field" labelEsteban Küber-13/+5
2023-11-17Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naberMatthias Krüger-1/+0
Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all.
2023-11-16address review commentEsteban Küber-5/+13
2023-11-16recover primary span labelEsteban Küber-14/+22
2023-11-16Suggest `unwrap()` on field not found for `Result`/`Option`Esteban Küber-2/+10
When encountering a `Result<T, _>` or `Option<T>` where `T` has a field that's being accessed, suggest calling `.unwrap()` to get to the field.
2023-11-16Suggest field typo through derefsEsteban Küber-14/+10
Take into account implicit dereferences when suggesting fields. ``` error[E0609]: no field `longname` on type `Arc<S>` --> $DIR/suggest-field-through-deref.rs:10:15 | LL | let _ = x.longname; | ^^^^^^^^ help: a field with a similar name exists: `long_name` ``` CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-10-28Remove asmjs from testsJubilee Young-1/+0
2023-10-27Recover from incorrectly ordered/duplicated function keywordsclubby789-6/+13
2023-10-25Rollup merge of #117175 - oli-obk:gen_fn_split, r=compiler-errorsMatthias Krüger-7/+7
Rename AsyncCoroutineKind to CoroutineSource pulled out of https://github.com/rust-lang/rust/pull/116447 Also refactors the printing infra of `CoroutineSource` to be ready for easily extending it with a `Gen` variant for `gen` blocks
2023-10-25Rename in preparation for moving the `async` printing out of `CoroutineSource`Oli Scherer-7/+7
2023-10-25Rollup merge of #117133 - compiler-errors:coherence-constrained, r=oli-obkMatthias Krüger-0/+51
Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking Problem here is that we call `collect_impl_trait_in_trait_types` when checking `check_mod_impl_wf` which is performed before coherence. Due to the `tcx.sess.track_errors`, since we end up reporting an error, we never actually proceed to coherence checking, where we would be emitting a more useful impl overlap error. This change means that we may report more errors in some cases, but can at least proceed far enough to leave a useful message for overlapping traits with RPITITs in them. Fixes #116982 r? types
2023-10-25Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naberbors-4/+24
Fix inline const pattern unsafety checking in THIR Fix THIR unsafety checking of inline constants. - Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering. - Represent inline constants in THIR patterns.
2023-10-24Merge impl_wf_inference into coherence checkingMichael Goulet-0/+51
2023-10-24Remove incomplete features from RPITIT/AFIT testsMichael Goulet-37/+10
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-3/+10
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-22Auto merge of #116256 - apekros:issue-114912, r=cjgillotbors-0/+33
Add test for rust-lang#114912 Closes #114912
2023-10-21fix spans for removing `.await` on `for` expressionsLukas Markeffsky-1/+19
2023-10-20Rename lots of files that had `generator` in their nameOli Scherer-26/+26
2023-10-20s/generator/coroutine/Oli Scherer-51/+51
2023-10-20s/Generator/Coroutine/Oli Scherer-17/+17
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-3/+10
2023-10-18Don't ICE when encountering unresolved regions in fully_resolveMichael Goulet-0/+28
2023-10-16Fix inline const pattern unsafety checking in THIRMatthew Jasper-4/+24
THIR unsafety checking was getting a cycle of function unsafety checking -> building THIR for the function -> evaluating pattern inline constants in the function -> building MIR for the inline constant -> checking unsafety of functions (so that THIR can be stolen) This is fixed by not stealing THIR when generating MIR but instead when unsafety checking. This leaves an issue with pattern inline constants not being unsafety checked because they are evaluated away when generating THIR. To fix that we now represent inline constants in THIR patterns and visit them in THIR unsafety checking.
2023-10-14Rollup merge of #116704 - compiler-errors:afit-lint-plus, r=tmandryMatthias Krüger-1/+1
Fix AFIT lint message to mention pitfall Addresses https://github.com/rust-lang/rust/pull/116184#issuecomment-1745194387 by adding a short note. Not sure exactly of the wording -- I don't think this should be a blocker for the stabilization PR since we can iterate on this lint's messaging in the next few weeks in the worst case. r? `@tmandry` cc `@traviscross` `@jonhoo`
2023-10-13Stabilize AFIT and RPITITMichael Goulet-584/+94
2023-10-13Fix AFIT lint message to mention pitfallMichael Goulet-1/+1
2023-10-08remove trailing dotsAli MJ Al-Nasrawy-4/+4
2023-10-08always show and explain sub regionAli MJ Al-Nasrawy-44/+16
2023-10-08improve the suggestion of generic_bound_failureAli MJ Al-Nasrawy-0/+16
2023-10-05Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, ↵Matthias Krüger-0/+2
r=compiler-errors,estebank Add a note to duplicate diagnostics Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05Rollup merge of #116431 - estebank:issue-80476, r=compiler-errorsJubilee-2/+2
Tweak wording of E0562 Fix #80476.
2023-10-05Auto merge of #116273 - compiler-errors:refine2, r=tmandrybors-6/+6
Only trigger `refining_impl_trait` lint on reachable traits Public but unreachable traits don't matter 😸 r? `@tmandry`
2023-10-05Auto merge of #116184 - compiler-errors:afit-lint, r=tmandrybors-0/+65
Add `async_fn_in_trait` lint cc https://github.com/rust-lang/rust/pull/115822#issuecomment-1731168465 Mostly unsure what the messaging should be. Feedback required. r? `@tmandry`
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+2