rust/src/test/ui/async-await
bors 4aa7879b55 Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank
Use larger span for adjustment THIR expressions

Currently, we use a relatively 'small' span for THIR
expressions generated by an 'adjustment' (e.g. an autoderef,
autoborrow, unsizing). As a result, if a borrow generated
by an adustment ends up causing a borrowcheck error, for example:

```rust
let mut my_var = String::new();
let my_ref = &my_var
my_var.push('a');
my_ref;
```

then the span for the mutable borrow may end up referring
to only the base expression (e.g. `my_var`), rather than
the method call which triggered the mutable borrow
(e.g. `my_var.push('a')`)

Due to a quirk of the MIR borrowck implementation,
this doesn't always get exposed in migration mode,
but it does in many cases.

This commit makes THIR building consistently use 'larger'
spans for adjustment expressions. These spans are recoded
when we first create the adjustment during typecheck. For
example, an autoref adjustment triggered by a method call
will record the span of the entire method call.

The intent of this change it make it clearer to users
when it's the specific way in which a variable is
used (for example, in a method call) that produdes
a borrowcheck error. For example, an error message
claiming that a 'mutable borrow occurs here' might
be confusing if it just points at a usage of a variable
(e.g. `my_var`), when no `&mut` is in sight. Pointing
at the entire expression should help to emphasize
that the method call itself is responsible for
the mutable borrow.

In several cases, this makes the `#![feature(nll)]` diagnostic
output match up exactly with the default (migration mode) output.
As a result, several `.nll.stderr` files end up getting removed
entirely.
2021-09-30 01:40:30 +00:00
..
auxiliary Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
await-keyword Modify structured suggestion output 2021-08-11 09:46:24 +00:00
drop-order Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00
issues Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank 2021-09-30 01:40:30 +00:00
multiple-lifetimes bless nll tests 2021-07-22 11:26:42 +00:00
argument-patterns.rs Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
async-assoc-fn-anon-lifetimes.rs Ensure that associated async fns have unique fresh param names 2019-10-05 22:24:55 +01:00
async-await.rs Test THIR unsafeck for unsafe ops in closures 2021-05-27 21:04:44 +02:00
async-block-control-flow-static-semantics.rs pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
async-block-control-flow-static-semantics.stderr path trimming: ignore type aliases 2021-02-06 12:03:48 +02:00
async-borrowck-escaping-block-error.fixed Suggest move for closures and async blocks in more cases. 2020-04-08 13:01:53 +02:00
async-borrowck-escaping-block-error.rs Suggest move for closures and async blocks in more cases. 2020-04-08 13:01:53 +02:00
async-borrowck-escaping-block-error.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
async-borrowck-escaping-closure-error.rs Suggest move for closures and async blocks in more cases. 2020-04-08 13:01:53 +02:00
async-borrowck-escaping-closure-error.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
async-closure-matches-expr.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
async-closure.rs smoke-test for async fn with mir-opt-level=0 2020-04-22 23:34:13 +02:00
async-error-span.rs Adds a clearer message for when the async keyword is missing from a function 2020-06-25 16:01:45 -07:00
async-error-span.stderr Fix tests from rebase 2020-10-06 11:19:33 +01:00
async-fn-elided-impl-lifetime-parameter.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
async-fn-nonsend.rs compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
async-fn-nonsend.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
async-fn-path-elision.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
async-fn-path-elision.stderr Better errors when we don't have implicit statics in trait objects 2021-07-19 23:46:11 -04:00
async-fn-send-uses-nonsend.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
async-fn-size-moved-locals.rs Revert #71956 2020-06-08 14:58:37 -07:00
async-fn-size-uninit-locals.rs Use smaller discriminants for generators 2020-03-14 14:09:48 +01:00
async-fn-size.rs Use smaller discriminants for generators 2020-03-14 14:09:48 +01:00
async-matches-expr.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
async-trait-fn.rs Add test. 2021-04-15 21:41:45 +02:00
async-trait-fn.stderr Add test. 2021-04-15 21:41:45 +02:00
async-unsafe-fn-call-in-safe.mir.stderr Test -Zthir-unsafeck for unsafe function calls 2021-05-11 20:35:38 +02:00
async-unsafe-fn-call-in-safe.rs Remove some errors in UI tests 2021-05-22 16:21:36 +02:00
async-unsafe-fn-call-in-safe.thir.stderr Remove some errors in UI tests 2021-05-22 16:21:36 +02:00
async-with-closure.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
await-unsize.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
bound-normalization.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
conditional-and-guaranteed-initialization.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
dont-print-desugared-async.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
dont-print-desugared-async.stderr Don't give invalid suggestion on desugared span. 2020-02-12 18:32:27 -07:00
dont-suggest-missing-await.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
dont-suggest-missing-await.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
edition-deny-async-fns-2015.rs Consistently call editions "Rust 20xx" in messages. 2020-12-31 19:06:09 +01:00
edition-deny-async-fns-2015.stderr Update test output for stable Rust 2021. 2021-08-30 20:41:01 +02:00
expansion-in-attrs.rs def_collector: Fully visit async functions 2020-03-15 03:15:47 +03:00
feature-async-closure.rs Adjust tests wrt. 'async_closure' feature gate. 2019-07-03 23:59:36 +02:00
feature-async-closure.stderr Suggest async {} for async || {} 2020-09-22 13:22:10 -07:00
futures-api.rs Remove duplicated arc_wake.rs 2019-07-06 14:09:41 +08:00
generator-desc.rs name async generators something more human friendly in type error diagnostics 2021-02-15 08:51:08 -08:00
generator-desc.stderr Remove trailing whitespace from error messages 2021-08-04 10:48:30 +02:00
generics-and-bounds.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
issue-54239-private-type-triggers-lint.rs Add test for issue-54239 2020-03-09 09:11:40 +09:00
issue-60709.rs Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
issue-61076.rs Tweak opaque type mismatch error 2021-07-31 12:20:00 -07:00
issue-61076.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue-61452.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
issue-61452.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
issue-61793.rs Use build-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
issue-61949-self-return-type.rs Remove redundant ignore-tidy-linelength annotations 2021-04-03 22:30:20 +02:00
issue-61949-self-return-type.stderr Remove redundant ignore-tidy-linelength annotations 2021-04-03 22:30:20 +02:00
issue-62658.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
issue-63832-await-short-temporary-lifetime-1.rs lowering: extend temporary lifetimes around await 2019-09-10 11:27:57 +01:00
issue-63832-await-short-temporary-lifetime.rs lowering: extend temporary lifetimes around await 2019-09-10 11:27:57 +01:00
issue-64130-1-sync.rs introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
issue-64130-1-sync.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-64130-2-send.rs introduce negative_impls feature gate and document 2020-03-26 06:52:55 -04:00
issue-64130-2-send.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-64130-3-other.rs Rename optin_builtin_traits to auto_traits 2020-11-23 14:14:06 -08:00
issue-64130-3-other.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-64130-4-async-move.rs async/await: more improvements to non-send errors 2019-12-08 16:29:08 +00:00
issue-64130-4-async-move.stderr Fix tests from rebase 2020-10-06 11:19:33 +01:00
issue-64130-non-send-future-diags.rs async/await: more improvements to non-send errors 2019-12-08 16:29:08 +00:00
issue-64130-non-send-future-diags.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-64391.rs add regression test for issue-64391 2019-09-16 16:44:18 -04:00
issue-66312.rs Add test for #66312 2020-03-24 16:44:45 -07:00
issue-66312.stderr Add test for #66312 2020-03-24 16:44:45 -07:00
issue-66387-if-without-else.rs Add backticks to various diagnostics 2020-01-05 00:17:46 +00:00
issue-66387-if-without-else.stderr Add backticks to various diagnostics 2020-01-05 00:17:46 +00:00
issue-67252-unnamed-future.rs Do not ICE on unnamed future 2019-12-14 14:50:32 -08:00
issue-67252-unnamed-future.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-67651.rs Update tests 2020-03-23 19:31:41 +01:00
issue-67651.stderr Remove trailing : from E0119 message 2021-04-06 18:16:11 -07:00
issue-67765-async-diagnostic.rs Use an 'approximate' universal upper bound when reporting region errors 2020-06-27 14:01:59 -04:00
issue-67765-async-diagnostic.stderr Remove predicates on associated types from traits 2020-10-06 11:19:31 +01:00
issue-68112.rs pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
issue-68112.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-68523-start.rs tweak error message 2020-08-04 21:36:21 +02:00
issue-68523-start.stderr tweak error message 2020-08-04 21:36:21 +02:00
issue-68523.rs Implement RFC 1260 with feature_name imported_main. 2021-04-29 08:35:08 +08:00
issue-68523.stderr Implement RFC 1260 with feature_name imported_main. 2021-04-29 08:35:08 +08:00
issue-69446-fnmut-capture.rs Display information about captured variable in FnMut error 2020-05-25 23:18:00 -04:00
issue-69446-fnmut-capture.stderr Display information about captured variable in FnMut error 2020-05-25 23:18:00 -04:00
issue-70594.rs Update tests 2020-06-28 10:08:12 -07:00
issue-70594.stderr Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
issue-70818.rs bless issue-70818 test case 2020-05-06 17:03:15 +08:00
issue-70818.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue-70935-complex-spans.rs Avoid complex diagnostics in snippets which contain newlines 2020-11-02 15:53:58 +09:00
issue-70935-complex-spans.stderr Add "this has type {} which {}" note 2020-11-02 15:53:59 +09:00
issue-71137.rs add test for correct await span 2020-04-22 09:51:56 +08:00
issue-71137.stderr Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
issue-72442.rs Support incremental in compiletest for non-incremental modes. 2021-09-23 12:16:51 -07:00
issue-72442.stderr Point at call span that introduced obligation for the arg 2021-09-16 12:12:27 +00:00
issue-72470-llvm-dominate.rs Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-72590-type-error-sized.rs Don't bail out of trait selection when predicate references an error 2020-05-26 14:26:40 -04:00
issue-72590-type-error-sized.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue-73050.rs Allow inference regions when relating consts 2020-06-10 18:09:34 -07:00
issue-73137.rs Stabilize the Wake trait 2021-02-03 16:54:29 +01:00
issue-73541-2.rs Move some tests to more reasonable directories 2021-01-31 19:46:46 -03:00
issue-73541-2.stderr Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
issue-73741-type-err.rs Suppress spurious errors inside async fn 2021-05-16 22:26:57 -04:00
issue-73741-type-err.stderr Suppress spurious errors inside async fn 2021-05-16 22:26:57 -04:00
issue-74047.rs Move some tests to more suitable subdirs 2021-03-06 18:24:53 +09:00
issue-74047.stderr Move some tests to more suitable subdirs 2021-03-06 18:24:53 +09:00
issue-74072-lifetime-name-annotations.rs use RegionNameHighlight for async fn and closure returns 2020-11-09 16:14:40 +00:00
issue-74072-lifetime-name-annotations.stderr Prefer regions with an external_name in approx_universal_upper_bound 2020-12-17 13:24:40 -05:00
issue-74497-lifetime-in-opaque.rs use RegionNameHighlight for async fn and closure returns 2020-11-09 16:14:40 +00:00
issue-74497-lifetime-in-opaque.stderr use RegionNameHighlight for async fn and closure returns 2020-11-09 16:14:40 +00:00
issue-75785-confusing-named-region.rs Prefer regions with an external_name in approx_universal_upper_bound 2020-12-17 13:24:40 -05:00
issue-75785-confusing-named-region.stderr Prefer regions with an external_name in approx_universal_upper_bound 2020-12-17 13:24:40 -05:00
issue-76547.nll.stderr Add ConstraintCategory::Usage for handling aggregate construction 2021-09-16 12:36:19 -05:00
issue-76547.rs Move some tests to more reasonable directories - 2 2021-01-16 19:46:54 -03:00
issue-76547.stderr Move some tests to more reasonable directories - 2 2021-01-16 19:46:54 -03:00
issue-77993-2.rs Move some tests to more reasonable directories 2021-02-16 21:22:21 -03:00
issue-77993-2.stderr Move some tests to more reasonable directories 2021-02-16 21:22:21 -03:00
issue-84841.rs allow inference vars in type_implements_trait 2021-07-04 11:28:20 -04:00
issue-84841.stderr Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
issue-86507.rs Squash all commits. 2021-07-22 15:42:42 -05:00
issue-86507.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
large_moves.attribute.stderr Add flag to configure large_assignments lint 2021-07-06 17:47:15 +02:00
large_moves.option.stderr Add flag to configure large_assignments lint 2021-07-06 17:47:15 +02:00
large_moves.rs Add flag to configure large_assignments lint 2021-07-06 17:47:15 +02:00
move-part-await-return-rest-struct.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
move-part-await-return-rest-tuple.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
mutually-recursive-async-impl-trait-type.rs Check impl trait substs when checking for recursive types 2019-08-31 15:44:09 +01:00
mutually-recursive-async-impl-trait-type.stderr add suggestion to use the async_recursion crate 2021-02-09 18:43:39 +05:30
nested-in-impl.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
no-async-const.rs parser: fuse free fn parsing together. 2020-02-13 10:39:24 +01:00
no-async-const.stderr Better message for invalid keyword placement in fn 2021-08-02 11:10:19 +02:00
no-const-async.rs delay_span_bug if const-checking an async function 2020-09-29 19:20:33 -07:00
no-const-async.stderr delay_span_bug if const-checking an async function 2020-09-29 19:20:33 -07:00
no-move-across-await-struct.rs compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
no-move-across-await-struct.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
no-move-across-await-tuple.rs compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
no-move-across-await-tuple.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
no-non-guaranteed-initialization.rs compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
no-non-guaranteed-initialization.stderr compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
no-params-non-move-async-closure.rs Changing error messages and renaming tests #63127 2019-08-27 17:31:57 +02:00
no-params-non-move-async-closure.stderr Add long error explanation for E0708 #61137 2020-04-12 17:22:59 +05:30
no-std.rs Test that async/await compiles with #![no_std] 2020-03-17 22:17:31 +01:00
no-unsafe-async.rs parser: fuse free fn parsing together. 2020-02-13 10:39:24 +01:00
no-unsafe-async.stderr Better message for invalid keyword placement in fn 2021-08-02 11:10:19 +02:00
partial-initialization-across-await.rs Fixed grammar/style in error messages and reblessed tests. 2019-09-06 03:46:08 +01:00
partial-initialization-across-await.stderr Fixed grammar/style in error messages and reblessed tests. 2019-09-06 03:46:08 +01:00
pin-needed-to-poll-2.rs Point at impl and type defs introducing requirements on E0277 2021-04-06 19:55:44 -07:00
pin-needed-to-poll-2.stderr Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
pin-needed-to-poll.rs Suggest box/pin/arc ing receiver on method calls 2021-03-29 18:14:44 -07:00
pin-needed-to-poll.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
recursive-async-impl-trait-type.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
recursive-async-impl-trait-type.stderr add suggestion to use the async_recursion crate 2021-02-09 18:43:39 +05:30
repeat_count_const_in_async_fn.rs Move some tests to more reasonable directories 2021-02-16 21:22:21 -03:00
return-ty-raw-ptr-coercion.rs correct coercion comments 2019-10-02 14:23:36 -04:00
return-ty-unsize-coercion.rs fix example (le sigh) 2019-10-02 18:45:44 -04:00
suggest-missing-await-closure.fixed Tweak "use .await" suggestion 2020-10-23 08:02:57 -07:00
suggest-missing-await-closure.rs Tweak "use .await" suggestion 2020-10-23 08:02:57 -07:00
suggest-missing-await-closure.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
suggest-missing-await.rs reword ; suggestions to have consistent wording 2021-02-21 16:27:29 -08:00
suggest-missing-await.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
suggest-switching-edition-on-await.rs Update test output for stable Rust 2021. 2021-08-30 20:41:01 +02:00
suggest-switching-edition-on-await.stderr Update test output for stable Rust 2021. 2021-08-30 20:41:01 +02:00
try-on-option-in-async.rs implement type_implments_trait query 2020-05-15 15:37:11 +08:00
try-on-option-in-async.stderr Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
unreachable-lint-1.rs typeck: silence unreachable code from await 2019-09-30 21:27:18 +01:00
unreachable-lint-1.stderr Normalise notes with the/is 2020-01-24 16:24:50 +00:00
unreachable-lint.rs typeck: silence unreachable code from await 2019-09-30 21:27:18 +01:00
unresolved_type_param.rs Update tests 2020-01-09 21:23:12 +03:00
unresolved_type_param.stderr Update tests 2020-01-09 21:23:12 +03:00
unused-lifetime.rs Update tests of "unused_lifetimes" lint for async functions and corresponding source code 2020-12-04 08:25:59 +03:00
unused-lifetime.stderr Update tests of "unused_lifetimes" lint for async functions and corresponding source code 2020-12-04 08:25:59 +03:00