summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs')
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs39
1 files changed, 3 insertions, 36 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
index f2a3c47bd..a9029a8ce 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
@@ -1,5 +1,5 @@
use crate::errors::{
- AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError, NeedTypeInfoInGenerator,
+ AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError,
SourceKindMultiSuggestion, SourceKindSubdiag,
};
use crate::infer::error_reporting::TypeErrCtxt;
@@ -595,39 +595,6 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
}
}
-impl<'tcx> InferCtxt<'tcx> {
- pub fn need_type_info_err_in_generator(
- &self,
- kind: hir::GeneratorKind,
- span: Span,
- ty: ty::Term<'tcx>,
- ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
- let ty = self.resolve_vars_if_possible(ty);
- let data = self.extract_inference_diagnostics_data(ty.into(), None);
-
- NeedTypeInfoInGenerator {
- bad_label: data.make_bad_error(span),
- span,
- generator_kind: GeneratorKindAsDiagArg(kind),
- }
- .into_diagnostic(&self.tcx.sess.parse_sess.span_diagnostic)
- }
-}
-
-pub struct GeneratorKindAsDiagArg(pub hir::GeneratorKind);
-
-impl IntoDiagnosticArg for GeneratorKindAsDiagArg {
- fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
- let kind = match self.0 {
- hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Block) => "async_block",
- hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Closure) => "async_closure",
- hir::GeneratorKind::Async(hir::AsyncGeneratorKind::Fn) => "async_fn",
- hir::GeneratorKind::Gen => "generator",
- };
- rustc_errors::DiagnosticArgValue::Str(kind.into())
- }
-}
-
#[derive(Debug)]
struct InferSource<'tcx> {
span: Span,
@@ -951,7 +918,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
//
// See the `need_type_info/issue-103053.rs` test for
// a example.
- if !matches!(path.res, Res::Def(DefKind::TyAlias { .. }, _)) => {
+ if !matches!(path.res, Res::Def(DefKind::TyAlias, _)) => {
if let Some(ty) = self.opt_node_type(expr.hir_id)
&& let ty::Adt(_, args) = ty.kind()
{
@@ -1080,7 +1047,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
) => {
if tcx.res_generics_def_id(path.res) != Some(def.did()) {
match path.res {
- Res::Def(DefKind::TyAlias { .. }, _) => {
+ Res::Def(DefKind::TyAlias, _) => {
// FIXME: Ideally we should support this. For that
// we have to map back from the self type to the
// type alias though. That's difficult.