File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
compiler/rustc_driver_impl/src
tests/run-make/no-input-file Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -624,7 +624,10 @@ fn print_crate_info(
624624 println ! ( "{}" , serde_json:: to_string_pretty( & sess. target. to_json( ) ) . unwrap( ) ) ;
625625 }
626626 FileNames | CrateName => {
627- let attrs = attrs. as_ref ( ) . unwrap ( ) ;
627+ let Some ( attrs) = attrs. as_ref ( ) else {
628+ // no crate attributes, print out an error and exit
629+ return Compilation :: Continue ;
630+ } ;
628631 let t_outputs = rustc_interface:: util:: build_output_filenames ( attrs, sess) ;
629632 let id = rustc_session:: output:: find_crate_name ( sess, attrs) ;
630633 if * req == PrintRequest :: CrateName {
Original file line number Diff line number Diff line change 1+ include ../../run-make-fulldeps/tools.mk
2+
3+ all :
4+ $(RUSTC ) --print crate-name 2>&1 | diff - no-input-file.stderr
Original file line number Diff line number Diff line change 1+ error: no input filename given
2+
You can’t perform that action at this time.
0 commit comments