Rollup merge of #107836 - chenyukang:yukang/fix-107822, r=oli-obk
Handle properly when there is no crate attrs Fixes #107822 r? `@oli-obk`
This commit is contained in:
commit
d494cd3eab
3 changed files with 10 additions and 1 deletions
|
@ -624,7 +624,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 {
|
||||
|
|
4
tests/run-make/no-input-file/Makefile
Normal file
4
tests/run-make/no-input-file/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
|||
include ../../run-make-fulldeps/tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) --print crate-name 2>&1 | diff - no-input-file.stderr
|
2
tests/run-make/no-input-file/no-input-file.stderr
Normal file
2
tests/run-make/no-input-file/no-input-file.stderr
Normal file
|
@ -0,0 +1,2 @@
|
|||
error: no input filename given
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue