Remove dead error code.
This commit is contained in:
parent
6aa1268900
commit
baa64b0e77
3 changed files with 5 additions and 47 deletions
|
@ -1,9 +1,11 @@
|
||||||
|
#### Note: this error code is no longer emitted by the compiler.
|
||||||
|
|
||||||
When using generators (or async) all type variables must be bound so a
|
When using generators (or async) all type variables must be bound so a
|
||||||
generator can be constructed.
|
generator can be constructed.
|
||||||
|
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```edition2018,compile_fail,E0698
|
```edition2018,compile_fail,E0282
|
||||||
async fn bar<T>() -> () {}
|
async fn bar<T>() -> () {}
|
||||||
|
|
||||||
async fn foo() {
|
async fn foo() {
|
||||||
|
|
|
@ -14,8 +14,7 @@ use rustc_span::{symbol::Ident, BytePos, Span};
|
||||||
|
|
||||||
use crate::fluent_generated as fluent;
|
use crate::fluent_generated as fluent;
|
||||||
use crate::infer::error_reporting::{
|
use crate::infer::error_reporting::{
|
||||||
need_type_info::{GeneratorKindAsDiagArg, UnderspecifiedArgKind},
|
need_type_info::UnderspecifiedArgKind, nice_region_error::placeholder_error::Highlighted,
|
||||||
nice_region_error::placeholder_error::Highlighted,
|
|
||||||
ObligationCauseAsDiagArg,
|
ObligationCauseAsDiagArg,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,16 +85,6 @@ pub struct AmbiguousReturn<'a> {
|
||||||
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
pub multi_suggestions: Vec<SourceKindMultiSuggestion<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
|
||||||
#[diag(infer_need_type_info_in_generator, code = "E0698")]
|
|
||||||
pub struct NeedTypeInfoInGenerator<'a> {
|
|
||||||
#[primary_span]
|
|
||||||
pub span: Span,
|
|
||||||
pub generator_kind: GeneratorKindAsDiagArg,
|
|
||||||
#[subdiagnostic]
|
|
||||||
pub bad_label: InferenceBadError<'a>,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used when a better one isn't available
|
// Used when a better one isn't available
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
#[label(infer_label_bad)]
|
#[label(infer_label_bad)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::errors::{
|
use crate::errors::{
|
||||||
AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError, NeedTypeInfoInGenerator,
|
AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError,
|
||||||
SourceKindMultiSuggestion, SourceKindSubdiag,
|
SourceKindMultiSuggestion, SourceKindSubdiag,
|
||||||
};
|
};
|
||||||
use crate::infer::error_reporting::TypeErrCtxt;
|
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)]
|
#[derive(Debug)]
|
||||||
struct InferSource<'tcx> {
|
struct InferSource<'tcx> {
|
||||||
span: Span,
|
span: Span,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue