Skip to content

Commit bc5c441

Browse files
alexcrichtonehuss
authored andcommitted
Change how standard_lib tests work
* Minimize the sysroot crates in play * Don't use build scripts to inject args * Use `RUSTC_WRAPPER` to dynamically switch `--sysroot` depending on whether we're building sysroot crates or not. * Minimize dependency graph in sysroot, only have each crate depend on a dummy crates.io crate for testing and otherwise don't depend on anything to load the desired sysroot crate directly.
1 parent e9dd306 commit bc5c441

File tree

17 files changed

+199
-127
lines changed

17 files changed

+199
-127
lines changed

tests/testsuite/mock-std/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[workspace]
22
members = [
3+
"src/liballoc",
4+
"src/libcore",
5+
"src/libproc_macro",
6+
"src/libstd",
37
"src/libtest",
48
]
5-
6-
[patch.crates-io]
7-
rustc-std-workspace-std = { path = 'src/tools/rustc-std-workspace-std' }
8-
rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' }
9-
rustc-std-workspace-alloc = { path = 'src/tools/rustc-std-workspace-alloc' }

tests/testsuite/mock-std/src/liballoc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ edition = "2018"
88
path = "lib.rs"
99

1010
[dependencies]
11-
core = { path = "../libcore" }
11+
registry-dep-using-core = { version = "*", features = ['mockbuild'] }
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
pub fn custom_api() {}
1+
#![feature(staged_api)]
2+
#![stable(since = "1.0.0", feature = "dummy")]
3+
4+
extern crate alloc;
5+
6+
#[stable(since = "1.0.0", feature = "dummy")]
7+
pub use alloc::*;
8+
9+
#[stable(since = "1.0.0", feature = "dummy")]
10+
pub fn custom_api() {
11+
}

tests/testsuite/mock-std/src/libcompiler_builtins/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ edition = "2018"
66

77
[lib]
88
path = "lib.rs"
9-
10-
[dependencies]
11-
core = { path = "../libcore" }

tests/testsuite/mock-std/src/libcore/build.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
#![no_std]
1+
#![feature(staged_api)]
2+
#![stable(since = "1.0.0", feature = "dummy")]
3+
4+
#[stable(since = "1.0.0", feature = "dummy")]
25
pub use core::*;
36

4-
pub fn custom_api() {}
7+
#[stable(since = "1.0.0", feature = "dummy")]
8+
pub fn custom_api() {
9+
}

tests/testsuite/mock-std/src/libpanic_unwind/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ edition = "2018"
66

77
[lib]
88
path = "lib.rs"
9-
10-
[dependencies]
11-
core = { path = "../libcore" }

tests/testsuite/mock-std/src/libproc_macro/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ edition = "2018"
66

77
[lib]
88
path = "lib.rs"
9-
10-
[dependencies]
11-
std = { path = "../libstd" }
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#![feature(staged_api)]
2+
#![stable(since = "1.0.0", feature = "dummy")]
3+
14
extern crate proc_macro;
5+
6+
#[stable(since = "1.0.0", feature = "dummy")]
27
pub use proc_macro::*;
3-
pub fn custom_api() {}
8+
9+
#[stable(since = "1.0.0", feature = "dummy")]
10+
pub fn custom_api() {
11+
}

tests/testsuite/mock-std/src/libstd/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,4 @@ edition = "2018"
88
path = "lib.rs"
99

1010
[dependencies]
11-
core = { path = "../libcore" }
12-
compiler_builtins = { path = "../libcompiler_builtins" }
13-
panic_unwind = { path = "../libpanic_unwind" }
14-
registry-dep-using-core = { version = "1.0", features = ['mockbuild'] }
15-
registry-dep-using-alloc = { version = "1.0", features = ['mockbuild'] }
11+
registry-dep-using-alloc = { version = "*", features = ['mockbuild'] }

0 commit comments

Comments
 (0)