@@ -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;
@@ -18,7 +18,7 @@ use rustc_middle::ty::{
18
18
TypeFoldable , TypeFolder , TypeSuperFoldable , TypeckResults ,
19
19
} ;
20
20
use rustc_span:: symbol:: { Ident , sym} ;
21
- use rustc_span:: { BytePos , DUMMY_SP , FileName , Span } ;
21
+ use rustc_span:: { BytePos , DUMMY_SP , Span } ;
22
22
use tracing:: { debug, instrument, warn} ;
23
23
24
24
use crate :: error_reporting:: TypeErrCtxt ;
@@ -385,7 +385,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
385
385
bad_label,
386
386
was_written : false ,
387
387
path : Default :: default ( ) ,
388
- time_version : false ,
389
388
} ) ,
390
389
TypeAnnotationNeeded :: E0283 => self . dcx ( ) . create_err ( AmbiguousImpl {
391
390
span,
@@ -576,10 +575,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
576
575
}
577
576
}
578
577
}
579
-
580
- let time_version =
581
- self . detect_old_time_crate_version ( failure_span, & kind, & mut infer_subdiags) ;
582
-
583
578
match error_code {
584
579
TypeAnnotationNeeded :: E0282 => self . dcx ( ) . create_err ( AnnotationRequired {
585
580
span,
@@ -591,7 +586,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
591
586
bad_label : None ,
592
587
was_written : path. is_some ( ) ,
593
588
path : path. unwrap_or_default ( ) ,
594
- time_version,
595
589
} ) ,
596
590
TypeAnnotationNeeded :: E0283 => self . dcx ( ) . create_err ( AmbiguousImpl {
597
591
span,
@@ -617,42 +611,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
617
611
} ) ,
618
612
}
619
613
}
620
-
621
- /// Detect the inference regression on crate `time` <= 0.3.35 and emit a more targeted error.
622
- /// <https://github.com/rust-lang/rust/issues/127343>
623
- // FIXME: we should figure out a more generic version of doing this, ideally in cargo itself.
624
- fn detect_old_time_crate_version (
625
- & self ,
626
- span : Option < Span > ,
627
- kind : & InferSourceKind < ' _ > ,
628
- // We will clear the non-actionable suggestion from the error to reduce noise.
629
- infer_subdiags : & mut Vec < SourceKindSubdiag < ' _ > > ,
630
- ) -> bool {
631
- // FIXME(#129461): We are time-boxing this code in the compiler. It'll start failing
632
- // compilation once we promote 1.89 to beta, which will happen in 9 months from now.
633
- #[ cfg( not( version( "1.89" ) ) ) ]
634
- const fn version_check ( ) { }
635
- #[ cfg( version( "1.89" ) ) ]
636
- const fn version_check ( ) {
637
- panic ! ( "remove this check as presumably the ecosystem has moved from needing it" ) ;
638
- }
639
- const { version_check ( ) } ;
640
- // Only relevant when building the `time` crate.
641
- if self . infcx . tcx . crate_name ( LOCAL_CRATE ) == sym:: time
642
- && let Some ( span) = span
643
- && let InferSourceKind :: LetBinding { pattern_name, .. } = kind
644
- && let Some ( name) = pattern_name
645
- && name. as_str ( ) == "items"
646
- && let FileName :: Real ( file) = self . infcx . tcx . sess . source_map ( ) . span_to_filename ( span)
647
- {
648
- let path = file. local_path_if_available ( ) . to_string_lossy ( ) ;
649
- if path. contains ( "format_description" ) && path. contains ( "parse" ) {
650
- infer_subdiags. clear ( ) ;
651
- return true ;
652
- }
653
- }
654
- false
655
- }
656
614
}
657
615
658
616
#[ derive( Debug ) ]
0 commit comments