diff options
| author | bors <bors@rust-lang.org> | 2023-04-10 19:38:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-10 19:38:48 +0000 |
| commit | 88fb1b922b047981fc0cfc62aa1418b4361ae72e (patch) | |
| tree | 448efc3576b60dd386661865cf2d1a358316a8c1 /compiler/rustc_middle/src | |
| parent | a73288371e3fa0a610fbc11e7e8418017bdfde42 (diff) | |
| parent | d07b1cd4a8e0f88b2b93090172ec4d257210d172 (diff) | |
| download | rust-88fb1b922b047981fc0cfc62aa1418b4361ae72e.tar.gz rust-88fb1b922b047981fc0cfc62aa1418b4361ae72e.zip | |
Auto merge of #108698 - IntQuant:issue-100717-infer-6, r=davidtwco
Migrating rustc_infer to session diagnostics (part 5) `@rustbot` label +A-translation cc https://github.com/rust-lang/rust/issues/100717
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 5bbd396d6f3..24cbe8e8281 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -15,6 +15,7 @@ use hir::def::DefKind; use polonius_engine::Atom; use rustc_data_structures::captures::Captures; use rustc_data_structures::intern::Interned; +use rustc_errors::{DiagnosticArgValue, IntoDiagnosticArg}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::LangItem; @@ -864,8 +865,8 @@ impl<'tcx> PolyTraitRef<'tcx> { } } -impl rustc_errors::IntoDiagnosticArg for PolyTraitRef<'_> { - fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { +impl<'tcx> IntoDiagnosticArg for TraitRef<'tcx> { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { self.to_string().into_diagnostic_arg() } } @@ -910,6 +911,12 @@ impl<'tcx> ExistentialTraitRef<'tcx> { } } +impl<'tcx> IntoDiagnosticArg for ExistentialTraitRef<'tcx> { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + self.to_string().into_diagnostic_arg() + } +} + pub type PolyExistentialTraitRef<'tcx> = Binder<'tcx, ExistentialTraitRef<'tcx>>; impl<'tcx> PolyExistentialTraitRef<'tcx> { @@ -926,12 +933,6 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { } } -impl rustc_errors::IntoDiagnosticArg for PolyExistentialTraitRef<'_> { - fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { - self.to_string().into_diagnostic_arg() - } -} - #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] #[derive(HashStable)] pub enum BoundVariableKind { @@ -1146,6 +1147,15 @@ impl<'tcx, T: IntoIterator> Binder<'tcx, T> { } } +impl<'tcx, T> IntoDiagnosticArg for Binder<'tcx, T> +where + T: IntoDiagnosticArg, +{ + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + self.0.into_diagnostic_arg() + } +} + struct SkipBindersAt<'tcx> { tcx: TyCtxt<'tcx>, index: ty::DebruijnIndex, @@ -1362,6 +1372,12 @@ impl<'tcx> FnSig<'tcx> { } } +impl<'tcx> IntoDiagnosticArg for FnSig<'tcx> { + fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { + self.to_string().into_diagnostic_arg() + } +} + pub type PolyFnSig<'tcx> = Binder<'tcx, FnSig<'tcx>>; impl<'tcx> PolyFnSig<'tcx> { |
