rust/compiler/rustc_parse/src/parser
Matthias Krüger a500a43367
Rollup merge of #137824 - estebank:rtn-sugg, r=compiler-errors
Tweak invalid RTN errors

Make suggestions verbose.

When encountering `method(type)` bound, suggest `method(..)` instead of `method()`.

```
error: argument types not allowed with return type notation
  --> $DIR/bad-inputs-and-output.rs:9:23
   |
LL | fn foo<T: Trait<method(i32): Send>>() {}
   |                       ^^^^^
   |
help: remove the input types
   |
LL - fn foo<T: Trait<method(i32): Send>>() {}
LL + fn foo<T: Trait<method(..): Send>>() {}
   |
```

When encountering both return type and arg list that isn't `..`, suggest replacing both.

```
error: return type not allowed with return type notation
  --> $DIR/bad-inputs-and-output.rs:12:25
   |
LL | fn bar<T: Trait<method() -> (): Send>>() {}
   |                         ^^^^^^
   |
help: use the right argument notation and remove the return type
   |
LL - fn bar<T: Trait<method() -> (): Send>>() {}
LL + fn bar<T: Trait<method(..): Send>>() {}
   |
```

When encountering a return type, suggest removing it including the leading whitespace.

```
error: return type not allowed with return type notation
  --> $DIR/bad-inputs-and-output.rs:24:45
   |
LL | fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
   |                                             ^^^^^
   |
help: remove the return type
   |
LL - fn bay_path<T: Trait>() where T::method(..) -> (): Send {}
LL + fn bay_path<T: Trait>() where T::method(..): Send {}
   |
```

r? ``@compiler-errors``
2025-03-01 16:03:18 +01:00
..
mut_visit Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tokenstream update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
attr.rs Remove NtMeta. 2025-02-28 08:42:06 +11:00
attr_wrapper.rs Rustfmt 2025-02-08 22:12:13 +00:00
diagnostics.rs Auto merge of #137517 - nnethercote:rm-NtPat-NtItem-NtStmt, r=petrochenkov 2025-02-28 21:32:39 +00:00
expr.rs Auto merge of #137517 - nnethercote:rm-NtPat-NtItem-NtStmt, r=petrochenkov 2025-02-28 21:32:39 +00:00
generics.rs Stop using span hack for contracts feature gating 2025-02-10 19:51:26 +00:00
item.rs Remove NtPat. 2025-02-28 08:36:12 +11:00
mod.rs Remove NtPath. 2025-02-28 08:42:14 +11:00
nonterminal.rs Remove NtPath. 2025-02-28 08:42:14 +11:00
pat.rs Remove NtPat. 2025-02-28 08:36:12 +11:00
path.rs Rollup merge of #137824 - estebank:rtn-sugg, r=compiler-errors 2025-03-01 16:03:18 +01:00
stmt.rs Rustfmt 2025-02-08 22:12:13 +00:00
tests.rs Stop passing the same resource multiple times when building ParseSess 2025-02-06 17:30:10 +00:00
token_type.rs Rename rustc_contract to contract 2025-02-03 13:55:15 -08:00
ty.rs Avoid snapshotting the parser in parse_path_inner. 2025-02-21 16:48:01 +11:00