diff options
| author | Ralf Jung <post@ralfj.de> | 2025-04-25 10:43:50 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 10:43:50 +0000 |
| commit | ea9037e1654d2fb7e29dca87679d3c18a713f82d (patch) | |
| tree | b304db669fcd8cadd9f7d0e3119e54545326318a /compiler/rustc_mir_transform/src/errors.rs | |
| parent | 0ee8f32dcd42a5091579f11db87f86672971a1d1 (diff) | |
| parent | 673c879abb7f3b05e25f0da5654e2a484abc17c0 (diff) | |
| download | rust-ea9037e1654d2fb7e29dca87679d3c18a713f82d.tar.gz rust-ea9037e1654d2fb7e29dca87679d3c18a713f82d.zip | |
Merge pull request #4292 from rust-lang/rustup-2025-04-25
Automatic Rustup
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] |
