rust/src/test/incremental
Alex Crichton 4c21a3bc2a std: Depend directly on crates.io crates
Ever since we added a Cargo-based build system for the compiler the
standard library has always been a little special, it's never been able
to depend on crates.io crates for runtime dependencies. This has been a
result of various limitations, namely that Cargo doesn't understand that
crates from crates.io depend on libcore, so Cargo tries to build crates
before libcore is finished.

I had an idea this afternoon, however, which lifts the strategy
from #52919 to directly depend on crates.io crates from the standard
library. After all is said and done this removes a whopping three
submodules that we need to manage!

The basic idea here is that for any crate `std` depends on it adds an
*optional* dependency on an empty crate on crates.io, in this case named
`rustc-std-workspace-core`. This crate is overridden via `[patch]` in
this repository to point to a local crate we write, and *that* has a
`path` dependency on libcore.

Note that all `no_std` crates also depend on `compiler_builtins`, but if
we're not using submodules we can publish `compiler_builtins` to
crates.io and all crates can depend on it anyway! The basic strategy
then looks like:

* The standard library (or some transitive dep) decides to depend on a
  crate `foo`.
* The standard library adds

  ```toml
  [dependencies]
  foo = { version = "0.1", features = ['rustc-dep-of-std'] }
  ```
* The crate `foo` has an optional dependency on `rustc-std-workspace-core`
* The crate `foo` has an optional dependency on `compiler_builtins`
* The crate `foo` has a feature `rustc-dep-of-std` which activates these
  crates and any other necessary infrastructure in the crate.

A sample commit for `dlmalloc` [turns out to be quite simple][commit].
After that all `no_std` crates should largely build "as is" and still be
publishable on crates.io! Notably they should be able to continue to use
stable Rust if necessary, since the `rename-dependency` feature of Cargo
is soon stabilizing.

As a proof of concept, this commit removes the `dlmalloc`,
`libcompiler_builtins`, and `libc` submodules from this repository. Long
thorns in our side these are now gone for good and we can directly
depend on crates.io! It's hoped that in the long term we can bring in
other crates as necessary, but for now this is largely intended to
simply make it easier to manage these crates and remove submodules.

This should be a transparent non-breaking change for all users, but one
possible stickler is that this almost for sure breaks out-of-tree
`std`-building tools like `xargo` and `cargo-xbuild`. I think it should
be relatively easy to get them working, however, as all that's needed is
an entry in the `[patch]` section used to build the standard library.
Hopefully we can work with these tools to solve this problem!

[commit]: 28ee12db81
2018-12-11 21:08:22 -08:00
..
add_private_fn_at_krate_root_cc Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
auxiliary tests: use force-host and no-prefer-dynamic in all proc_macro tests. 2018-11-30 06:15:20 +02:00
callee_caller_cross_crate incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
change_add_field Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
change_crate_order rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
change_private_fn Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
change_private_fn_cc Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
change_private_impl_method Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
change_private_impl_method_cc Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
change_pub_inherent_method_body Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
change_pub_inherent_method_sig Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
extern_static Encode/decode extern statics in metadata and incremental cache 2018-03-20 10:36:45 +01:00
hashes Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
inlined_hir_34991 Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
issue-39828 Clean up CodegenUnit name generation. 2018-08-15 13:47:39 +02:00
issue-49595 Introduce Custom Test Frameworks 2018-09-04 22:33:00 -07:00
krate_reassign_34991 watch out for krate numbers being reassigned 2016-08-02 05:31:25 -04:00
remapped_paths_cc Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
remove-private-item-cross-crate incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. 2018-09-18 16:33:24 +02:00
remove_crate incr.comp.: Don't crash in DepGraph::try_mark_green() when encountering a removed input node. 2017-11-10 17:50:15 +01:00
remove_source_file mv FileMap SourceFile 2018-08-19 23:00:59 +02:00
rlib_cross_crate incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
span_hash_stable mv codemap source_map 2018-08-19 23:01:01 +02:00
static_cycle Don't recurse into allocations, use a global table instead 2018-04-14 12:21:46 +02:00
static_refering_to_other_static Cleanup metadata and incremental cache processing of constants 2018-03-16 17:22:37 +01:00
static_refering_to_other_static2 Introduce an edge from a const eval to the MIR of all statics it depends on 2018-03-30 12:31:48 +02:00
static_refering_to_other_static3 Added incremental test for interlinking static references. 2018-06-30 23:53:52 +01:00
static_stable_hash Fix stable hashing of AllocIds 2018-03-28 10:12:04 +02:00
struct_change_field_type_cross_crate incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
thinlto incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. 2018-09-18 16:33:24 +02:00
type_alias_cross_crate incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
cache_file_headers.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
change_crate_dep_kind.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
change_symbol_export_status.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
commandline-args.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
crate_hash_reorder.rs fix stray comment 2016-08-23 13:29:28 -04:00
dirty_clean.rs incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality instead of DepNode existence. 2017-09-23 19:47:46 +02:00
feature_gate.rs incr.comp.: Add regression test for detecting feature gate changes. 2018-03-05 11:05:01 +01:00
foreign.rs std: Depend directly on crates.io crates 2018-12-11 21:08:22 -08:00
hello_world.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
ich_method_call_trait_scope.rs incr.comp.: Hash spans unconditionally for full accuracy. 2017-12-08 10:02:26 +01:00
ich_nested_items.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
ich_resolve_results.rs incr.comp.: Hash spans unconditionally for full accuracy. 2017-12-08 10:02:26 +01:00
incremental_proc_macro.rs tests: move all proc_macro tests from -fulldeps. 2018-11-30 06:15:20 +02:00
issue-35593.rs incr.comp.: Use red/green tracking for CGU re-use. 2017-10-02 15:45:46 +02:00
issue-38222.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
issue-39569.rs fix case where some edges can't be recreated by expanding the graph 2017-02-06 10:20:23 -05:00
issue-42602.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-49043.rs extend stable hasher to support CanonicalTy 2018-03-16 12:49:37 -04:00
issue-49482.rs tests: move all proc_macro tests from -fulldeps. 2018-11-30 06:15:20 +02:00
issue-51409.rs stabalize infer outlives requirements (RFC 2093). 2018-09-11 11:40:04 -04:00
issue-54059.rs tests: move all proc_macro tests from -fulldeps. 2018-11-30 06:15:20 +02:00
krate-inherent.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
krate-inlined.rs Fix incremental tests after change to instantiation strategy. 2017-11-07 08:54:38 +01:00
macro_export.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
source_loc_macros.rs incr.comp.: Hash spans unconditionally for full accuracy. 2017-12-08 10:02:26 +01:00
spans_in_type_debuginfo.rs incr.comp.: Make DefSpan an input dep-node so it is not affected by the existing Span/HIR hashing hack. 2017-11-08 11:30:14 +01:00
spans_significant_w_debuginfo.rs Give function bodies their own dep graph node 2016-11-29 13:04:27 +01:00
spans_significant_w_panic.rs incr.comp.: Hash spans unconditionally for full accuracy. 2017-12-08 10:02:26 +01:00
spike-neg1.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
spike-neg2.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
spike.rs Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
string_constant.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
struct_add_field.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
struct_change_field_name.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
struct_change_field_type.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
struct_change_nothing.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
struct_remove_field.rs rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
unchecked_dirty_clean.rs Let the ICH testing framework check that all #[rustc_dirty] attrs have been actually checked. 2017-02-03 15:08:42 -05:00
warnings-reemitted.rs Make the const_err lint deny-by-default 2018-05-12 16:21:02 +02:00