Skip to content

internal: use std as extern crate#6054

Merged
davidhewitt merged 1 commit into
PyO3:mainfrom
Person-93:extern_std
Jun 22, 2026
Merged

internal: use std as extern crate#6054
davidhewitt merged 1 commit into
PyO3:mainfrom
Person-93:extern_std

Conversation

@Person-93

@Person-93 Person-93 commented May 18, 2026

Copy link
Copy Markdown
Contributor

This PR is to prepare for no_std support.

  • I've made the main crate no_std and added extern crate std instead.
  • I've also added a new top-level mod platform to hold all the upcoming std replacements. As of now, it just has a prelude which contains
    • Things from the alloc crate people generate use from std's prelude
    • the eprintln macro (we will need to find a replacement for this)
  • I've added import crate::platform::prelude::* to every file that uses things from the standard prelude.
  • The test_utils file could not import the prelude so it had to import directly from the alloc crate.
  • in py_format macro: replace use of ToOwned with Clone

ETA: It looks like a large PR because of the number of files changed, but most of that is just importing the new prelude into the files that need it. There are only four files that have more changes than that.

@Person-93 Person-93 force-pushed the extern_std branch 2 times, most recently from c683aa6 to 43509a5 Compare May 18, 2026 07:30
@Person-93 Person-93 marked this pull request as draft May 18, 2026 07:38
@Person-93 Person-93 force-pushed the extern_std branch 11 times, most recently from ecec57a to 3461bb7 Compare May 18, 2026 09:17
@Person-93 Person-93 marked this pull request as ready for review May 18, 2026 09:42
@Person-93 Person-93 changed the title use std as extern crate internal: use std as extern crate May 24, 2026
@Person-93 Person-93 force-pushed the extern_std branch 2 times, most recently from 4dedc7a to 17559a0 Compare May 26, 2026 20:34
@Person-93 Person-93 force-pushed the extern_std branch 2 times, most recently from deb5f57 to 00a6a54 Compare June 4, 2026 16:22
Comment thread src/conversions/bytes.rs
Comment thread src/platform.rs
@davidhewitt

Copy link
Copy Markdown
Member

Let's merge this to unblock proceeding on this work.

@davidhewitt davidhewitt added this pull request to the merge queue Jun 9, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jun 9, 2026
@davidhewitt

Copy link
Copy Markdown
Member

I can fix the conflicts after #6056 merges.

@codspeed-hq

codspeed-hq Bot commented Jun 15, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 126 untouched benchmarks


Comparing Person-93:extern_std (1c47f3c) with main (1df2875)

Open in CodSpeed

@Person-93

Copy link
Copy Markdown
Contributor Author

@davidhewitt #6056 is not ready to be merged, can we proceed with this one?

@Person-93 Person-93 requested a review from davidhewitt June 18, 2026 17:25

@davidhewitt davidhewitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sure thing

@davidhewitt davidhewitt added this pull request to the merge queue Jun 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 21, 2026
@davidhewitt davidhewitt added this pull request to the merge queue Jun 21, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 21, 2026
@Person-93

Copy link
Copy Markdown
Contributor Author

The last failure was github's fault. https://github.com/PyO3/pyo3/actions/runs/27917137210/job/82604843356#step:8:36

@davidhewitt davidhewitt added this pull request to the merge queue Jun 22, 2026
Merged via the queue into PyO3:main with commit 7550783 Jun 22, 2026
49 checks passed
@Person-93 Person-93 deleted the extern_std branch June 22, 2026 13:13
@Person-93

Copy link
Copy Markdown
Contributor Author

Yay!!!

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.

2 participants