-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE: rustc panics on empty output filename #26092
Labels
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
huonw
added
the
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
label
Jun 8, 2015
bors
added a commit
that referenced
this issue
Jun 11, 2015
`driver::build_output_filenames` calls `file_stem` on a PathBuf obtained from the output file compiler flag. It's possible to pass the empty string to this compiler flag. When file_stem is called on an empty Path, it returns None, which is unwrapped and the compiler panics. This change modifies the `unwrap` to an `unwrap_or` so that the empty string is passed through the compilation pipeline until it reaches `trans::back::write_output_file`, which will emit an appropriate error. Instead of panicking, the error that is emitted now is: ``` $ rustc -o "" thing.rs error: could not write output to : No such file or directory ``` The `:` is a little strange, but it /is/ reporting the filename (the empty string) correctly, I suppose. Both gcc and clang hand the output file to ld, which emits a similar error message when faced with the empty string as an output file: ``` $ clang -o "" thing.c ld: can't open output file for writing: , errno=2 for architecture x86_64 ``` This PR also adds a test for this, in `run-make`. This fixes issue #26092.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think this has been reported yet.
I think better error handling in
rustc_driver::driver::build_output_filenames
L953..974 would make this go away.The text was updated successfully, but these errors were encountered: