rust/tests/ui/async-await/async-fn
Matthias Krüger cfc5f25b3d
Rollup merge of #127054 - compiler-errors:bound-ordering, r=fmease
Reorder trait bound modifiers *after* `for<...>` binder in trait bounds

This PR suggests changing the grammar of trait bounds from:

```
[CONSTNESS] [ASYNCNESS] [?] [BINDER] [TRAIT_PATH]

const async ? for<'a> Sized
```

to

```
([BINDER] [CONSTNESS] [ASYNCNESS] | [?]) [TRAIT_PATH]
```

i.e., either

```
? Sized
```

or

```
for<'a> const async Sized
```

(but not both)

### Why?

I think it's strange that the binder applies "more tightly" than the `?` trait polarity. This becomes even weirder when considering that we (or at least, I) want to have `async` trait bounds expressed like:

```
where T: for<'a> async Fn(&'a ()) -> i32,
```

and not:

```
where T: async for<'a> Fn(&'a ()) -> i32,
```

### Fallout

No crates on crater use this syntax, presumably because it's literally useless. This will require modifying the reference grammar, though.

### Alternatives

If this is not desirable, then we can alternatively keep parsing `for<'a>` after the `?` but deprecate it with either an FCW (or an immediate hard error), and begin parsing `for<'a>` *before* the `?`.
2024-07-25 04:43:18 +02:00
..
auxiliary Fix stray trait mismatch in resolve_associated_item for AsyncFn 2024-02-20 15:45:05 +00:00
dyn-pos.rs Only split by-ref/by-move futures for async closures 2024-03-19 16:59:23 -04:00
dyn-pos.stderr Only split by-ref/by-move futures for async closures 2024-03-19 16:59:23 -04:00
edition-2015-not-async-bound.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
edition-2015.rs Gate AsyncFn* under async_closure feature 2024-07-23 19:56:06 -04:00
edition-2015.stderr Gate AsyncFn* under async_closure feature 2024-07-23 19:56:06 -04:00
higher-ranked-async-fn.rs Reorder modifiers and polarity to be *after* binder in trait bounds 2024-07-10 17:15:02 -04:00
impl-header.rs Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
impl-header.stderr Use parenthetical notation for Fn traits 2024-05-29 22:26:54 +00:00
impl-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mbe-async-trait-bound-theoretical-regression.rs Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
mbe-async-trait-bound-theoretical-regression.stderr Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
method-call-pos.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
method-call-pos.stderr Add tests 2024-01-31 16:59:19 +00:00
not-a-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
not-a-trait.stderr Error on incorrect item kind in async bound 2024-01-31 16:59:19 +00:00
project.rs Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00
simple.rs Gate AsyncFn* under async_closure feature 2024-07-23 19:56:06 -04:00
sugar.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
trait-bounds-in-macro.rs Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
trait-bounds-in-macro.stderr Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
wrong-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
wrong-trait.stderr Error on incorrect item kind in async bound 2024-01-31 16:59:19 +00:00