@@ -14,13 +14,13 @@ use rustc_trait_selection::traits::ObligationCause;
14
14
use rustc_trait_selection:: traits:: query:: evaluate_obligation:: InferCtxtExt ;
15
15
use tracing:: { debug, instrument, trace} ;
16
16
17
- use super :: PatCtxt ;
17
+ use super :: PatCx ;
18
18
use crate :: errors:: {
19
19
ConstPatternDependsOnGenericParameter , CouldNotEvalConstPattern , InvalidPattern , NaNPattern ,
20
20
PointerPattern , TypeNotPartialEq , TypeNotStructural , UnionPattern , UnsizedPattern ,
21
21
} ;
22
22
23
- impl < ' a , ' tcx > PatCtxt < ' a , ' tcx > {
23
+ impl < ' a , ' tcx > PatCx < ' a , ' tcx > {
24
24
/// Converts a constant to a pattern (if possible).
25
25
/// This means aggregate values (like structs and enums) are converted
26
26
/// to a pattern that matches the value (as if you'd compared via structural equality).
@@ -36,7 +36,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
36
36
id : hir:: HirId ,
37
37
span : Span ,
38
38
) -> Box < Pat < ' tcx > > {
39
- let infcx = self . tcx . infer_ctxt ( ) . build ( ) ;
39
+ let infcx = self . cx . tcx . infer_ctxt ( ) . build ( ) ;
40
40
let mut convert = ConstToPat :: new ( self , id, span, infcx) ;
41
41
convert. to_pat ( c, ty)
42
42
}
@@ -54,19 +54,15 @@ struct ConstToPat<'tcx> {
54
54
}
55
55
56
56
impl < ' tcx > ConstToPat < ' tcx > {
57
- fn new (
58
- pat_ctxt : & PatCtxt < ' _ , ' tcx > ,
59
- id : hir:: HirId ,
60
- span : Span ,
61
- infcx : InferCtxt < ' tcx > ,
62
- ) -> Self {
63
- trace ! ( ?pat_ctxt. typeck_results. hir_owner) ;
57
+ fn new ( pat_ctxt : & PatCx < ' _ , ' tcx > , id : hir:: HirId , span : Span , infcx : InferCtxt < ' tcx > ) -> Self {
58
+ trace ! ( ?pat_ctxt. cx. typeck_results. hir_owner) ;
64
59
ConstToPat {
65
60
id,
66
61
span,
67
62
infcx,
68
- param_env : pat_ctxt. param_env ,
63
+ param_env : pat_ctxt. cx . param_env ,
69
64
treat_byte_string_as_slice : pat_ctxt
65
+ . cx
70
66
. typeck_results
71
67
. treat_byte_string_as_slice
72
68
. contains ( & id. local_id ) ,
0 commit comments