diff options
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
3 files changed, 1 insertions, 73 deletions
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 7d44ac458de..26cd7d80bd5 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -693,20 +693,6 @@ pub(crate) struct TypeOf<'tcx> { } #[derive(Diagnostic)] -#[diag(hir_analysis_pass_to_variadic_function, code = E0617)] -pub(crate) struct PassToVariadicFunction<'tcx, 'a> { - #[primary_span] - pub span: Span, - pub ty: Ty<'tcx>, - pub cast_ty: &'a str, - #[suggestion(code = "{replace}", applicability = "machine-applicable")] - pub sugg_span: Option<Span>, - pub replace: String, - #[help] - pub help: Option<()>, -} - -#[derive(Diagnostic)] #[diag(hir_analysis_invalid_union_field, code = E0740)] pub(crate) struct InvalidUnionField { #[primary_span] diff --git a/compiler/rustc_hir_analysis/src/structured_errors.rs b/compiler/rustc_hir_analysis/src/structured_errors.rs index 61a2400f9e4..af4d9efca5a 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors.rs @@ -1,7 +1,6 @@ -mod missing_cast_for_variadic_arg; mod wrong_number_of_generic_args; -pub use self::{missing_cast_for_variadic_arg::*, wrong_number_of_generic_args::*}; +pub use self::wrong_number_of_generic_args::*; use rustc_errors::{Diag, ErrCode}; use rustc_session::Session; diff --git a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs b/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs deleted file mode 100644 index 0e78acbeae2..00000000000 --- a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::{errors, structured_errors::StructuredDiag}; -use rustc_errors::{codes::*, Diag}; -use rustc_middle::ty::{Ty, TypeVisitableExt}; -use rustc_session::Session; -use rustc_span::Span; - -pub struct MissingCastForVariadicArg<'tcx, 's> { - pub sess: &'tcx Session, - pub span: Span, - pub ty: Ty<'tcx>, - pub cast_ty: &'s str, -} - -impl<'tcx> StructuredDiag<'tcx> for MissingCastForVariadicArg<'tcx, '_> { - fn session(&self) -> &Session { - self.sess - } - - fn code(&self) -> ErrCode { - E0617 - } - - fn diagnostic_common(&self) -> Diag<'tcx> { - let (sugg_span, replace, help) = - if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.span) { - (Some(self.span), format!("{} as {}", snippet, self.cast_ty), None) - } else { - (None, "".to_string(), Some(())) - }; - - let mut err = self.sess.dcx().create_err(errors::PassToVariadicFunction { - span: self.span, - ty: self.ty, - cast_ty: self.cast_ty, - help, - replace, - sugg_span, - }); - - if self.ty.references_error() { - err.downgrade_to_delayed_bug(); - } - - err - } - - fn diagnostic_extended(&self, mut err: Diag<'tcx>) -> Diag<'tcx> { - err.note(format!( - "certain types, like `{}`, must be casted before passing them to a \ - variadic function, because of arcane ABI rules dictated by the C \ - standard", - self.ty - )); - - err - } -}  | 
