@@ -6,7 +6,7 @@ use rustc_errors::codes::*;
66use rustc_errors:: { Diag , IntoDiagArg } ;
77use rustc_hir as hir;
88use 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 } ;
1010use rustc_hir:: intravisit:: { self , Visitor } ;
1111use rustc_hir:: { Body , Closure , Expr , ExprKind , FnRetTy , HirId , LetStmt , LocalSource } ;
1212use rustc_middle:: bug;
@@ -17,7 +17,7 @@ use rustc_middle::ty::{
1717 self , GenericArg , GenericArgKind , GenericArgsRef , InferConst , IsSuggestable , Term , TermKind ,
1818 Ty , TyCtxt , TypeFoldable , TypeFolder , TypeSuperFoldable , TypeVisitableExt , TypeckResults ,
1919} ;
20- use rustc_span:: { BytePos , DUMMY_SP , FileName , Ident , Span , sym} ;
20+ use rustc_span:: { BytePos , DUMMY_SP , Ident , Span , sym} ;
2121use tracing:: { debug, instrument, warn} ;
2222
2323use super :: nice_region_error:: placeholder_error:: Highlighted ;
@@ -438,7 +438,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
438438 bad_label,
439439 was_written : false ,
440440 path : Default :: default ( ) ,
441- time_version : false ,
442441 } ) ,
443442 TypeAnnotationNeeded :: E0283 => self . dcx ( ) . create_err ( AmbiguousImpl {
444443 span,
@@ -630,10 +629,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
630629 }
631630 }
632631 }
633-
634- let time_version =
635- self . detect_old_time_crate_version ( failure_span, & kind, & mut infer_subdiags) ;
636-
637632 match error_code {
638633 TypeAnnotationNeeded :: E0282 => self . dcx ( ) . create_err ( AnnotationRequired {
639634 span,
@@ -645,7 +640,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
645640 bad_label : None ,
646641 was_written : path. is_some ( ) ,
647642 path : path. unwrap_or_default ( ) ,
648- time_version,
649643 } ) ,
650644 TypeAnnotationNeeded :: E0283 => self . dcx ( ) . create_err ( AmbiguousImpl {
651645 span,
@@ -671,42 +665,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
671665 } ) ,
672666 }
673667 }
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- }
710668}
711669
712670#[ derive( Debug ) ]
0 commit comments