Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for libcore + no_std stabilization #27701
Comments
alexcrichton
added
T-libs
B-unstable
labels
Aug 12, 2015
Ms2ger
referenced this issue
Aug 16, 2015
Open
Tracking: Unstable Rust feature gates used by Servo #5286
bors
added a commit
that referenced
this issue
Aug 22, 2015
This comment has been minimized.
This comment has been minimized.
|
I think that all the major issues here have been resolved, so I'm nominating this for stabilization in 1.5 |
alexcrichton
added
the
I-nominated
label
Sep 17, 2015
This comment has been minimized.
This comment has been minimized.
|
Is it possible to support multiple |
This comment has been minimized.
This comment has been minimized.
|
Not currently that I'm aware of at least, and that would definitely be part of the stabilization aspect of this issue. |
This comment has been minimized.
This comment has been minimized.
|
Idea: mark the methods on the extension traits as stable, but leave the traits themselves unstable. Works because they're in the prelude. (We did this for Not a great permanent story, but it's a place to start. |
This comment has been minimized.
This comment has been minimized.
|
I want to understand the story for undefined symbols before making this stable. There's a real possibility of people defining these themselves in ways that aren't forward compatible. |
This comment has been minimized.
This comment has been minimized.
|
This issue/feature is now entering its cycle-long FCP for stabilization in 1.5 @brson, we currently have very few undefined symbols actually:
Of these, Otherwise, the only symbols we rely on are Do you have further concerns in light of this information? |
alexcrichton
added
final-comment-period
I-nominated
T-lang
and removed
I-nominated
labels
Sep 24, 2015
This comment has been minimized.
This comment has been minimized.
|
Oh and as a further clarification that I forgot to point out, this would also involve stabilizing |
This comment has been minimized.
This comment has been minimized.
|
And to further refine my comment, I remember now that we have more undefined symbols on 32-bit because some 64-bit integer operations frequently require support from compiler-rt. Taking a look at the undefined symbols from
It's basically the same story here, though, nothing unexpected and I don't think we should worry about people relying on their own incorrect versions of compiler-rt intrinsics. |
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
|
Some things I noticed when I worked on adapting ring to work with I don't get why I have to use // Re-export `{mem, ptr}` from either `std` or `core` as appropriate. This
// keeps the conditional logic on one place.
#[cfg(feature = "lib_no_std")]
pub use core::{mem, ptr};
#[cfg(not(feature = "lib_no_std"))]
pub use std::{mem, ptr};Then I refer to, e.g. Also, it is confusing to me about whether Finally, the documentation should be clearer about how to write a library that automatically works in both |
This comment has been minimized.
This comment has been minimized.
|
@briansmith Why not only use |
This comment has been minimized.
This comment has been minimized.
|
@briansmith I totally agree that we can bolster our docs in this respect! As @SimonSapin mentioned, there's actually no need to have a "dual mode" where sometimes you use Part of the pain of using Additionally, Does that help explain things? I can try to bolster up our docs on this subject before we push this over the finish line! |
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
When I add this to my lib.rs: #![feature(no_std)]
#![no_std]I get:
What am I doing wrong? The repo is at https://github.com/briansmith/ring, branch "no_std". |
This comment has been minimized.
This comment has been minimized.
|
Wow we really do need some documentation on this badly... The detailed design of If you're core-compatible you can basically rewrite all imports to be from |
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
|
OK, if I use
Why is Also, all the documentation uses |
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
|
Also, let's say my module uses |
This comment has been minimized.
This comment has been minimized.
At 1.0 we didn't inject the
Not currently, the documentation for
I think this confusion primarily stems from a lack of documentation. I think it's crucial to maintain the distinction of whether code is in a "core only" or "std only" context. It's important to know what abilities you have access to (e.g. can you do I/O?). Beyond that the structures are exactly the same, so once this piece of information is known I don't think it'll be too confusing (but it definitely needs to be explained!)
That's actually the great part! Because the standard library simply reexports everything from core, a |
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
|
I am surprised that it is so difficult to convey how confusing this is.
IMO, it would make a lot more sense to NOT have |
alexcrichton
removed
the
I-nominated
label
Sep 25, 2015
This comment has been minimized.
This comment has been minimized.
briansmith
commented
Sep 25, 2015
|
Here is the development mode that I see for libcore compatible libraries on crates.io:
Step #2 will likely involve making some features of the third-party library conditional on whether Step #2 will also likely involve changing some |
This comment has been minimized.
This comment has been minimized.
|
So There is no such thing as a
|
This comment has been minimized.
This comment has been minimized.
|
To be clear, getting rid of I think 1 can be refined--it's less that the silent transition from freestanding-capable to not freestanding-capable is the goal, but rather that there be only one style (a "normal form") for writing code that in principle should work free-standing. Right now there is two, with Now the elastic/subset std also means there is two ways to write such code, but at least they are equivalent in terms of the burdens they place downstream. Right now that the @SimonSapin I'd hope we'd just be stabilizing the things in core that are already stable in std. |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@Ericson2314 @alexcrichton |
This comment has been minimized.
This comment has been minimized.
|
@dschatzberg are you on IRC by any chance? might take a few iterations for me to express that clearly :) |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin Sure no cold-turkey removal, but we can deprecate it, and since it is so easy to define as a facade, it's easy to keep around without removing. The downside is more appearing fickle making such a visible change after 1.0, but it's more eye-cactching than actually heavy-weight. |
This comment has been minimized.
This comment has been minimized.
|
@Ericson2314 yes - same user name |
This comment has been minimized.
This comment has been minimized.
|
Ok, edited #27701 (comment) to hopefully clear up any confusion. |
Ericson2314
referenced this issue
Dec 2, 2015
Closed
Make Cargo aware of standard library dependencies #1133
This comment has been minimized.
This comment has been minimized.
|
-1 on deprecating |
This comment has been minimized.
This comment has been minimized.
|
"Deprecating std" isn't sufficiently well-defined at the moment, we'd need to see an RFC for it before it could be discussed seriously. |
This comment has been minimized.
This comment has been minimized.
|
Regardless of whether or not this RFC is accepted, I'd like to propose that the actual stabilization PR be blocked on resolving #23355 , because otherwise we'll have the compiler guiding people into wholly silly situations. |
This comment has been minimized.
This comment has been minimized.
|
I really like the explicit |
This comment has been minimized.
This comment has been minimized.
|
Actually never mind about #23355 , I just determined that it's already possible to follow rustc's advice on the stable branch to produce the silly situations that I had in mind. |
This comment has been minimized.
This comment has been minimized.
|
@phil-opp |
This comment has been minimized.
This comment has been minimized.
|
Having |
This comment has been minimized.
This comment has been minimized.
|
@bluss I don't completely agree. I still think it's beneficial for freestanding users to use libraries for which their use case wasn't intended. While an explicit attribute is a relatively minor change, it's still a burden on the library developer to think to do it. |
This comment has been minimized.
This comment has been minimized.
|
@bstrie "deprecating std" in my mind would be encouraging imports from crates behind the facade rather than std were the former is stable. Once everything is available from a crate behind the facade, then std cannot be used at all without tripping a "try use core/alloc/instead for foobar" warning. I would write an RFC for that, but I rather iron out the kinks in using the crates behind the facade exclusively first, so it's clear what we would be migrating to in the deprecate std RFC. |
This comment has been minimized.
This comment has been minimized.
|
Just my opinion, but deprecating or linting std is a non-starter, no use in exploring that idea. |
This comment has been minimized.
This comment has been minimized.
|
AFAIK the std library is more than a facade. It implements everything operating specific (like threads, files, network, etc.). So to deprecate std, we would need to move those parts to a new crate. And then the "normal" user would have to think about implementation details. For example, Hashmap is only in std (because it uses a thread local random number generator) but BTreeMap is also in collections. |
This comment has been minimized.
This comment has been minimized.
|
@phil-opp I'd consider finishing making std a facade a good thing whether or not we keep std. For example, embedded Systems ("internet of things") may have networking but not filesystems. As for your example, only the default hasher param uses the OS like that. I think everybody rather put HashMap in collections, and just have a wrapper type alias that adds the default hasher param in std, but there was some language restriction that prevented that. |
This comment has been minimized.
This comment has been minimized.
|
There are too many details to the std-as-facade/deprecating-std to propose and discuss them here in this comment section. Again, I implore those interested to write up an RFC if you wish to pursue it. |
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this during triage yesterday, as well as the core team two days ago, as well as the lang team a few weeks ago, and the conclusion is to stabilize. The extension traits for primitive types in libcore will be left unstable for now with stable methods (e.g. the |
alexcrichton
referenced this issue
Dec 3, 2015
Merged
std: Stabilize APIs for the 1.6 release #30187
This comment has been minimized.
This comment has been minimized.
|
Closing as this was stabilized in #30187 |
alexcrichton commentedAug 12, 2015
This issue is intended to represent the outstanding issues for stabilizing libcore and allowing its usage on stable Rust. There are a number of features currently associated with libcore:
corecore_char_extcore_preludecore_slice_extcore_str_ext(note that
core_floatwill be handled in a separate issue)The design of libcore largely mirrors that of the standard library (good) but there are a few deviations:
core::atomicdiffers fromstd::sync::atomicnonzero,panicking, andarrayare publicOverall there are a number of tasks that probably need to be done before stabilizing these items:
coreneeds to be agreed upon as the stable name for the library