Make .rmeta file in dep-info have correct name (lib prefix)
Since `filename_for_metadata()` and `OutputFilenames::path(OutputType::Metadata)` had different logic for the name of the metadata file, the `.d` file contained a file name different from the actual name used. Share the logic to fix the out-of-sync name. Closes 68839.
This commit is contained in:
@@ -880,6 +880,9 @@ impl OutFileName {
|
||||
#[derive(Clone, Hash, Debug, HashStable_Generic)]
|
||||
pub struct OutputFilenames {
|
||||
pub out_directory: PathBuf,
|
||||
/// Crate name. Never contains '-'.
|
||||
crate_stem: String,
|
||||
/// Typically based on `.rs` input file name. Any '-' is preserved.
|
||||
filestem: String,
|
||||
pub single_output_file: Option<OutFileName>,
|
||||
pub temps_directory: Option<PathBuf>,
|
||||
@@ -893,6 +896,7 @@ pub const DWARF_OBJECT_EXT: &str = "dwo";
|
||||
impl OutputFilenames {
|
||||
pub fn new(
|
||||
out_directory: PathBuf,
|
||||
out_crate_name: String,
|
||||
out_filestem: String,
|
||||
single_output_file: Option<OutFileName>,
|
||||
temps_directory: Option<PathBuf>,
|
||||
@@ -904,6 +908,7 @@ impl OutputFilenames {
|
||||
single_output_file,
|
||||
temps_directory,
|
||||
outputs,
|
||||
crate_stem: format!("{out_crate_name}{extra}"),
|
||||
filestem: format!("{out_filestem}{extra}"),
|
||||
}
|
||||
}
|
||||
@@ -920,7 +925,12 @@ impl OutputFilenames {
|
||||
/// should be placed on disk.
|
||||
pub fn output_path(&self, flavor: OutputType) -> PathBuf {
|
||||
let extension = flavor.extension();
|
||||
self.with_directory_and_extension(&self.out_directory, extension)
|
||||
match flavor {
|
||||
OutputType::Metadata => {
|
||||
self.out_directory.join(format!("lib{}.{}", self.crate_stem, extension))
|
||||
}
|
||||
_ => self.with_directory_and_extension(&self.out_directory, extension),
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the path where a compilation artifact of the given type for the
|
||||
|
||||
Reference in New Issue
Block a user