@@ -18,7 +18,7 @@ use rustc_span::{DUMMY_SP, Span};
1818use rustc_trait_selection:: traits:: { ObligationCause , ObligationCtxt } ;
1919use tracing:: debug;
2020
21- use crate :: { FnCtxt , errors } ;
21+ use crate :: { FnCtxt , diagnostics } ;
2222
2323impl < ' tcx > FnCtxt < ' _ , ' tcx > {
2424 /// Performs type inference fallback, setting [`FnCtxt::diverging_fallback_has_occurred`]
@@ -182,7 +182,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
182182 FLOAT_LITERAL_F32_FALLBACK ,
183183 origin. lint_id . unwrap_or ( CRATE_HIR_ID ) ,
184184 origin. span ,
185- errors :: FloatLiteralF32Fallback {
185+ diagnostics :: FloatLiteralF32Fallback {
186186 span : literal. as_ref ( ) . map ( |_| origin. span ) ,
187187 literal : literal. unwrap_or_default ( ) ,
188188 } ,
@@ -312,21 +312,25 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
312312 span,
313313 match reason {
314314 UnsafeUseReason :: Call => {
315- errors :: NeverTypeFallbackFlowingIntoUnsafe :: Call { sugg : sugg. clone ( ) }
315+ diagnostics :: NeverTypeFallbackFlowingIntoUnsafe :: Call { sugg : sugg. clone ( ) }
316316 }
317317 UnsafeUseReason :: Method => {
318- errors:: NeverTypeFallbackFlowingIntoUnsafe :: Method { sugg : sugg. clone ( ) }
318+ diagnostics:: NeverTypeFallbackFlowingIntoUnsafe :: Method {
319+ sugg : sugg. clone ( ) ,
320+ }
319321 }
320322 UnsafeUseReason :: Path => {
321- errors :: NeverTypeFallbackFlowingIntoUnsafe :: Path { sugg : sugg. clone ( ) }
323+ diagnostics :: NeverTypeFallbackFlowingIntoUnsafe :: Path { sugg : sugg. clone ( ) }
322324 }
323325 UnsafeUseReason :: UnionField => {
324- errors :: NeverTypeFallbackFlowingIntoUnsafe :: UnionField {
326+ diagnostics :: NeverTypeFallbackFlowingIntoUnsafe :: UnionField {
325327 sugg : sugg. clone ( ) ,
326328 }
327329 }
328330 UnsafeUseReason :: Deref => {
329- errors:: NeverTypeFallbackFlowingIntoUnsafe :: Deref { sugg : sugg. clone ( ) }
331+ diagnostics:: NeverTypeFallbackFlowingIntoUnsafe :: Deref {
332+ sugg : sugg. clone ( ) ,
333+ }
330334 }
331335 } ,
332336 ) ;
@@ -376,7 +380,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
376380 lint:: builtin:: DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK ,
377381 self . tcx . local_def_id_to_hir_id ( self . body_id ) ,
378382 self . tcx . def_span ( self . body_id ) ,
379- errors :: DependencyOnUnitNeverTypeFallback {
383+ diagnostics :: DependencyOnUnitNeverTypeFallback {
380384 obligation_span : never_error. obligation . cause . span ,
381385 obligation : never_error. obligation . predicate ,
382386 sugg,
@@ -441,7 +445,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
441445 & self ,
442446 diverging_vids : & [ ty:: TyVid ] ,
443447 coercions : & VecGraph < ty:: TyVid , true > ,
444- ) -> errors :: SuggestAnnotations {
448+ ) -> diagnostics :: SuggestAnnotations {
445449 let body =
446450 self . tcx . hir_maybe_body_owned_by ( self . body_id ) . expect ( "body id must have an owner" ) ;
447451 // For each diverging var, look through the HIR for a place to give it
@@ -458,7 +462,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
458462 . break_value ( )
459463 } )
460464 . collect ( ) ;
461- errors :: SuggestAnnotations { suggestions }
465+ diagnostics :: SuggestAnnotations { suggestions }
462466 }
463467}
464468
@@ -479,7 +483,7 @@ impl<'tcx> AnnotateUnitFallbackVisitor<'_, 'tcx> {
479483 arg_segment : & ' tcx hir:: PathSegment < ' tcx > ,
480484 def_id : DefId ,
481485 id : HirId ,
482- ) -> ControlFlow < errors :: SuggestAnnotation > {
486+ ) -> ControlFlow < diagnostics :: SuggestAnnotation > {
483487 if arg_segment. args . is_none ( )
484488 && let Some ( all_args) = self . fcx . typeck_results . borrow ( ) . node_args_opt ( id)
485489 && let generics = self . fcx . tcx . generics_of ( def_id)
@@ -497,7 +501,7 @@ impl<'tcx> AnnotateUnitFallbackVisitor<'_, 'tcx> {
497501 && let Some ( vid) = self . fcx . root_vid ( ty)
498502 && self . reachable_vids . contains ( & vid)
499503 {
500- return ControlFlow :: Break ( errors :: SuggestAnnotation :: Turbo (
504+ return ControlFlow :: Break ( diagnostics :: SuggestAnnotation :: Turbo (
501505 arg_segment. ident . span . shrink_to_hi ( ) ,
502506 n_tys,
503507 idx,
@@ -509,7 +513,7 @@ impl<'tcx> AnnotateUnitFallbackVisitor<'_, 'tcx> {
509513 }
510514}
511515impl < ' tcx > Visitor < ' tcx > for AnnotateUnitFallbackVisitor < ' _ , ' tcx > {
512- type Result = ControlFlow < errors :: SuggestAnnotation > ;
516+ type Result = ControlFlow < diagnostics :: SuggestAnnotation > ;
513517
514518 fn visit_infer (
515519 & mut self ,
@@ -523,7 +527,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
523527 && self . reachable_vids . contains ( & vid)
524528 && inf_span. can_be_used_for_suggestions ( )
525529 {
526- return ControlFlow :: Break ( errors :: SuggestAnnotation :: Unit ( inf_span) ) ;
530+ return ControlFlow :: Break ( diagnostics :: SuggestAnnotation :: Unit ( inf_span) ) ;
527531 }
528532
529533 ControlFlow :: Continue ( ( ) )
@@ -570,7 +574,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
570574 && expr. span . can_be_used_for_suggestions ( )
571575 {
572576 let span = path. span . shrink_to_lo ( ) . to ( trait_segment. ident . span ) ;
573- return ControlFlow :: Break ( errors :: SuggestAnnotation :: Path ( span) ) ;
577+ return ControlFlow :: Break ( diagnostics :: SuggestAnnotation :: Path ( span) ) ;
574578 }
575579
576580 // Or else, try suggesting turbofishing the method args.
@@ -594,7 +598,7 @@ impl<'tcx> Visitor<'tcx> for AnnotateUnitFallbackVisitor<'_, 'tcx> {
594598 && self . reachable_vids . contains ( & vid)
595599 && local. span . can_be_used_for_suggestions ( )
596600 {
597- return ControlFlow :: Break ( errors :: SuggestAnnotation :: Local (
601+ return ControlFlow :: Break ( diagnostics :: SuggestAnnotation :: Local (
598602 local. pat . span . shrink_to_hi ( ) ,
599603 ) ) ;
600604 }
0 commit comments