@@ -26,10 +26,7 @@ use rustc_span::DUMMY_SP;
2626
2727use std:: mem;
2828use 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 } ;
3330
3431use crate :: clean;
3532use crate :: clean:: inline:: build_external_trait;
@@ -49,7 +46,7 @@ crate struct DocContext<'tcx> {
4946 /// Used for normalization.
5047 ///
5148 /// Most of this logic is copied from rustc_lint::late.
52- crate param_env : Cell < ParamEnv < ' tcx > > ,
49+ crate param_env : ParamEnv < ' tcx > ,
5350 /// Later on moved into `cache`
5451 crate renderinfo : RefCell < RenderInfo > ,
5552 /// Later on moved through `clean::Crate` into `cache`
@@ -89,9 +86,9 @@ impl<'tcx> DocContext<'tcx> {
8986 }
9087
9188 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) ) ;
9390 let ret = f ( self ) ;
94- self . param_env . set ( old_param_env) ;
91+ self . param_env = old_param_env;
9592 ret
9693 }
9794
@@ -511,7 +508,7 @@ crate fn run_global_ctxt(
511508 let mut ctxt = DocContext {
512509 tcx,
513510 resolver,
514- param_env : Cell :: new ( ParamEnv :: empty ( ) ) ,
511+ param_env : ParamEnv :: empty ( ) ,
515512 external_traits : Default :: default ( ) ,
516513 active_extern_traits : Default :: default ( ) ,
517514 renderinfo : RefCell :: new ( renderinfo) ,
0 commit comments