@@ -26,10 +26,7 @@ use rustc_span::DUMMY_SP;
26
26
27
27
use std:: mem;
28
28
use std:: rc:: Rc ;
29
- use std:: {
30
- cell:: { Cell , RefCell } ,
31
- collections:: hash_map:: Entry ,
32
- } ;
29
+ use std:: { cell:: RefCell , collections:: hash_map:: Entry } ;
33
30
34
31
use crate :: clean;
35
32
use crate :: clean:: inline:: build_external_trait;
@@ -49,7 +46,7 @@ crate struct DocContext<'tcx> {
49
46
/// Used for normalization.
50
47
///
51
48
/// Most of this logic is copied from rustc_lint::late.
52
- crate param_env : Cell < ParamEnv < ' tcx > > ,
49
+ crate param_env : ParamEnv < ' tcx > ,
53
50
/// Later on moved into `cache`
54
51
crate renderinfo : RefCell < RenderInfo > ,
55
52
/// Later on moved through `clean::Crate` into `cache`
@@ -89,9 +86,9 @@ impl<'tcx> DocContext<'tcx> {
89
86
}
90
87
91
88
crate fn with_param_env < T , F : FnOnce ( & mut Self ) -> T > ( & mut self , def_id : DefId , f : F ) -> T {
92
- let old_param_env = self . param_env . replace ( self . tcx . param_env ( def_id) ) ;
89
+ let old_param_env = mem :: replace ( & mut self . param_env , self . tcx . param_env ( def_id) ) ;
93
90
let ret = f ( self ) ;
94
- self . param_env . set ( old_param_env) ;
91
+ self . param_env = old_param_env;
95
92
ret
96
93
}
97
94
@@ -511,7 +508,7 @@ crate fn run_global_ctxt(
511
508
let mut ctxt = DocContext {
512
509
tcx,
513
510
resolver,
514
- param_env : Cell :: new ( ParamEnv :: empty ( ) ) ,
511
+ param_env : ParamEnv :: empty ( ) ,
515
512
external_traits : Default :: default ( ) ,
516
513
active_extern_traits : Default :: default ( ) ,
517
514
renderinfo : RefCell :: new ( renderinfo) ,
0 commit comments