[BUG] API reference duplicates fn in qualified function pointers #21

Closed
opened 2026-10-15 17:16:38 +02:00 by erikinkinen · 1 comment
Owner

Summary

The API renderer prints qualified function pointers with an extra fn, producing invalid Rust syntax such as unsafe extern "C" fn fn(...).

Reproduction

At Docs b7d0a5bbe5f65ddfa47b106fb36ec4b65029a38d, pass an unnamed, unsafe C function pointer to scripts/api_reference_model.py through type_text. The shared formatter receives the literal name fn; stripping only a leading fn fails when qualifiers precede it.

Expected and actual behavior

Expected: unsafe extern "C" fn(...). Actual: unsafe extern "C" fn fn(...). Named function declarations must keep their names, and unnamed arguments must not acquire a stray colon.

Environment and identity

Host-side Rustdoc-to-TeX renderer at the revision above. An inert model input reproduces the defect without compiling code or starting a guest. The first affected revision is unknown.

Evidence and prior checks

The minimal model input reproduces the doubled token. This was found while adding the C runtime comparator reference; generation from that component's new signed revision is still pending.

Tracking

  • Render unnamed function pointers through the shared signature formatter.
  • Cover qualifiers, ABI, unnamed arguments and ordinary named declarations.
  • Regenerate the affected reference from genuine Rustdoc output and check the manual.
## Summary The API renderer prints qualified function pointers with an extra `fn`, producing invalid Rust syntax such as `unsafe extern "C" fn fn(...)`. ## Reproduction At Docs `b7d0a5bbe5f65ddfa47b106fb36ec4b65029a38d`, pass an unnamed, unsafe C function pointer to `scripts/api_reference_model.py` through `type_text`. The shared formatter receives the literal name `fn`; stripping only a leading `fn ` fails when qualifiers precede it. ## Expected and actual behavior Expected: `unsafe extern "C" fn(...)`. Actual: `unsafe extern "C" fn fn(...)`. Named function declarations must keep their names, and unnamed arguments must not acquire a stray colon. ## Environment and identity Host-side Rustdoc-to-TeX renderer at the revision above. An inert model input reproduces the defect without compiling code or starting a guest. The first affected revision is unknown. ## Evidence and prior checks The minimal model input reproduces the doubled token. This was found while adding the C runtime comparator reference; generation from that component's new signed revision is still pending. ## Tracking - [x] Render unnamed function pointers through the shared signature formatter. - [x] Cover qualifiers, ABI, unnamed arguments and ordinary named declarations. - [x] Regenerate the affected reference from genuine Rustdoc output and check the manual.
Author
Owner

Fixed in 5ab270b6. The genuine comparator reference now contains one unnamed unsafe extern "C" fn declarator, and ordinary named functions retain their names. All three acceptance criteria are complete.

Fixed in [5ab270b6](https://git.erikinkinen.fi/erix/docs/commit/5ab270b6489d0f8f0f8a177c32ed9b35c742f8e9). The genuine comparator reference now contains one unnamed `unsafe extern "C" fn` declarator, and ordinary named functions retain their names. All three acceptance criteria are complete.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:33:40 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/docs#21
No description provided.