about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-26 07:50:16 +0200
committerGitHub <noreply@github.com>2024-06-26 07:50:16 +0200
commitdd6b04663ebdce2ad1bc6cc3a0d1197a6935d3d5 (patch)
treef425581717e0cad427e9312f963cf5d1dfd96396 /compiler/rustc_ast
parenta299aa5df79dd8e5a1405b97ddd7b367b61eecc6 (diff)
parentcf0251d92ced77d926a2292df96cb9ad3ce14f97 (diff)
downloadrust-dd6b04663ebdce2ad1bc6cc3a0d1197a6935d3d5.tar.gz
rust-dd6b04663ebdce2ad1bc6cc3a0d1197a6935d3d5.zip
Rollup merge of #126724 - nnethercote:fix-parse_ty_bare_fn-span, r=compiler-errors
Fix a span in `parse_ty_bare_fn`.

It currently goes one token too far.

Example: line 259 of `tests/ui/abi/compatibility.rs`:
```
test_abi_compatible!(fn_fn, fn(), fn(i32) -> i32);
```
This commit changes the span for the second element from `fn(),` to `fn()`, i.e. removes the extraneous comma.

This doesn't affect any tests. I found it while debugging some other code. Not a big deal but an easy fix so I figure it worth doing.

r? ``@spastorino``
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/ast.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 30c54ef2d3c..4a3ce0e0c30 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -2126,7 +2126,8 @@ pub struct BareFnTy {
     pub ext: Extern,
     pub generic_params: ThinVec<GenericParam>,
     pub decl: P<FnDecl>,
-    /// Span of the `fn(...) -> ...` part.
+    /// Span of the `[unsafe] [extern] fn(...) -> ...` part, i.e. everything
+    /// after the generic params (if there are any, e.g. `for<'a>`).
     pub decl_span: Span,
 }