Skip to content

#3123: a handle behind typedef void T is a resource by evidence - #3262

Merged
ehartford merged 1 commit into
mainfrom
opaque-void-typedef
Nov 11, 2026
Merged

ehartford merged 1 commit into
mainfrom
opaque-void-typedef

Conversation

@ehartford

@ehartford ehartford commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

A pointer the header spells through a typedef of void (CURL *) translates to *mut c_void; the drafter read its producer as 'a pointer to no record'. The proofs keep the typedef's name, so a name a producer returns and a destroyer frees is a resource, and an operation on it states of <Resource>. c_import is unchanged: a distinct type would also catch pure synonyms (GLvoid); the header cannot tell the two apart, so identity comes from evidence (law 4).

Test: test/internals/conan_facade_void_typedef_handle_test.w.

Battery: GREEN on the stack top 282e783 (seed-driven, with uat --strict).

… returns it and a destroyer frees it

A pointer the header spells through a typedef of void (`CURL *`) translates
to `*mut c_void`, and the drafter read its producer as 'returns *mut c_void,
a pointer to no record'. The proofs now keep the typedef's name in the
signature types they reason over (`*mut CURL`, from the type as written), so
the D121 evidence applies: a name a producer returns and a destroyer frees
is a resource. Every void typedef is one representation to the checker, so
an operation on such a handle states `of <Resource>`.

c_import is unchanged: the typedef stays an alias of c_void. Making it a
distinct type would also catch pure synonyms (`GLvoid`), where
`const GLvoid *` means any pointer; the header cannot tell the two apart,
so identity comes from evidence (law 4). A synonym gains no producer and
stays raw.

Test: test/internals/conan_facade_void_typedef_handle_test.w. Before, the
same package drafted 'h_new: raw: returns *mut c_void, a pointer to no
record' and an empty facade.
@ehartford
ehartford added this pull request to stack #3264 November 11, 2026 21:15
@ehartford ehartford changed the title opaque void typedef #3123: a handle behind typedef void T is a resource by evidence Nov 11, 2026
@ehartford
ehartford marked this pull request as ready for review November 11, 2026 21:15
@ehartford
ehartford merged commit d90cd6d into main Nov 11, 2026
@ehartford
ehartford deleted the opaque-void-typedef branch November 11, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant