1
- use super :: callee:: { self , DeferredCallResolution } ;
2
- use super :: method:: { self , MethodCallee , SelfSource } ;
3
- use super :: { BreakableCtxt , Diverges , Expectation , FallbackMode , FnCtxt , LocalTy } ;
4
1
use crate :: astconv:: {
5
2
AstConv , ExplicitLateBound , GenericArgCountMismatch , GenericArgCountResult , PathSeg ,
6
3
} ;
4
+ use crate :: check:: callee:: { self , DeferredCallResolution } ;
5
+ use crate :: check:: method:: { self , MethodCallee , SelfSource } ;
6
+ use crate :: check:: { BreakableCtxt , Diverges , Expectation , FallbackMode , FnCtxt , LocalTy } ;
7
7
8
8
use rustc_data_structures:: captures:: Captures ;
9
9
use rustc_data_structures:: fx:: FxHashSet ;
@@ -41,7 +41,7 @@ use std::slice;
41
41
impl < ' a , ' tcx > FnCtxt < ' a , ' tcx > {
42
42
/// Produces warning on the given node, if the current point in the
43
43
/// function is unreachable, and there hasn't been another warning.
44
- pub ( super ) fn warn_if_unreachable ( & self , id : hir:: HirId , span : Span , kind : & str ) {
44
+ pub ( in super :: super ) fn warn_if_unreachable ( & self , id : hir:: HirId , span : Span , kind : & str ) {
45
45
// FIXME: Combine these two 'if' expressions into one once
46
46
// let chains are implemented
47
47
if let Diverges :: Always { span : orig_span, custom_note } = self . diverges . get ( ) {
@@ -75,7 +75,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
75
75
/// version (resolve_vars_if_possible), this version will
76
76
/// also select obligations if it seems useful, in an effort
77
77
/// to get more type information.
78
- pub ( super ) fn resolve_vars_with_obligations ( & self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
78
+ pub ( in super :: super ) fn resolve_vars_with_obligations ( & self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
79
79
debug ! ( "resolve_vars_with_obligations(ty={:?})" , ty) ;
80
80
81
81
// No Infer()? Nothing needs doing.
@@ -102,7 +102,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
102
102
ty
103
103
}
104
104
105
- pub ( super ) fn record_deferred_call_resolution (
105
+ pub ( in super :: super ) fn record_deferred_call_resolution (
106
106
& self ,
107
107
closure_def_id : DefId ,
108
108
r : DeferredCallResolution < ' tcx > ,
@@ -111,7 +111,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
111
111
deferred_call_resolutions. entry ( closure_def_id) . or_default ( ) . push ( r) ;
112
112
}
113
113
114
- pub ( super ) fn remove_deferred_call_resolutions (
114
+ pub ( in super :: super ) fn remove_deferred_call_resolutions (
115
115
& self ,
116
116
closure_def_id : DefId ,
117
117
) -> Vec < DeferredCallResolution < ' tcx > > {
@@ -149,7 +149,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
149
149
self . typeck_results . borrow_mut ( ) . field_indices_mut ( ) . insert ( hir_id, index) ;
150
150
}
151
151
152
- pub ( super ) fn write_resolution (
152
+ pub ( in super :: super ) fn write_resolution (
153
153
& self ,
154
154
hir_id : hir:: HirId ,
155
155
r : Result < ( DefKind , DefId ) , ErrorReported > ,
@@ -335,7 +335,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
335
335
336
336
/// As `instantiate_type_scheme`, but for the bounds found in a
337
337
/// generic type scheme.
338
- pub ( super ) fn instantiate_bounds (
338
+ pub ( in super :: super ) fn instantiate_bounds (
339
339
& self ,
340
340
span : Span ,
341
341
def_id : DefId ,
@@ -355,7 +355,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
355
355
/// Replaces the opaque types from the given value with type variables,
356
356
/// and records the `OpaqueTypeMap` for later use during writeback. See
357
357
/// `InferCtxt::instantiate_opaque_types` for more details.
358
- pub ( super ) fn instantiate_opaque_types_from_value < T : TypeFoldable < ' tcx > > (
358
+ pub ( in super :: super ) fn instantiate_opaque_types_from_value < T : TypeFoldable < ' tcx > > (
359
359
& self ,
360
360
parent_id : hir:: HirId ,
361
361
value : & T ,
@@ -386,14 +386,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
386
386
value
387
387
}
388
388
389
- pub ( super ) fn normalize_associated_types_in < T > ( & self , span : Span , value : & T ) -> T
389
+ pub ( in super :: super ) fn normalize_associated_types_in < T > ( & self , span : Span , value : & T ) -> T
390
390
where
391
391
T : TypeFoldable < ' tcx > ,
392
392
{
393
393
self . inh . normalize_associated_types_in ( span, self . body_id , self . param_env , value)
394
394
}
395
395
396
- pub ( super ) fn normalize_associated_types_in_as_infer_ok < T > (
396
+ pub ( in super :: super ) fn normalize_associated_types_in_as_infer_ok < T > (
397
397
& self ,
398
398
span : Span ,
399
399
value : & T ,
@@ -600,11 +600,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
600
600
self . normalize_associated_types_in ( span, & field. ty ( self . tcx , substs) )
601
601
}
602
602
603
- pub ( super ) fn resolve_generator_interiors ( & self , def_id : DefId ) {
603
+ pub ( in super :: super ) fn resolve_generator_interiors ( & self , def_id : DefId ) {
604
604
let mut generators = self . deferred_generator_interiors . borrow_mut ( ) ;
605
605
for ( body_id, interior, kind) in generators. drain ( ..) {
606
606
self . select_obligations_where_possible ( false , |_| { } ) ;
607
- super :: generator_interior:: resolve_interior ( self , def_id, body_id, interior, kind) ;
607
+ crate :: check:: generator_interior:: resolve_interior (
608
+ self , def_id, body_id, interior, kind,
609
+ ) ;
608
610
}
609
611
}
610
612
@@ -620,7 +622,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
620
622
// Fallback becomes very dubious if we have encountered type-checking errors.
621
623
// In that case, fallback to Error.
622
624
// The return value indicates whether fallback has occurred.
623
- pub ( super ) fn fallback_if_possible ( & self , ty : Ty < ' tcx > , mode : FallbackMode ) -> bool {
625
+ pub ( in super :: super ) fn fallback_if_possible ( & self , ty : Ty < ' tcx > , mode : FallbackMode ) -> bool {
624
626
use rustc_middle:: ty:: error:: UnconstrainedNumeric :: Neither ;
625
627
use rustc_middle:: ty:: error:: UnconstrainedNumeric :: { UnconstrainedFloat , UnconstrainedInt } ;
626
628
@@ -685,15 +687,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
685
687
true
686
688
}
687
689
688
- pub ( super ) fn select_all_obligations_or_error ( & self ) {
690
+ pub ( in super :: super ) fn select_all_obligations_or_error ( & self ) {
689
691
debug ! ( "select_all_obligations_or_error" ) ;
690
692
if let Err ( errors) = self . fulfillment_cx . borrow_mut ( ) . select_all_or_error ( & self ) {
691
693
self . report_fulfillment_errors ( & errors, self . inh . body_id , false ) ;
692
694
}
693
695
}
694
696
695
697
/// Select as many obligations as we can at present.
696
- pub ( super ) fn select_obligations_where_possible (
698
+ pub ( in super :: super ) fn select_obligations_where_possible (
697
699
& self ,
698
700
fallback_has_occurred : bool ,
699
701
mutate_fullfillment_errors : impl Fn ( & mut Vec < traits:: FulfillmentError < ' tcx > > ) ,
@@ -709,7 +711,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
709
711
/// returns a type of `&T`, but the actual type we assign to the
710
712
/// *expression* is `T`. So this function just peels off the return
711
713
/// type by one layer to yield `T`.
712
- pub ( super ) fn make_overloaded_place_return_type (
714
+ pub ( in super :: super ) fn make_overloaded_place_return_type (
713
715
& self ,
714
716
method : MethodCallee < ' tcx > ,
715
717
) -> ty:: TypeAndMut < ' tcx > {
@@ -742,7 +744,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
742
744
}
743
745
}
744
746
745
- pub ( super ) fn obligations_for_self_ty < ' b > (
747
+ pub ( in super :: super ) fn obligations_for_self_ty < ' b > (
746
748
& ' b self ,
747
749
self_ty : ty:: TyVid ,
748
750
) -> impl Iterator < Item = ( ty:: PolyTraitRef < ' tcx > , traits:: PredicateObligation < ' tcx > ) >
@@ -792,18 +794,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
792
794
. filter ( move |( tr, _) | self . self_type_matches_expected_vid ( * tr, ty_var_root) )
793
795
}
794
796
795
- pub ( super ) fn type_var_is_sized ( & self , self_ty : ty:: TyVid ) -> bool {
797
+ pub ( in super :: super ) fn type_var_is_sized ( & self , self_ty : ty:: TyVid ) -> bool {
796
798
self . obligations_for_self_ty ( self_ty)
797
799
. any ( |( tr, _) | Some ( tr. def_id ( ) ) == self . tcx . lang_items ( ) . sized_trait ( ) )
798
800
}
799
801
800
- pub ( super ) fn err_args ( & self , len : usize ) -> Vec < Ty < ' tcx > > {
802
+ pub ( in super :: super ) fn err_args ( & self , len : usize ) -> Vec < Ty < ' tcx > > {
801
803
vec ! [ self . tcx. ty_error( ) ; len]
802
804
}
803
805
804
806
/// Unifies the output type with the expected type early, for more coercions
805
807
/// and forward type information on the input expressions.
806
- pub ( super ) fn expected_inputs_for_expected_output (
808
+ pub ( in super :: super ) fn expected_inputs_for_expected_output (
807
809
& self ,
808
810
call_span : Span ,
809
811
expected_ret : Expectation < ' tcx > ,
@@ -856,7 +858,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
856
858
expect_args
857
859
}
858
860
859
- pub ( super ) fn resolve_lang_item_path (
861
+ pub ( in super :: super ) fn resolve_lang_item_path (
860
862
& self ,
861
863
lang_item : hir:: LangItem ,
862
864
span : Span ,
@@ -937,7 +939,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
937
939
}
938
940
939
941
/// Given a function `Node`, return its `FnDecl` if it exists, or `None` otherwise.
940
- pub ( super ) fn get_node_fn_decl (
942
+ pub ( in super :: super ) fn get_node_fn_decl (
941
943
& self ,
942
944
node : Node < ' tcx > ,
943
945
) -> Option < ( & ' tcx hir:: FnDecl < ' tcx > , Ident , bool ) > {
@@ -973,7 +975,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
973
975
} )
974
976
}
975
977
976
- pub ( super ) fn note_internal_mutation_in_method (
978
+ pub ( in super :: super ) fn note_internal_mutation_in_method (
977
979
& self ,
978
980
err : & mut DiagnosticBuilder < ' _ > ,
979
981
expr : & hir:: Expr < ' _ > ,
@@ -1018,7 +1020,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1018
1020
}
1019
1021
}
1020
1022
1021
- pub ( super ) fn note_need_for_fn_pointer (
1023
+ pub ( in super :: super ) fn note_need_for_fn_pointer (
1022
1024
& self ,
1023
1025
err : & mut DiagnosticBuilder < ' _ > ,
1024
1026
expected : Ty < ' tcx > ,
@@ -1055,7 +1057,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1055
1057
) ) ;
1056
1058
}
1057
1059
1058
- pub ( super ) fn could_remove_semicolon (
1060
+ pub ( in super :: super ) fn could_remove_semicolon (
1059
1061
& self ,
1060
1062
blk : & ' tcx hir:: Block < ' tcx > ,
1061
1063
expected_ty : Ty < ' tcx > ,
@@ -1404,7 +1406,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1404
1406
}
1405
1407
}
1406
1408
1407
- pub ( super ) fn with_breakable_ctxt < F : FnOnce ( ) -> R , R > (
1409
+ pub ( in super :: super ) fn with_breakable_ctxt < F : FnOnce ( ) -> R , R > (
1408
1410
& self ,
1409
1411
id : hir:: HirId ,
1410
1412
ctxt : BreakableCtxt < ' tcx > ,
@@ -1429,7 +1431,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1429
1431
1430
1432
/// Instantiate a QueryResponse in a probe context, without a
1431
1433
/// good ObligationCause.
1432
- pub ( super ) fn probe_instantiate_query_response (
1434
+ pub ( in super :: super ) fn probe_instantiate_query_response (
1433
1435
& self ,
1434
1436
span : Span ,
1435
1437
original_values : & OriginalQueryValues < ' tcx > ,
@@ -1444,7 +1446,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1444
1446
}
1445
1447
1446
1448
/// Returns `true` if an expression is contained inside the LHS of an assignment expression.
1447
- pub ( super ) fn expr_in_place ( & self , mut expr_id : hir:: HirId ) -> bool {
1449
+ pub ( in super :: super ) fn expr_in_place ( & self , mut expr_id : hir:: HirId ) -> bool {
1448
1450
let mut contained_in_place = false ;
1449
1451
1450
1452
while let hir:: Node :: Expr ( parent_expr) =
0 commit comments