@@ -10,7 +10,6 @@ use rustc_hir::def::Res;
10
10
use rustc_hir:: { MatchSource , Node } ;
11
11
use rustc_middle:: traits:: {
12
12
IfExpressionCause , MatchExpressionArmCause , ObligationCause , ObligationCauseCode ,
13
- StatementAsExpression ,
14
13
} ;
15
14
use rustc_middle:: ty:: error:: TypeError ;
16
15
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
@@ -26,8 +25,14 @@ use crate::errors::{
26
25
SuggestTuplePatternMany , SuggestTuplePatternOne , TypeErrorAdditionalDiags ,
27
26
} ;
28
27
28
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash ) ]
29
+ enum StatementAsExpression {
30
+ CorrectType ,
31
+ NeedsBoxing ,
32
+ }
33
+
29
34
#[ derive( Clone , Copy ) ]
30
- pub enum SuggestAsRefKind {
35
+ enum SuggestAsRefKind {
31
36
Option ,
32
37
Result ,
33
38
}
@@ -382,7 +387,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
382
387
}
383
388
}
384
389
385
- pub fn suggest_function_pointers_impl (
390
+ pub ( crate ) fn suggest_function_pointers_impl (
386
391
& self ,
387
392
span : Option < Span > ,
388
393
exp_found : & ty:: error:: ExpectedFound < Ty < ' tcx > > ,
@@ -518,7 +523,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
518
523
}
519
524
}
520
525
521
- pub fn should_suggest_as_ref_kind (
526
+ fn should_suggest_as_ref_kind (
522
527
& self ,
523
528
expected : Ty < ' tcx > ,
524
529
found : Ty < ' tcx > ,
@@ -588,8 +593,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
588
593
) -> Option < TypeErrorAdditionalDiags > {
589
594
/// Find the if expression with given span
590
595
struct IfVisitor {
591
- pub found_if : bool ,
592
- pub err_span : Span ,
596
+ found_if : bool ,
597
+ err_span : Span ,
593
598
}
594
599
595
600
impl < ' v > Visitor < ' v > for IfVisitor {
@@ -736,7 +741,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
736
741
impl < ' tcx > TypeErrCtxt < ' _ , ' tcx > {
737
742
/// Be helpful when the user wrote `{... expr; }` and taking the `;` off
738
743
/// is enough to fix the error.
739
- pub fn could_remove_semicolon (
744
+ fn could_remove_semicolon (
740
745
& self ,
741
746
blk : & ' tcx hir:: Block < ' tcx > ,
742
747
expected_ty : Ty < ' tcx > ,
@@ -816,7 +821,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
816
821
817
822
/// Suggest returning a local binding with a compatible type if the block
818
823
/// has no return expression.
819
- pub fn consider_returning_binding_diag (
824
+ fn consider_returning_binding_diag (
820
825
& self ,
821
826
blk : & ' tcx hir:: Block < ' tcx > ,
822
827
expected_ty : Ty < ' tcx > ,
0 commit comments