Commit Graph

24 Commits

Author SHA1 Message Date
dianne
d7d6238b23 use backticks instead of single quotes when reporting "use of unstable library feature"
This is consistent with all other diagnostics I could find containing
features and enables the use of `DiagSymbolList` for generalizing
diagnostics for unstable library features to multiple features.
2024-11-03 13:55:52 -08:00
Camille GILLOT
d9f15faf3a Bless ui tests. 2024-10-04 23:38:41 +00:00
León Orell Valerian Liehr
01a063f9df
Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
Wafarm
da7dd434c8
Fix wrong argument for get_fn_decl 2024-08-19 11:08:51 +08:00
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
Michael Goulet
b82f878f03 Gate AsyncFn* under async_closure feature 2024-07-23 19:56:06 -04:00
Michael Goulet
e8445818d4 Reorder modifiers and polarity to be *after* binder in trait bounds 2024-07-10 17:15:02 -04:00
Esteban Küber
e6bd6c2044 Use parenthetical notation for Fn traits
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`.

Fix #67100:

```
error[E0277]: expected a `Fn()` closure, found `F`
 --> file.rs:6:13
  |
6 |     call_fn(f)
  |     ------- ^ expected an `Fn()` closure, found `F`
  |     |
  |     required by a bound introduced by this call
  |
  = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `call_fn`
 --> file.rs:1:15
  |
1 | fn call_fn<F: Fn() -> ()>(f: &F) {
  |               ^^^^^^^^^^ required by this bound in `call_fn`
help: consider further restricting this bound
  |
5 | fn call_any<F: std::any::Any + Fn()>(f: &F) {
  |                              ++++++
```
2024-05-29 22:26:54 +00:00
Michael Goulet
05116c5c30 Only split by-ref/by-move futures for async closures 2024-03-19 16:59:23 -04:00
Michael Goulet
383051092f Ignore tests w/ current/next revisions from compare-mode=next-solver 2024-03-10 21:18:41 -04:00
Michael Goulet
c8e3f35eb6 Flesh out a few more tests 2024-02-27 17:39:20 +00:00
Michael Goulet
2252ff7302 Also support fnptr(): async Fn in codegen 2024-02-27 17:21:40 +00:00
León Orell Valerian Liehr
082b97ad05
Rollup merge of #121044 - compiler-errors:mbe-async-trait-bounds, r=fmease
Support async trait bounds in macros

r? fmease

This is similar to your work on const trait bounds. This theoretically regresses `impl async $ident:ident` in macros, but I doubt this is occurring in practice.
2024-02-21 16:32:56 +01:00
Michael Goulet
9c8b107955 Support async trait bounds in macros 2024-02-20 16:09:09 +00:00
Michael Goulet
762febdaf3 Fix stray trait mismatch in resolve_associated_item for AsyncFn 2024-02-20 15:45:05 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Michael Goulet
3bb384aad6 Prefer AsyncFn* over Fn* for coroutine-closures 2024-02-08 15:46:00 +00:00
Michael Goulet
08af64e96b Regular closures now built-in impls for AsyncFn* 2024-02-06 20:52:13 +00:00
Michael Goulet
3913c9a0ca Error on incorrect item kind in async bound 2024-01-31 16:59:19 +00:00
Michael Goulet
54db272cc9 Better error message in ed 2015 2024-01-31 16:59:19 +00:00
Michael Goulet
cd2fd34ca6 Add tests 2024-01-31 16:59:19 +00:00
Michael Goulet
0eb2adb7e8 Add async bound modifier to enable async Fn bounds 2024-01-31 16:59:19 +00:00
Michael Goulet
17b433351d select AsyncFn traits during overloaded call op 2023-12-25 20:31:28 +00:00
Michael Goulet
0e6f7c6c7c Add AsyncFn family of traits 2023-12-25 20:31:28 +00:00