internal: use std as extern crate#6054
Conversation
c683aa6 to
43509a5
Compare
ecec57a to
3461bb7
Compare
4dedc7a to
17559a0
Compare
| #[allow(unused_imports, reason = "used to build docs")] | ||
| use crate::platform::prelude::*; |
There was a problem hiding this comment.
Would it be hard to apply the correct cfg() clauses on these? That way we can clean up if the imports ever become unused rather than this line just floating around indefinitely.
There was a problem hiding this comment.
It wouldn't be hard to apply, but it'd cause more churn as files get updated and start/stop using things from the prelude.
There was a problem hiding this comment.
Understood, will leave as is for now, I might seek to tighten this later.
| // TODO find a `no_std` replacement for eprintln | ||
| pub use std::eprintln; |
There was a problem hiding this comment.
It looks like the two uses are in print_panic_and_unwind and PyUntypedBuffer::drop.
I think we can probably eliminate the PyUntypedBuffer::drop case eventually, I think implementing GC traversal might want to be unsafe with the user responsible for no side effects.
print_panic_and_unwind - I suspect that the behavior is unhelpful anyway, if there's a lot of rust and python frames interleaved I think this'll amplify the traceback a lot. Perhaps we can explore both the rust-embeds-python and python-embeds-rust cases to check what the best experience would be in each case.
There was a problem hiding this comment.
Can that be a separate PR?
I'd like to keep this one as small as possible so it can be merged sooner. This PR is very likely to fail in the merge queue any time any other PR gets merged.
There was a problem hiding this comment.
Yes, absolutely, I was primarily suggesting we might be able to avoid the need to find a replacement.
|
Let's merge this to unblock proceeding on this work. |
|
I can fix the conflicts after #6056 merges. |
This PR is to prepare for
no_stdsupport.no_stdand addedextern crate stdinstead.platformto hold all the upcoming std replacements. As of now, it just has a prelude which containsalloccrate people generate use fromstd's preludeeprintlnmacro (we will need to find a replacement for this)import crate::platform::prelude::*to every file that uses things from the standard prelude.test_utilsfile could not import the prelude so it had to import directly from thealloccrate.py_formatmacro: replace use ofToOwnedwithCloneETA: 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.