From 90f7d7e07475697fa5b9eedd26d74f2a309b4d31 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 9 Mar 2026 15:47:34 +0100 Subject: [PATCH] clean up some unused leftovers --- compiler/rustc_const_eval/src/errors.rs | 2 -- compiler/rustc_middle/src/error.rs | 26 +--------------------- compiler/rustc_middle/src/ty/consts/int.rs | 9 -------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 1097eecf3121..3943be0cf15e 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -383,8 +383,6 @@ pub struct RawBytesNote { pub bytes: String, } -// FIXME(fee1-dead) do not use stringly typed `ConstContext` - #[derive(Diagnostic)] #[diag( r#"cannot match on `{$ty}` in {$kind -> diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs index dfb99fb98513..d173335e9aa2 100644 --- a/compiler/rustc_middle/src/error.rs +++ b/compiler/rustc_middle/src/error.rs @@ -1,8 +1,7 @@ +use std::io; use std::path::Path; -use std::{fmt, io}; use rustc_errors::codes::*; -use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage}; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; @@ -114,29 +113,6 @@ pub(super) struct ConstNotUsedTraitAlias { pub span: Span, } -pub struct CustomSubdiagnostic<'a> { - pub msg: fn() -> DiagMessage, - pub add_args: Box, -} - -impl<'a> CustomSubdiagnostic<'a> { - pub fn label(x: fn() -> DiagMessage) -> Self { - Self::label_and_then(x, |_| {}) - } - pub fn label_and_then( - msg: fn() -> DiagMessage, - f: F, - ) -> Self { - Self { msg, add_args: Box::new(move |x| f(x)) } - } -} - -impl fmt::Debug for CustomSubdiagnostic<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("CustomSubdiagnostic").finish_non_exhaustive() - } -} - #[derive(Diagnostic)] pub enum LayoutError<'tcx> { #[diag("the type `{$ty}` has an unknown layout")] diff --git a/compiler/rustc_middle/src/ty/consts/int.rs b/compiler/rustc_middle/src/ty/consts/int.rs index eaf67ae23ad2..180ccd9301c4 100644 --- a/compiler/rustc_middle/src/ty/consts/int.rs +++ b/compiler/rustc_middle/src/ty/consts/int.rs @@ -4,7 +4,6 @@ use rustc_abi::Size; use rustc_apfloat::Float; use rustc_apfloat::ieee::{Double, Half, Quad, Single}; -use rustc_errors::{DiagArgValue, IntoDiagArg}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use crate::ty::TyCtxt; @@ -137,14 +136,6 @@ fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { } } -impl IntoDiagArg for ConstInt { - // FIXME this simply uses the Debug impl, but we could probably do better by converting both - // to an inherent method that returns `Cow`. - fn into_diag_arg(self, _: &mut Option) -> DiagArgValue { - DiagArgValue::Str(format!("{self:?}").into()) - } -} - /// The raw bytes of a simple value. /// /// This is a packed struct in order to allow this type to be optimally embedded in enums