@@ -3229,6 +3229,7 @@ impl Step for Distcheck {
32293229 /// check steps from those sources.
32303230 /// - Check that selected dist components (`rust-src` only at the moment) at least have expected
32313231 /// 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
32323233 ///
32333234 /// FIXME(#136822): dist components are under-tested.
32343235 fn run ( self , builder : & Builder < ' _ > ) {
@@ -3238,11 +3239,12 @@ impl Step for Distcheck {
32383239
32393240 distcheck_plain_source_tarball ( builder, & root_dir. join ( "distcheck-plain-src" ) ) ;
32403241 distcheck_rust_src ( builder, & root_dir. join ( "distcheck-src" ) ) ;
3242+ distcheck_rustc_dev ( builder, & root_dir. join ( "distcheck-rustc-dev" ) ) ;
32413243 }
32423244}
32433245
3246+ /// Check that we can build some basic things from the plain source tarball
32443247fn distcheck_plain_source_tarball ( builder : & Builder < ' _ > , plain_src_dir : & Path ) {
3245- // Check that we can build some basic things from the plain source tarball
32463248 builder. info ( "Distcheck plain source tarball" ) ;
32473249 let plain_src_tarball = builder. ensure ( dist:: PlainSourceTarball ) ;
32483250 builder. clear_dir ( & plain_src_dir) ;
@@ -3273,8 +3275,8 @@ fn distcheck_plain_source_tarball(builder: &Builder<'_>, plain_src_dir: &Path) {
32733275 . run ( builder) ;
32743276}
32753277
3278+ /// Check that rust-src has all of libstd's dependencies
32763279fn distcheck_rust_src ( builder : & Builder < ' _ > , src_dir : & Path ) {
3277- // Now make sure that rust-src has all of libstd's dependencies
32783280 builder. info ( "Distcheck rust-src" ) ;
32793281 let src_tarball = builder. ensure ( dist:: Src ) ;
32803282 builder. clear_dir ( & src_dir) ;
@@ -3298,6 +3300,28 @@ fn distcheck_rust_src(builder: &Builder<'_>, src_dir: &Path) {
32983300 . run ( builder) ;
32993301}
33003302
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+
33013325#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
33023326pub struct Bootstrap ;
33033327
0 commit comments