use self::TargetLint::*;
use std::slice;
+use rustc_data_structures::sync::{RwLock, ReadGuard};
use lint::{EarlyLintPassObject, LateLintPassObject};
use lint::{Level, Lint, LintId, LintPass, LintBuffer};
use lint::builtin::BuiltinLintDiagnostics;
use util::nodemap::FxHashMap;
use std::default::Default as StdDefault;
-use std::cell::{Ref, RefCell};
use syntax::ast;
use syntax::edition;
use syntax_pos::{MultiSpan, Span};
pub struct LintSession<'a, PassObject> {
/// Reference to the store of registered lints.
- lints: Ref<'a, LintStore>,
+ lints: ReadGuard<'a, LintStore>,
/// Trait objects for each lint pass.
passes: Option<Vec<PassObject>>,
/// Creates a new `LintSession`, by moving out the `LintStore`'s initial
/// lint levels and pass objects. These can be restored using the `restore`
/// method.
- fn new(store: &'a RefCell<LintStore>) -> LintSession<'a, PassObject> {
+ fn new(store: &'a RwLock<LintStore>) -> LintSession<'a, PassObject> {
let mut s = store.borrow_mut();
let passes = PassObject::take_passes(&mut *s);
drop(s);
}
/// Restores the levels back to the original lint store.
- fn restore(self, store: &RefCell<LintStore>) {
+ fn restore(self, store: &RwLock<LintStore>) {
drop(self.lints);
let mut s = store.borrow_mut();
PassObject::restore_passes(&mut *s, self.passes);