1
Fork 0

Serialize OutputFilenames into rmeta file

This ensures that linking will use the correct crate name even when
`#![crate_name = "..."]` is used to specify the crate name.
This commit is contained in:
bjorn3 2023-11-04 15:49:57 +00:00
parent eacbe65dfe
commit 98a6eaa7f8
5 changed files with 22 additions and 27 deletions

View file

@ -648,12 +648,11 @@ fn show_md_content_with_pager(content: &str, color: ColorConfig) {
fn process_rlink(sess: &Session, compiler: &interface::Compiler) {
assert!(sess.opts.unstable_opts.link_only);
if let Input::File(file) = &sess.io.input {
let outputs = compiler.build_output_filenames(sess, &[]);
let rlink_data = fs::read(file).unwrap_or_else(|err| {
sess.emit_fatal(RlinkUnableToRead { err });
});
let codegen_results = match CodegenResults::deserialize_rlink(sess, rlink_data) {
Ok(codegen) => codegen,
let (codegen_results, outputs) = match CodegenResults::deserialize_rlink(sess, rlink_data) {
Ok((codegen, outputs)) => (codegen, outputs),
Err(err) => {
match err {
CodegenErrors::WrongFileType => sess.emit_fatal(RLinkWrongFileType),