@@ -27,71 +27,18 @@ fn setup() -> Option<Setup> {
27
27
return None ;
28
28
}
29
29
30
- // Our mock sysroot requires a few packages from crates.io, so make sure
31
- // they're "published" to crates.io. Also edit their code a bit to make sure
32
- // that they have access to our custom crates with custom apis.
30
+ // Register a version of one of the std dependencies that doesn't compile.
31
+ // This ensures that the mock-std's vendor is actually being used.
33
32
Package :: new ( "registry-dep-using-core" , "1.0.0" )
34
33
. file (
35
34
"src/lib.rs" ,
36
35
"
37
- #![no_std]
38
-
39
- #[cfg(feature = \" mockbuild\" )]
40
- pub fn custom_api() {
41
- }
42
-
43
- #[cfg(not(feature = \" mockbuild\" ))]
44
- pub fn non_sysroot_api() {
45
- core::custom_api();
46
- }
36
+ don't compile me bro!!
47
37
" ,
48
38
)
49
39
. add_dep ( Dependency :: new ( "rustc-std-workspace-core" , "*" ) . optional ( true ) )
50
40
. feature ( "mockbuild" , & [ "rustc-std-workspace-core" ] )
51
41
. publish ( ) ;
52
- Package :: new ( "registry-dep-using-alloc" , "1.0.0" )
53
- . file (
54
- "src/lib.rs" ,
55
- "
56
- #![no_std]
57
-
58
- extern crate alloc;
59
-
60
- #[cfg(feature = \" mockbuild\" )]
61
- pub fn custom_api() {
62
- }
63
-
64
- #[cfg(not(feature = \" mockbuild\" ))]
65
- pub fn non_sysroot_api() {
66
- core::custom_api();
67
- alloc::custom_api();
68
- }
69
- " ,
70
- )
71
- . add_dep ( Dependency :: new ( "rustc-std-workspace-core" , "*" ) . optional ( true ) )
72
- . add_dep ( Dependency :: new ( "rustc-std-workspace-alloc" , "*" ) . optional ( true ) )
73
- . feature (
74
- "mockbuild" ,
75
- & [ "rustc-std-workspace-core" , "rustc-std-workspace-alloc" ] ,
76
- )
77
- . publish ( ) ;
78
- Package :: new ( "registry-dep-using-std" , "1.0.0" )
79
- . file (
80
- "src/lib.rs" ,
81
- "
82
- #[cfg(feature = \" mockbuild\" )]
83
- pub fn custom_api() {
84
- }
85
-
86
- #[cfg(not(feature = \" mockbuild\" ))]
87
- pub fn non_sysroot_api() {
88
- std::custom_api();
89
- }
90
- " ,
91
- )
92
- . add_dep ( Dependency :: new ( "rustc-std-workspace-std" , "*" ) . optional ( true ) )
93
- . feature ( "mockbuild" , & [ "rustc-std-workspace-std" ] )
94
- . publish ( ) ;
95
42
96
43
let p = ProjectBuilder :: new ( paths:: root ( ) . join ( "rustc-wrapper" ) )
97
44
. file (
@@ -335,6 +282,81 @@ fn depend_same_as_std() {
335
282
None => return ,
336
283
} ;
337
284
285
+ // Our mock sysroot requires a few packages from crates.io, so make sure
286
+ // they're "published" to crates.io. Also edit their code a bit to make sure
287
+ // that they have access to our custom crates with custom apis.
288
+ Package :: new ( "registry-dep-using-core" , "1.0.0" )
289
+ . file (
290
+ "src/lib.rs" ,
291
+ "
292
+ #![no_std]
293
+
294
+ #[cfg(feature = \" mockbuild\" )]
295
+ pub fn custom_api() {
296
+ }
297
+
298
+ #[cfg(not(feature = \" mockbuild\" ))]
299
+ pub fn non_sysroot_api() {
300
+ core::custom_api();
301
+ }
302
+ " ,
303
+ )
304
+ . add_dep ( Dependency :: new ( "rustc-std-workspace-core" , "*" ) . optional ( true ) )
305
+ . feature ( "mockbuild" , & [ "rustc-std-workspace-core" ] )
306
+ . publish ( ) ;
307
+ Package :: new ( "registry-dep-using-alloc" , "1.0.0" )
308
+ . file (
309
+ "src/lib.rs" ,
310
+ "
311
+ #![no_std]
312
+
313
+ extern crate alloc;
314
+
315
+ #[cfg(feature = \" mockbuild\" )]
316
+ pub fn custom_api() {
317
+ }
318
+
319
+ #[cfg(not(feature = \" mockbuild\" ))]
320
+ pub fn non_sysroot_api() {
321
+ core::custom_api();
322
+ alloc::custom_api();
323
+ }
324
+ " ,
325
+ )
326
+ . add_dep ( Dependency :: new ( "rustc-std-workspace-core" , "*" ) . optional ( true ) )
327
+ . add_dep ( Dependency :: new ( "rustc-std-workspace-alloc" , "*" ) . optional ( true ) )
328
+ . feature (
329
+ "mockbuild" ,
330
+ & [ "rustc-std-workspace-core" , "rustc-std-workspace-alloc" ] ,
331
+ )
332
+ . publish ( ) ;
333
+ Package :: new ( "registry-dep-using-std" , "1.0.0" )
334
+ . file (
335
+ "src/lib.rs" ,
336
+ "
337
+ #[cfg(feature = \" mockbuild\" )]
338
+ pub fn custom_api() {
339
+ }
340
+
341
+ #[cfg(not(feature = \" mockbuild\" ))]
342
+ pub fn non_sysroot_api() {
343
+ std::custom_api();
344
+ }
345
+ " ,
346
+ )
347
+ . add_dep ( Dependency :: new ( "rustc-std-workspace-std" , "*" ) . optional ( true ) )
348
+ . feature ( "mockbuild" , & [ "rustc-std-workspace-std" ] )
349
+ . publish ( ) ;
350
+ Package :: new ( "registry-dep-only-used-by-test" , "1.0.0" )
351
+ . file (
352
+ "src/lib.rs" ,
353
+ "
354
+ pub fn wow_testing_is_so_easy() {
355
+ }
356
+ " ,
357
+ )
358
+ . publish ( ) ;
359
+
338
360
let p = project ( )
339
361
. file (
340
362
"src/lib.rs" ,
0 commit comments