Address PR comments
- UPDATE - revert migration of logs - UPDATE - use derive on LinkRlibError enum - [Gardening] UPDATE - alphabetically sort fluent_messages - UPDATE - use PathBuf and unify both AddNativeLibrary to use Display (which is what PathBuf uses when conforming to IntoDiagnosticArg) - UPDATE - fluent messages sort after rebase
This commit is contained in:
parent
12aa84bdf3
commit
a25f939170
5 changed files with 16 additions and 54 deletions
|
@ -362,10 +362,7 @@ fn link_rlib<'a>(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ab.add_archive(&location, Box::new(|_| false)).unwrap_or_else(|error| {
|
ab.add_archive(&location, Box::new(|_| false)).unwrap_or_else(|error| {
|
||||||
sess.emit_fatal(errors::AddNativeLibrary {
|
sess.emit_fatal(errors::AddNativeLibrary { library_path: location, error });
|
||||||
library_path: &location.to_string_lossy(),
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,10 +378,7 @@ fn link_rlib<'a>(
|
||||||
);
|
);
|
||||||
|
|
||||||
ab.add_archive(&output_path, Box::new(|_| false)).unwrap_or_else(|error| {
|
ab.add_archive(&output_path, Box::new(|_| false)).unwrap_or_else(|error| {
|
||||||
sess.emit_fatal(errors::AddNativeLibrary {
|
sess.emit_fatal(errors::AddNativeLibrary { library_path: output_path, error });
|
||||||
library_path: &output_path.display().to_string(),
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,13 +91,13 @@ pub fn get_linker<'a>(
|
||||||
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a));
|
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a));
|
||||||
cmd.arg(&arg);
|
cmd.arg(&arg);
|
||||||
} else {
|
} else {
|
||||||
sess.emit_warning(errors::UnsupportedArch);
|
warn!("arch is not supported");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sess.emit_warning(errors::MsvcPathNotFound);
|
warn!("MSVC root path lib location not found");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sess.emit_warning(errors::LinkExeNotFound);
|
warn!("link.exe not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,18 +30,6 @@ pub struct SymbolFileWriteFailure {
|
||||||
pub error: Error,
|
pub error: Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
|
||||||
#[diag(codegen_ssa::unsupported_arch)]
|
|
||||||
pub struct UnsupportedArch;
|
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
|
||||||
#[diag(codegen_ssa::msvc_path_not_found)]
|
|
||||||
pub struct MsvcPathNotFound;
|
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
|
||||||
#[diag(codegen_ssa::link_exe_not_found)]
|
|
||||||
pub struct LinkExeNotFound;
|
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(codegen_ssa::ld64_unimplemented_modifier)]
|
#[diag(codegen_ssa::ld64_unimplemented_modifier)]
|
||||||
pub struct Ld64UnimplementedModifier;
|
pub struct Ld64UnimplementedModifier;
|
||||||
|
@ -115,8 +103,8 @@ pub struct IncompatibleLinkingModifiers;
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(codegen_ssa::add_native_library)]
|
#[diag(codegen_ssa::add_native_library)]
|
||||||
pub struct AddNativeLibrary<'a> {
|
pub struct AddNativeLibrary {
|
||||||
pub library_path: &'a str,
|
pub library_path: PathBuf,
|
||||||
pub error: Error,
|
pub error: Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,30 +117,16 @@ pub struct MultipleExternalFuncDecl<'a> {
|
||||||
pub library_name: &'a str,
|
pub library_name: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Diagnostic)]
|
||||||
pub enum LinkRlibError {
|
pub enum LinkRlibError {
|
||||||
|
#[diag(codegen_ssa::rlib_missing_format)]
|
||||||
MissingFormat,
|
MissingFormat,
|
||||||
OnlyRmetaFound { crate_name: Symbol },
|
|
||||||
NotFound { crate_name: Symbol },
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IntoDiagnostic<'_, !> for LinkRlibError {
|
#[diag(codegen_ssa::rlib_only_rmeta_found)]
|
||||||
fn into_diagnostic(self, handler: &Handler) -> DiagnosticBuilder<'_, !> {
|
OnlyRmetaFound { crate_name: Symbol },
|
||||||
match self {
|
|
||||||
LinkRlibError::MissingFormat => {
|
#[diag(codegen_ssa::rlib_not_found)]
|
||||||
handler.struct_fatal(fluent::codegen_ssa::rlib_missing_format)
|
NotFound { crate_name: Symbol },
|
||||||
}
|
|
||||||
LinkRlibError::OnlyRmetaFound { crate_name } => {
|
|
||||||
let mut diag = handler.struct_fatal(fluent::codegen_ssa::rlib_only_rmeta_found);
|
|
||||||
diag.set_arg("crate_name", crate_name);
|
|
||||||
diag
|
|
||||||
}
|
|
||||||
LinkRlibError::NotFound { crate_name } => {
|
|
||||||
let mut diag = handler.struct_fatal(fluent::codegen_ssa::rlib_not_found);
|
|
||||||
diag.set_arg("crate_name", crate_name);
|
|
||||||
diag
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
|
|
|
@ -4,12 +4,6 @@ codegen_ssa_version_script_write_failure = failed to write version script: {$err
|
||||||
|
|
||||||
codegen_ssa_symbol_file_write_failure = failed to write symbols file: {$error}
|
codegen_ssa_symbol_file_write_failure = failed to write symbols file: {$error}
|
||||||
|
|
||||||
codegen_ssa_unsupported_arch = arch is not supported
|
|
||||||
|
|
||||||
codegen_ssa_msvc_path_not_found = MSVC root path lib location not found
|
|
||||||
|
|
||||||
codegen_ssa_link_exe_not_found = link.exe not found
|
|
||||||
|
|
||||||
codegen_ssa_ld64_unimplemented_modifier = `as-needed` modifier not implemented yet for ld64
|
codegen_ssa_ld64_unimplemented_modifier = `as-needed` modifier not implemented yet for ld64
|
||||||
|
|
||||||
codegen_ssa_linker_unsupported_modifier = `as-needed` modifier not supported for current linker
|
codegen_ssa_linker_unsupported_modifier = `as-needed` modifier not supported for current linker
|
||||||
|
|
|
@ -40,9 +40,10 @@ fluent_messages! {
|
||||||
attr => "../locales/en-US/attr.ftl",
|
attr => "../locales/en-US/attr.ftl",
|
||||||
borrowck => "../locales/en-US/borrowck.ftl",
|
borrowck => "../locales/en-US/borrowck.ftl",
|
||||||
builtin_macros => "../locales/en-US/builtin_macros.ftl",
|
builtin_macros => "../locales/en-US/builtin_macros.ftl",
|
||||||
|
codegen_gcc => "../locales/en-US/codegen_gcc.ftl",
|
||||||
|
codegen_ssa => "../locales/en-US/codegen_ssa.ftl",
|
||||||
compiletest => "../locales/en-US/compiletest.ftl",
|
compiletest => "../locales/en-US/compiletest.ftl",
|
||||||
const_eval => "../locales/en-US/const_eval.ftl",
|
const_eval => "../locales/en-US/const_eval.ftl",
|
||||||
codegen_gcc => "../locales/en-US/codegen_gcc.ftl",
|
|
||||||
driver => "../locales/en-US/driver.ftl",
|
driver => "../locales/en-US/driver.ftl",
|
||||||
expand => "../locales/en-US/expand.ftl",
|
expand => "../locales/en-US/expand.ftl",
|
||||||
hir_analysis => "../locales/en-US/hir_analysis.ftl",
|
hir_analysis => "../locales/en-US/hir_analysis.ftl",
|
||||||
|
@ -63,7 +64,6 @@ fluent_messages! {
|
||||||
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
|
symbol_mangling => "../locales/en-US/symbol_mangling.ftl",
|
||||||
trait_selection => "../locales/en-US/trait_selection.ftl",
|
trait_selection => "../locales/en-US/trait_selection.ftl",
|
||||||
ty_utils => "../locales/en-US/ty_utils.ftl",
|
ty_utils => "../locales/en-US/ty_utils.ftl",
|
||||||
codegen_ssa => "../locales/en-US/codegen_ssa.ftl",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};
|
pub use fluent_generated::{self as fluent, DEFAULT_LOCALE_RESOURCES};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue