Skip to content

core: Add core::ffi::c_intptr_t and core::ffi::c_uintptr_t#156626

Open
lygstate wants to merge 1 commit into
rust-lang:mainfrom
lygstate:c_ffi_new_type
Open

core: Add core::ffi::c_intptr_t and core::ffi::c_uintptr_t#156626
lygstate wants to merge 1 commit into
rust-lang:mainfrom
lygstate:c_ffi_new_type

Conversation

@lygstate
Copy link
Copy Markdown
Contributor

This is a complement to c_ptrdiff_t

Tracking issue: #88345

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 15, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 15, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @scottmcm, libs
  • @scottmcm, libs expanded to 8 candidates

@rust-log-analyzer

This comment has been minimized.

This is a complement to c_ptrdiff_t

Tracking issue: rust-lang#88345

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
@tgross35
Copy link
Copy Markdown
Contributor

There are some unresolved questions there that unfortunately haven't made much progress. I'm not sure it's worth adding more types without having a better story there.

@lygstate
Copy link
Copy Markdown
Contributor Author

There are some unresolved questions there that unfortunately haven't made much progress. I'm not sure it's worth adding more types without having a better story there.

libc is looking for release 1.0 I think it's time to resolve those questions. What's the questions comes from, can you give me the link.

@tgross35
Copy link
Copy Markdown
Contributor

libc is looking for release 1.0 I think it's time to resolve those questions. What's the questions comes from, can you give me the link.

As far as libc 1.0 is concerned, the only thing I'd like is for the lang team to say that size_t is always usize, if that's something we can rely on, because then we can delete the size_t alias. Anything else is not blocking, we can update aliases if/when things stabilize.

Info is scattered, see discussion around #88345 (comment) https://internals.rust-lang.org/t/pre-rfc-usize-semantics/19444/22, https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Compat.20with.20size_t.2C.20ptrdiff_t.2C.20intptr_t.2C.20fnptr-sized.20int/with/547982505, and a few other places on Zulip.

/// requires that this type be a signed integer type just capable of holding a
/// pointer.
#[unstable(feature = "c_size_t", issue = "88345")]
pub type c_intptr_t = isize;
Copy link
Copy Markdown
Contributor

@arichardson arichardson May 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this type it is IMO essential. On platforms such as CHERI for RISCV (RVY), we can change this typedef to be apointer type instead.

View changes since the review

@arichardson
Copy link
Copy Markdown
Contributor

CC: @xdoardo

@tgross35
Copy link
Copy Markdown
Contributor

For anybody who has opinions here about CHERI or otherwise, it would be good to hop in to the ongoing discussion at #t-lang > Compat with size_t, ptrdiff_t, intptr_t, fnptr-sized int.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants