@@ -6,7 +6,7 @@ use rustc_errors::codes::*;
6
6
use rustc_errors::{Diag, IntoDiagArg};
7
7
use rustc_hir as hir;
8
8
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
9
- use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
9
+ use rustc_hir::def_id::{DefId, LocalDefId};
10
10
use rustc_hir::intravisit::{self, Visitor};
11
11
use rustc_hir::{Body, Closure, Expr, ExprKind, FnRetTy, HirId, LetStmt, LocalSource};
12
12
use rustc_middle::bug;
@@ -17,7 +17,7 @@ use rustc_middle::ty::{
17
17
self, GenericArg, GenericArgKind, GenericArgsRef, InferConst, IsSuggestable, Term, TermKind,
18
18
Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitableExt, TypeckResults,
19
19
};
20
- use rustc_span::{BytePos, DUMMY_SP, FileName, Ident, Span, sym};
20
+ use rustc_span::{BytePos, DUMMY_SP, Ident, Span, sym};
21
21
use tracing::{debug, instrument, warn};
22
22
23
23
use super::nice_region_error::placeholder_error::Highlighted;
@@ -438,7 +438,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
438
438
bad_label,
439
439
was_written: false,
440
440
path: Default::default(),
441
- time_version: false,
442
441
}),
443
442
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
444
443
span,
@@ -630,10 +629,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
630
629
}
631
630
}
632
631
}
633
-
634
- let time_version =
635
- self.detect_old_time_crate_version(failure_span, &kind, &mut infer_subdiags);
636
-
637
632
match error_code {
638
633
TypeAnnotationNeeded::E0282 => self.dcx().create_err(AnnotationRequired {
639
634
span,
@@ -645,7 +640,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
645
640
bad_label: None,
646
641
was_written: path.is_some(),
647
642
path: path.unwrap_or_default(),
648
- time_version,
649
643
}),
650
644
TypeAnnotationNeeded::E0283 => self.dcx().create_err(AmbiguousImpl {
651
645
span,
@@ -671,42 +665,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
671
665
}),
672
666
}
673
667
}
674
-
675
- /// Detect the inference regression on crate `time` <= 0.3.35 and emit a more targeted error.
676
- /// <https://github.com/rust-lang/rust/issues/127343>
677
- // FIXME: we should figure out a more generic version of doing this, ideally in cargo itself.
678
- fn detect_old_time_crate_version(
679
- &self,
680
- span: Option<Span>,
681
- kind: &InferSourceKind<'_>,
682
- // We will clear the non-actionable suggestion from the error to reduce noise.
683
- infer_subdiags: &mut Vec<SourceKindSubdiag<'_>>,
684
- ) -> bool {
685
- // FIXME(#129461): We are time-boxing this code in the compiler. It'll start failing
686
- // compilation once we promote 1.89 to beta, which will happen in 9 months from now.
687
- #[cfg(not(version("1.89")))]
688
- const fn version_check() {}
689
- #[cfg(version("1.89"))]
690
- const fn version_check() {
691
- panic!("remove this check as presumably the ecosystem has moved from needing it");
692
- }
693
- const { version_check() };
694
- // Only relevant when building the `time` crate.
695
- if self.infcx.tcx.crate_name(LOCAL_CRATE) == sym::time
696
- && let Some(span) = span
697
- && let InferSourceKind::LetBinding { pattern_name, .. } = kind
698
- && let Some(name) = pattern_name
699
- && name.as_str() == "items"
700
- && let FileName::Real(file) = self.infcx.tcx.sess.source_map().span_to_filename(span)
701
- {
702
- let path = file.local_path_if_available().to_string_lossy();
703
- if path.contains("format_description") && path.contains("parse") {
704
- infer_subdiags.clear();
705
- return true;
706
- }
707
- }
708
- false
709
- }
710
668
}
711
669
712
670
#[derive(Debug)]
0 commit comments