We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8d50ef commit c6d9482Copy full SHA for c6d9482
compiler/rustc_session/src/config.rs
@@ -838,10 +838,14 @@ pub enum Input {
838
839
impl Input {
840
pub fn filestem(&self) -> &str {
841
- match *self {
842
- Input::File(ref ifile) => ifile.file_stem().unwrap().to_str().unwrap(),
843
- Input::Str { .. } => "rust_out",
+ if let Input::File(ifile) = self {
+ // If for some reason getting the file stem as a UTF-8 string fails,
+ // then fallback to a fixed name.
844
+ if let Some(name) = ifile.file_stem().and_then(OsStr::to_str) {
845
+ return name;
846
+ }
847
}
848
+ "rust_out"
849
850
851
pub fn source_name(&self) -> FileName {
0 commit comments