diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2025-04-25 05:01:33 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2025-04-25 05:01:33 +0000 |
| commit | 65e76849ac460cebfce6db7d6f3db6b48eeff31d (patch) | |
| tree | 033589cdc25e12f84bf732fc1a3439208d9fee83 /compiler/rustc_mir_transform/src/errors.rs | |
| parent | 37049558e43e72fa3890aa3f7c23e5f00414444c (diff) | |
| parent | 7018392337a938e25c9ed9190c4f0966737fffdb (diff) | |
| download | rust-65e76849ac460cebfce6db7d6f3db6b48eeff31d.tar.gz rust-65e76849ac460cebfce6db7d6f3db6b48eeff31d.zip | |
Merge from rustc
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] |
