Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,10 @@ fn print_crate_info(
println!("{}", serde_json::to_string_pretty(&sess.target.to_json()).unwrap());
}
FileNames | CrateName => {
let attrs = attrs.as_ref().unwrap();
let Some(attrs) = attrs.as_ref() else {
// no crate attributes, print out an error and exit
return Compilation::Continue;
};
let t_outputs = rustc_interface::util::build_output_filenames(attrs, sess);
let id = rustc_session::output::find_crate_name(sess, attrs);
if *req == PrintRequest::CrateName {
Expand Down
4 changes: 4 additions & 0 deletions tests/run-make/no-input-file/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include ../../run-make-fulldeps/tools.mk

all:
$(RUSTC) --print crate-name 2>&1 | diff - no-input-file.stderr
2 changes: 2 additions & 0 deletions tests/run-make/no-input-file/no-input-file.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: no input filename given