clean up some unused leftovers

This commit is contained in:
Ralf Jung
2026-03-09 15:47:34 +01:00
parent 94361fba3e
commit 90f7d7e074
3 changed files with 1 additions and 36 deletions
-2
View File
@@ -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 ->
+1 -25
View File
@@ -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<dyn FnOnce(&mut dyn FnMut(DiagArgName, DiagArgValue)) + 'a>,
}
impl<'a> CustomSubdiagnostic<'a> {
pub fn label(x: fn() -> DiagMessage) -> Self {
Self::label_and_then(x, |_| {})
}
pub fn label_and_then<F: FnOnce(&mut dyn FnMut(DiagArgName, DiagArgValue)) + 'a>(
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")]
@@ -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<std::path::PathBuf>) -> 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