What do you think about publishing `libstd` on crates.io?


#1

AFAIK the only way to grab sources of the standard library at the moment is by downloading the source code of the whole Rust distribution. This makes IDE and completion setup a little bit more complicated for the user.

What if the user could simply cargo install libstd or something like this? This even could be integrated with cargo metadata.

And, out of curiosity, why libstd can’t just be used as any other crate? Is it only because it uses nightly features?


How to provide standard library sources for tools?
#2

The standard library is getting closer to being “just another crate”, but it’s not quite there yet. @brson and I have been thinking about this in terms of custom-built standard libraries and how this would be a nice solution for that.

For now, though, the blockers I know of are:

  • A stable compiler cannot build the standard library
  • An optional dependency, libbacktrace, isn’t always easy to build and requires a C compiler
  • An optional dependency, jemalloc, isn’t always easy to build and requires a C compiler
  • A required dependency, compiler-rt, is incredibly hard to build

In terms of design, we’d want to think of how this all fits into Cargo as well. Some discussion has happened on RFC 1133 but it’s likely still somewhat far from a conclusion.


How to provide standard library sources for tools?
#3

Thanks! I see there is a long road to go before cargo can build libstd. I’m still curious about a possibility of “source only” usage of libstd for integrating with IDEs, but it sounds mostly like a hack :slight_smile:


#4

For IDEs you’d want RLS using the metadata inside the libstd rustc would use to compile that crate, otherwise it’s not same libstd.