Auto merge of #73265 - mark-i-m:mv-std, r=Mark-Simulacrum,mark-i-m

mv std libs to library/

This is the first step in refactoring the directory layout of this repository, with further followup steps planned (but not done yet).

Background: currently, all crates are under src/, without nested src directories and with the unconventional `lib*` prefixes (e.g., `src/libcore/lib.rs`). This directory structures is not idiomatic and makes the `src/` directory rather overwhelming. To improve contributor experience and make things a bit more approachable, we are reorganizing the repo a bit.

In this PR, we move the standard libs (basically anything that is "runtime", as opposed to part of the compiler, build system, or one of the tools, etc). The new layout moves these libraries to a new `library/` directory in the root of the repo. Additionally, we remove the `lib*` prefixes and add nested `src/` directories.  The other crates/tools in this repo are not touched. So in summary:

```
library/<crate>/src/*.rs
src/<all the rest>     // unchanged
```

where `<crate>` is:
- core
- alloc
- std
- test
- proc_macro
- panic_abort
- panic_unwind
- profiler_builtins
- term
- unwind
- rtstartup
- backtrace
- rustc-std-workspace-*

There was a lot of discussion about this and a few rounds of compiler team approvals, FCPs, MCPs, and nominations. The original MCP is https://github.com/rust-lang/compiler-team/issues/298. The final approval of the compiler team was given here: https://github.com/rust-lang/rust/pull/73265#issuecomment-659498446.

The name `library` was chosen to complement a later move of the compiler crates to a `compiler/` directory. There was a lot of discussion around adding the nested `src/` directories. Note that this does increase the nesting depth (plausibly important for manual traversal of the tree, e.g., through GitHub's UI or `cd`), but this is deemed to be better as it fits the standard layout of Rust crates throughout most of the ecosystem, though there is some debate about how much this should apply to multi-crate projects. Overall, there seem to be more people in favor of nested `src/` than against.

After this PR, there are no dependencies out of the `library/` directory except on the `build_helper` (or crates.io crates).
This commit is contained in:
bors 2020-07-28 00:51:53 +00:00
commit ac48e62db8
875 changed files with 1255 additions and 1223 deletions

4
.gitmodules vendored
View File

@ -25,8 +25,8 @@
[submodule "src/doc/rust-by-example"]
path = src/doc/rust-by-example
url = https://github.com/rust-lang/rust-by-example.git
[submodule "src/stdarch"]
path = src/stdarch
[submodule "library/stdarch"]
path = library/stdarch
url = https://github.com/rust-lang/stdarch.git
[submodule "src/doc/rustc-dev-guide"]
path = src/doc/rustc-dev-guide

View File

@ -2,9 +2,9 @@
members = [
"src/bootstrap",
"src/rustc",
"src/libstd",
"src/libtest",
"src/librustc_codegen_llvm",
"library/std",
"library/test",
"src/tools/cargotest",
"src/tools/clippy",
"src/tools/compiletest",
@ -74,11 +74,11 @@ rustfmt-nightly = { path = "src/tools/rustfmt" }
# here
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
# See comments in `tools/rustc-std-workspace-core/README.md` for what's going on
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
# here
rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'src/tools/rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'src/tools/rustc-std-workspace-std' }
rustc-std-workspace-core = { path = 'library/rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
[patch."https://github.com/rust-lang/rust-clippy"]
clippy_lints = { path = "src/tools/clippy/clippy_lints" }

View File

@ -6,12 +6,8 @@ autotests = false
autobenches = false
edition = "2018"
[lib]
name = "alloc"
path = "lib.rs"
[dependencies]
core = { path = "../libcore" }
core = { path = "../core" }
compiler_builtins = { version = "0.1.10", features = ['rustc-dep-of-std'] }
[dev-dependencies]
@ -20,16 +16,16 @@ rand_xorshift = "0.2"
[[test]]
name = "collectionstests"
path = "../liballoc/tests/lib.rs"
path = "tests/lib.rs"
[[bench]]
name = "collectionsbenches"
path = "../liballoc/benches/lib.rs"
path = "benches/lib.rs"
test = true
[[bench]]
name = "vec_deque_append_bench"
path = "../liballoc/benches/vec_deque_append.rs"
path = "benches/vec_deque_append.rs"
harness = false
[features]

View File

@ -7,18 +7,16 @@ autobenches = false
edition = "2018"
[lib]
name = "core"
path = "lib.rs"
test = false
bench = false
[[test]]
name = "coretests"
path = "../libcore/tests/lib.rs"
path = "tests/lib.rs"
[[bench]]
name = "corebenches"
path = "../libcore/benches/lib.rs"
path = "benches/lib.rs"
test = true
[dev-dependencies]

Some files were not shown because too many files have changed in this diff Show More