Replace a lock with an atomic

This commit is contained in:
Oli Scherer 2023-03-14 11:46:48 +00:00
parent aad33198ff
commit c7a3a943f2
3 changed files with 11 additions and 6 deletions

View file

@ -29,6 +29,7 @@ use rustc_ast::{Async, AttrArgs, AttrArgsEq, Expr, ExprKind, MacDelimiter, Mutab
use rustc_ast::{HasAttrs, HasTokens, Unsafe, Visibility, VisibilityKind};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Ordering;
use rustc_errors::PResult;
use rustc_errors::{
Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError, IntoDiagnostic, MultiSpan,
@ -1540,8 +1541,12 @@ pub(crate) fn make_unclosed_delims_error(
}
pub fn emit_unclosed_delims(unclosed_delims: &mut Vec<UnmatchedDelim>, sess: &ParseSess) {
*sess.reached_eof.borrow_mut() |=
unclosed_delims.iter().any(|unmatched_delim| unmatched_delim.found_delim.is_none());
let _ = sess.reached_eof.compare_exchange(
false,
unclosed_delims.iter().any(|unmatched_delim| unmatched_delim.found_delim.is_none()),
Ordering::Relaxed,
Ordering::Relaxed,
);
for unmatched in unclosed_delims.drain(..) {
if let Some(mut e) = make_unclosed_delims_error(unmatched, sess) {
e.emit();