@@ -3229,6 +3229,7 @@ impl Step for Distcheck {
3229
3229
/// check steps from those sources.
3230
3230
/// - Check that selected dist components (`rust-src` only at the moment) at least have expected
3231
3231
/// directory shape and crate manifests that cargo can generate a lockfile from.
3232
+ /// - Check that we can run `cargo metadata` on the workspace in the `rustc-dev` component
3232
3233
///
3233
3234
/// FIXME(#136822): dist components are under-tested.
3234
3235
fn run ( self , builder : & Builder < ' _ > ) {
@@ -3238,11 +3239,12 @@ impl Step for Distcheck {
3238
3239
3239
3240
distcheck_plain_source_tarball ( builder, & root_dir. join ( "distcheck-plain-src" ) ) ;
3240
3241
distcheck_rust_src ( builder, & root_dir. join ( "distcheck-src" ) ) ;
3242
+ distcheck_rustc_dev ( builder, & root_dir. join ( "distcheck-rustc-dev" ) ) ;
3241
3243
}
3242
3244
}
3243
3245
3246
+ /// Check that we can build some basic things from the plain source tarball
3244
3247
fn distcheck_plain_source_tarball ( builder : & Builder < ' _ > , plain_src_dir : & Path ) {
3245
- // Check that we can build some basic things from the plain source tarball
3246
3248
builder. info ( "Distcheck plain source tarball" ) ;
3247
3249
let plain_src_tarball = builder. ensure ( dist:: PlainSourceTarball ) ;
3248
3250
builder. clear_dir ( & plain_src_dir) ;
@@ -3273,8 +3275,8 @@ fn distcheck_plain_source_tarball(builder: &Builder<'_>, plain_src_dir: &Path) {
3273
3275
. run ( builder) ;
3274
3276
}
3275
3277
3278
+ /// Check that rust-src has all of libstd's dependencies
3276
3279
fn distcheck_rust_src ( builder : & Builder < ' _ > , src_dir : & Path ) {
3277
- // Now make sure that rust-src has all of libstd's dependencies
3278
3280
builder. info ( "Distcheck rust-src" ) ;
3279
3281
let src_tarball = builder. ensure ( dist:: Src ) ;
3280
3282
builder. clear_dir ( & src_dir) ;
@@ -3298,6 +3300,28 @@ fn distcheck_rust_src(builder: &Builder<'_>, src_dir: &Path) {
3298
3300
. run ( builder) ;
3299
3301
}
3300
3302
3303
+ /// Check that rustc-dev's compiler crate source code can be loaded with `cargo metadata`
3304
+ fn distcheck_rustc_dev ( builder : & Builder < ' _ > , dir : & Path ) {
3305
+ builder. info ( "Distcheck rustc-dev" ) ;
3306
+ let tarball = builder. ensure ( dist:: RustcDev :: new ( builder, builder. host_target ) ) . unwrap ( ) ;
3307
+ builder. clear_dir ( & dir) ;
3308
+
3309
+ command ( "tar" )
3310
+ . arg ( "-xf" )
3311
+ . arg ( tarball. tarball ( ) )
3312
+ . arg ( "--strip-components=1" )
3313
+ . current_dir ( & dir)
3314
+ . run ( builder) ;
3315
+
3316
+ command ( & builder. initial_cargo )
3317
+ . arg ( "metadata" )
3318
+ . arg ( "--manifest-path" )
3319
+ . arg ( "rustc-dev/lib/rustlib/rustc-src/rust/compiler/rustc_ast/Cargo.toml" )
3320
+ . env ( "RUSTC_BOOTSTRAP" , "1" )
3321
+ . current_dir ( & dir)
3322
+ . run ( builder) ;
3323
+ }
3324
+
3301
3325
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
3302
3326
pub struct Bootstrap ;
3303
3327
0 commit comments