Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for io::const_error! #133448

Open
1 of 4 tasks
joboet opened this issue Nov 25, 2024 · 3 comments
Open
1 of 4 tasks

Tracking Issue for io::const_error! #133448

joboet opened this issue Nov 25, 2024 · 3 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@joboet
Copy link
Member

joboet commented Nov 25, 2024

Feature gate: #![feature(io_const_error)]

This is a tracking issue for const_error!, a macro to create io::Errors from a string literal without allocating.

Public API

// std::io

macro const_error($kind:expr, $message:expr $(,)?) { ... }

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@joboet joboet added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Nov 25, 2024
joboet added a commit to joboet/rust that referenced this issue Nov 25, 2024
joboet added a commit to joboet/rust that referenced this issue Nov 25, 2024
jhpratt added a commit to jhpratt/rust that referenced this issue Nov 26, 2024
std: expose `const_io_error!` as `const_error!`

ACP: rust-lang/libs-team#205
Tracking issue: rust-lang#133448

Probably best reviewed commit-by-commit, the first one does the API change, the second does the mass-rename.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 27, 2024
std: expose `const_io_error!` as `const_error!`

ACP: rust-lang/libs-team#205
Tracking issue: rust-lang#133448

Probably best reviewed commit-by-commit, the first one does the API change, the second does the mass-rename.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Nov 27, 2024
Rollup merge of rust-lang#133449 - joboet:io_const_error, r=tgross35

std: expose `const_io_error!` as `const_error!`

ACP: rust-lang/libs-team#205
Tracking issue: rust-lang#133448

Probably best reviewed commit-by-commit, the first one does the API change, the second does the mass-rename.
@clarfonthey
Copy link
Contributor

Is there any particular reason why this is a macro instead of a const fn?

@joboet
Copy link
Member Author

joboet commented Dec 6, 2024

io::Error is pointer sized on 64-bit platforms, which is not enough to store a &'static str, let alone an additional ErrorKind. Making this a macro is the only way1 of achieving the no-allocation guarantee while keeping the size small (which is probably very important for performance).

Footnotes

  1. At least without const_allocate, but that would only work if users explicitly requested a const call.

@clarfonthey
Copy link
Contributor

I see, the main issue is that you can't guarantee that your const structure is static without it. Fair enough!

github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Feb 20, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Feb 20, 2025
github-actions bot pushed a commit to carolynzech/rust that referenced this issue Feb 20, 2025
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Feb 20, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Feb 21, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Feb 21, 2025
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this issue Feb 22, 2025
github-actions bot pushed a commit to carolynzech/rust that referenced this issue Feb 22, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Feb 22, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Feb 22, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Mar 3, 2025
github-actions bot pushed a commit to carolynzech/rust that referenced this issue Mar 4, 2025
github-actions bot pushed a commit to carolynzech/rust that referenced this issue Mar 4, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Mar 4, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 6, 2025
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this issue Mar 6, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 11, 2025
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this issue Mar 11, 2025
std: expose `const_io_error!` as `const_error!`

ACP: rust-lang/libs-team#205
Tracking issue: rust-lang#133448

Probably best reviewed commit-by-commit, the first one does the API change, the second does the mass-rename.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants