diff options
| author | Ralf Jung <post@ralfj.de> | 2023-06-02 10:03:49 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-06-02 10:03:49 +0200 |
| commit | c5aebfb9348277639b0877eb83995dfd1bd2ff23 (patch) | |
| tree | d54ef5d9706906a3b6bd2aa5337bd32d03b4112e /compiler/rustc_errors/src/diagnostic_impls.rs | |
| parent | 777db72b08f316345cffde2fc83478668b9da7cf (diff) | |
| parent | 33c3d101280c8eb3cd8af421bfb56a8afcc3881d (diff) | |
| download | rust-c5aebfb9348277639b0877eb83995dfd1bd2ff23.tar.gz rust-c5aebfb9348277639b0877eb83995dfd1bd2ff23.zip | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic_impls.rs')
| -rw-r--r-- | compiler/rustc_errors/src/diagnostic_impls.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 65f8a61a30a..10fe7fc74a8 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -60,10 +60,8 @@ into_diagnostic_arg_using_display!( u8, i16, u16, - i32, u32, i64, - u64, i128, u128, std::io::Error, @@ -80,6 +78,18 @@ into_diagnostic_arg_using_display!( ExitStatus, ); +impl IntoDiagnosticArg for i32 { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + DiagnosticArgValue::Number(self.into()) + } +} + +impl IntoDiagnosticArg for u64 { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + DiagnosticArgValue::Number(self.into()) + } +} + impl IntoDiagnosticArg for bool { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { if self { @@ -134,7 +144,7 @@ impl IntoDiagnosticArg for PathBuf { impl IntoDiagnosticArg for usize { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { - DiagnosticArgValue::Number(self) + DiagnosticArgValue::Number(self as i128) } } @@ -147,9 +157,9 @@ impl IntoDiagnosticArg for PanicStrategy { impl IntoDiagnosticArg for hir::ConstContext { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { DiagnosticArgValue::Str(Cow::Borrowed(match self { - hir::ConstContext::ConstFn => "constant function", + hir::ConstContext::ConstFn => "const_fn", hir::ConstContext::Static(_) => "static", - hir::ConstContext::Const => "constant", + hir::ConstContext::Const => "const", })) } } @@ -254,7 +264,8 @@ impl IntoDiagnostic<'_, !> for TargetDataLayoutErrors<'_> { TargetDataLayoutErrors::InvalidAlignment { cause, err } => { diag = handler.struct_fatal(fluent::errors_target_invalid_alignment); diag.set_arg("cause", cause); - diag.set_arg("err", err); + diag.set_arg("err_kind", err.diag_ident()); + diag.set_arg("align", err.align()); diag } TargetDataLayoutErrors::InconsistentTargetArchitecture { dl, target } => { |
