diff options
| author | Tshepang Mbambo <tshepang@gmail.com> | 2025-04-28 06:25:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-28 06:25:10 +0200 |
| commit | 1b53c12753a9ecead0e9728e01dcc2a7c07c18f9 (patch) | |
| tree | 87e76fd223f1937ee26537e1028d44e7f6b65544 /compiler/rustc_mir_transform/src/errors.rs | |
| parent | d91ffb6da5c306150e53f73a361f69837bc39851 (diff) | |
| parent | aa15830ee2defbac8e784db5510bb914e6e4c820 (diff) | |
| download | rust-1b53c12753a9ecead0e9728e01dcc2a7c07c18f9.tar.gz rust-1b53c12753a9ecead0e9728e01dcc2a7c07c18f9.zip | |
Merge pull request #2358 from rust-lang/rustc-pull
Rustc pull update
Diffstat (limited to 'compiler/rustc_mir_transform/src/errors.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/errors.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs index 29698b0c2e4..5b03a4987ed 100644 --- a/compiler/rustc_mir_transform/src/errors.rs +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -158,6 +158,26 @@ pub(crate) struct MustNotSuspendReason { pub reason: String, } +pub(crate) struct UnnecessaryTransmute { + pub span: Span, + pub sugg: String, + pub help: Option<&'static str>, +} + +// Needed for def_path_str +impl<'a> LintDiagnostic<'a, ()> for UnnecessaryTransmute { + fn decorate_lint<'b>(self, diag: &'b mut rustc_errors::Diag<'a, ()>) { + diag.primary_message(fluent::mir_transform_unnecessary_transmute); + diag.span_suggestion( + self.span, + "replace this with", + self.sugg, + lint::Applicability::MachineApplicable, + ); + self.help.map(|help| diag.help(help)); + } +} + #[derive(LintDiagnostic)] #[diag(mir_transform_undefined_transmute)] #[note] |
