1
Fork 0

Don't store thir::Pat in error structs

In several cases this avoids the need to clone the underlying pattern, and then
print the clone later.
This commit is contained in:
Zalathar 2024-07-28 15:12:14 +10:00
parent 3148b35f6a
commit e1fc4a997d
4 changed files with 32 additions and 40 deletions

View file

@ -9,7 +9,6 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/thir.html
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_errors::{DiagArgValue, IntoDiagArg};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{BindingMode, ByRef, HirId, MatchSource, RangeEnd};
@ -702,12 +701,6 @@ impl<'tcx> Pat<'tcx> {
}
}
impl<'tcx> IntoDiagArg for Pat<'tcx> {
fn into_diag_arg(self) -> DiagArgValue {
format!("{self}").into_diag_arg()
}
}
#[derive(Clone, Debug, HashStable, TypeVisitable)]
pub struct Ascription<'tcx> {
pub annotation: CanonicalUserTypeAnnotation<'tcx>,