@@ -10,7 +10,6 @@ use rustc_hir::def::Res;
1010use rustc_hir:: { MatchSource , Node } ;
1111use rustc_middle:: traits:: {
1212 IfExpressionCause , MatchExpressionArmCause , ObligationCause , ObligationCauseCode ,
13- StatementAsExpression ,
1413} ;
1514use rustc_middle:: ty:: error:: TypeError ;
1615use rustc_middle:: ty:: print:: with_no_trimmed_paths;
@@ -26,8 +25,14 @@ use crate::errors::{
2625 SuggestTuplePatternMany , SuggestTuplePatternOne , TypeErrorAdditionalDiags ,
2726} ;
2827
28+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
29+ enum StatementAsExpression {
30+ CorrectType ,
31+ NeedsBoxing ,
32+ }
33+
2934#[ derive( Clone , Copy ) ]
30- pub enum SuggestAsRefKind {
35+ enum SuggestAsRefKind {
3136 Option ,
3237 Result ,
3338}
@@ -382,7 +387,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
382387 }
383388 }
384389
385- pub fn suggest_function_pointers_impl (
390+ pub ( crate ) fn suggest_function_pointers_impl (
386391 & self ,
387392 span : Option < Span > ,
388393 exp_found : & ty:: error:: ExpectedFound < Ty < ' tcx > > ,
@@ -518,7 +523,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
518523 }
519524 }
520525
521- pub fn should_suggest_as_ref_kind (
526+ fn should_suggest_as_ref_kind (
522527 & self ,
523528 expected : Ty < ' tcx > ,
524529 found : Ty < ' tcx > ,
@@ -588,8 +593,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
588593 ) -> Option < TypeErrorAdditionalDiags > {
589594 /// Find the if expression with given span
590595 struct IfVisitor {
591- pub found_if : bool ,
592- pub err_span : Span ,
596+ found_if : bool ,
597+ err_span : Span ,
593598 }
594599
595600 impl < ' v > Visitor < ' v > for IfVisitor {
@@ -736,7 +741,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
736741impl < ' tcx > TypeErrCtxt < ' _ , ' tcx > {
737742 /// Be helpful when the user wrote `{... expr; }` and taking the `;` off
738743 /// is enough to fix the error.
739- pub fn could_remove_semicolon (
744+ fn could_remove_semicolon (
740745 & self ,
741746 blk : & ' tcx hir:: Block < ' tcx > ,
742747 expected_ty : Ty < ' tcx > ,
@@ -816,7 +821,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
816821
817822 /// Suggest returning a local binding with a compatible type if the block
818823 /// has no return expression.
819- pub fn consider_returning_binding_diag (
824+ fn consider_returning_binding_diag (
820825 & self ,
821826 blk : & ' tcx hir:: Block < ' tcx > ,
822827 expected_ty : Ty < ' tcx > ,
0 commit comments