2727use self :: TargetLint :: * ;
2828
2929use std:: slice;
30+ use rustc_data_structures:: sync:: { RwLock , ReadGuard } ;
3031use lint:: { EarlyLintPassObject , LateLintPassObject } ;
3132use lint:: { Level , Lint , LintId , LintPass , LintBuffer } ;
3233use lint:: builtin:: BuiltinLintDiagnostics ;
@@ -39,7 +40,6 @@ use ty::layout::{LayoutError, LayoutOf, TyLayout};
3940use util:: nodemap:: FxHashMap ;
4041
4142use std:: default:: Default as StdDefault ;
42- use std:: cell:: { Ref , RefCell } ;
4343use syntax:: ast;
4444use syntax:: edition;
4545use syntax_pos:: { MultiSpan , Span } ;
@@ -78,7 +78,7 @@ pub struct LintStore {
7878
7979pub struct LintSession < ' a , PassObject > {
8080 /// Reference to the store of registered lints.
81- lints : Ref < ' a , LintStore > ,
81+ lints : ReadGuard < ' a , LintStore > ,
8282
8383 /// Trait objects for each lint pass.
8484 passes : Option < Vec < PassObject > > ,
@@ -336,7 +336,7 @@ impl<'a, PassObject: LintPassObject> LintSession<'a, PassObject> {
336336 /// Creates a new `LintSession`, by moving out the `LintStore`'s initial
337337 /// lint levels and pass objects. These can be restored using the `restore`
338338 /// method.
339- fn new ( store : & ' a RefCell < LintStore > ) -> LintSession < ' a , PassObject > {
339+ fn new ( store : & ' a RwLock < LintStore > ) -> LintSession < ' a , PassObject > {
340340 let mut s = store. borrow_mut ( ) ;
341341 let passes = PassObject :: take_passes ( & mut * s) ;
342342 drop ( s) ;
@@ -347,7 +347,7 @@ impl<'a, PassObject: LintPassObject> LintSession<'a, PassObject> {
347347 }
348348
349349 /// Restores the levels back to the original lint store.
350- fn restore ( self , store : & RefCell < LintStore > ) {
350+ fn restore ( self , store : & RwLock < LintStore > ) {
351351 drop ( self . lints ) ;
352352 let mut s = store. borrow_mut ( ) ;
353353 PassObject :: restore_passes ( & mut * s, self . passes ) ;
0 commit comments