diff options
| author | bors <bors@rust-lang.org> | 2015-06-11 21:35:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-11 21:35:10 +0000 |
| commit | 400e955d8bbff8c3abc3c43c74fc255a70cf885e (patch) | |
| tree | 1affb488a823427b4a7fac66dc0fc0dcc528c451 /src/rustllvm/RustWrapper.cpp | |
| parent | b5b3a99f84f2b4dbf9495dccd7112c74f4357acc (diff) | |
| parent | 91effb374c98927823b3032f7433e7b73a229f95 (diff) | |
| download | rust-400e955d8bbff8c3abc3c43c74fc255a70cf885e.tar.gz rust-400e955d8bbff8c3abc3c43c74fc255a70cf885e.zip | |
Auto merge of #26199 - swgillespie:issue-26092, r=alexcrichton
`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.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
