-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 location of facade crates #27783
Comments
It has been noted that the separation between Basically I don't think these should be stabilized at all in anything approaching the short term pending the ultimate allocator designs. |
Found this through Is there any news about this issue? |
|
It would be nice if rust officially support some low-level mem layer (in rust way). |
@chao787 that's the |
I've found this issue through compiler error message:
I'm just trying to opt out of jemalloc and get Rust to compile my binary with system default malloc implementation. Is there a way to do it that would not involve unstable language features, like a compiler switch to get jemalloc out of my binaries and off my lawn? Rationale: jemalloc has abysmal fork performance (80x slowdown) on default kernel configuration of recent Ubuntu. See issue #36705 for more info. Opting out of jemalloc is also important for fuzzing, e.g. with afl-fuzz; even on jemalloc-friendly configurations using default malloc gets you 20% more fork performance which is significant for fuzzing workloads, and lets you substitute abusive memory allocators at runtime that catch more errors than default allocator or jemalloc but don't incur the performance penalty of DUMA or AddressSanitizer. See AFL's libdislocator as an example. |
@Shnatsel yeah I'd love to explore the possibilities of stabilizing the "please give me the system allocator" intent. Right now it's unfortunately not possible to do that in stable Rust. The tracking issue for global allocators in general is #27389, but it may be worth spawning off a separate thread of discussion for just declaring the intent to use the system allocator. |
FWIW I'm not in favor of merging the facade crates. Having std be decomposed into reusable components should be useful for those targeting more exotic systems, particularly if I complete my further ambitions to extract all system-specific components of std into their own crates. Ultimately people should be able to create custom stds for whatever weird systems they want be reusing our small self-contained building blocks. |
Decomposed stdlib would be really useful for asm.js target that I will need in the near future and really want to use Rust for. |
@brson As a person targeting a mildly exotic system, I agree. For example, I would expect that a significant proportion of bare-metal use cases (like mine) would want |
I surveyed what’s tracked by this issue when writing #39954. Unless I missed something:
Some environments might require My subjective opinions:
|
Looking at I think this leaves two items in need of attention:
I vaguely recall GC-related concerns about the former, but I think those would also apply to the |
This is #27700, not sure how I missed that. |
For unicode stuff, now that we can use crates.io crates in rustc build system, could the crates.io crates be used? |
The compiler depends on crates from crates.io. Does |
Question: is there a reason why |
@alexcrichton might want to remove |
@SimonSapin I think it would be a huge boost to the no-std ecosystem if std was allowed to depend on crates.io (at least official out-of-tree crates). |
How do I install libc, can't use the following extern crate libc;
use libc::{c_char, uint8_t}; |
@su8 |
@alexcrichton the OP should probably be updated |
Merge the std_unicode crate into the core crate [The standard library facade](#27783) has historically contained a number of crates with different roles, but that number has decreased over time. `rand` and `libc` have moved to crates.io, and [`collections` was merged into `alloc`](#42648). Today we have `core` that applies everywhere, `std` that expects a full operating system, and `alloc` in-between that only requires a memory allocator (which can be provided by users)… and `std_unicode`, which doesn’t really have a reason to be separate anymore. It contains functionality based on Unicode data tables that can be large, but as long as relevant functions are not called the tables should be removed from binaries by linkers. This deprecates the unstable `std_unicode` crate and moves all of its contents into `core`, replacing them with `pub use` reexports. The crate can be removed later. This also removes the `CharExt` trait (replaced with inherent methods in libcore) and `UnicodeStr` trait (merged into `StrExt`). There traits were both unstable and not intended to be used or named directly. A number of new items are newly-available in libcore and instantly stable there, but only if they were already stable in libstd. Fixes #49319.
Merge the std_unicode crate into the core crate [The standard library facade](#27783) has historically contained a number of crates with different roles, but that number has decreased over time. `rand` and `libc` have moved to crates.io, and [`collections` was merged into `alloc`](#42648). Today we have `core` that applies everywhere, `std` that expects a full operating system, and `alloc` in-between that only requires a memory allocator (which can be provided by users)… and `std_unicode`, which doesn’t really have a reason to be separate anymore. It contains functionality based on Unicode data tables that can be large, but as long as relevant functions are not called the tables should be removed from binaries by linkers. This deprecates the unstable `std_unicode` crate and moves all of its contents into `core`, replacing them with `pub use` reexports. The crate can be removed later. This also removes the `CharExt` trait (replaced with inherent methods in libcore) and `UnicodeStr` trait (merged into `StrExt`). There traits were both unstable and not intended to be used or named directly. A number of new items are newly-available in libcore and instantly stable there, but only if they were already stable in libstd. Fixes #49319.
OK now that #49698 is merged, I'd like to reiterate my concerns on this general direction of fewer creates behind the facade.
The second concern absolutely does apply to |
Also, on a process level, I'm concerned that rather than getting a simple "we disagree with your points" which would have been fine, I was getting told "your concerns don't apply to this PR", which just isn't true. This leaves me wondering who actually read the discussion before checking off the box, and whether the rules "final comment period" was followed. Admittedly, I did open with the unrelevant portability concerns, unfortunately sowing confusion I did not intend, but I thought that was cleared up in the end, at least between @SimonSapin and I. @SimonSapin indeed said in his last comment to me #49698 (comment) "I don’t care as much about how source code is organized internally" which at least felt like a "this PR isn't trying to disagree with you" leaving open other resolutions to the issue. But then @withoutboats rejoined with another "[your concern] seems off topic from this PR" #49698 (comment), and @alexcrichton, who had not participated in that discussion since a LGTM before I raised my points, did the Again, I'm not demanding that everyone agree to with me, but just to that explicit reject my points rather than leaving open that they were just missed. If there is no process violation going on, either FCP is different for PRs than RFCs in ways I wasn't aware of, or I misunderstand FCP overall. |
RFC 2480 proposes stabilizing the Related:
|
There is something questionable with using |
@glandium #36963 should make this disappear, and it only happens for executables. A But yeah it’s a good question whether we should change this in the meantime. Maybe it’s not much of a problem in practice? |
Make the public API of the alloc crate a subset of std This only affects **unstable** APIs. I plan to submit an RFC proposing to stabilize the crate. The reason it isn’t stable yet (#27783) is in case we end up merging the standard library crates into one. However the `core` crate is already stable, so if that happens we’ll need to keep it working somehow (likely by making replacing its contents by `pub use` items). We can do the same for `alloc`. This PR will hopefully make this easier, but even if that doesn’t happen consistency with `std` seems good.
How about adding |
This implements RFC 2480: * rust-lang/rfcs#2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes rust-lang#27783
…hton Stabilize the `alloc` crate. This implements RFC 2480: * rust-lang/rfcs#2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes rust-lang#27783
…hton Stabilize the `alloc` crate. This implements RFC 2480: * rust-lang/rfcs#2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes rust-lang#27783
…hton Stabilize the `alloc` crate. This implements RFC 2480: * rust-lang/rfcs#2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes rust-lang#27783
…hton Stabilize the `alloc` crate. This implements RFC 2480: * rust-lang/rfcs#2480 * https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md Closes rust-lang#27783
We probably don't want to indefinitely have a large number of facade crates which are all unstable, so we should eventually stabilize these crates, fold them back into the standard library, or find a good middle ground in which they can all reside.
The current set of crates considered under this issue are:
rustc_unicode
libc
collections
alloc
rand
Update 2018-04-05:
libc
andrand
have moved to crates.iocollections
was merged intoalloc
rustc_unicode
was renamed tostd_unicode
and later merged intocore
This leaves only the
alloc
crate still unstable, which with the stablecore
andstd
crates (plus arguablyproc_macro
) form the standard library.Update 2018-06-19:
RFC 2480 proposes stabilizing the
alloc
crate, which would close this issue.The text was updated successfully, but these errors were encountered: