Skip to content

Commit

Permalink
Protect error handler fields with single lock
Browse files Browse the repository at this point in the history
This avoids concurrency-related bugs when locks are acquired for too
short a time and similar cases.
  • Loading branch information
Mark-Simulacrum committed Sep 17, 2019
1 parent 2a767ee commit 4cc5aaa
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 135 deletions.
6 changes: 3 additions & 3 deletions src/librustc/session/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn test_can_print_warnings() {
let registry = errors::registry::Registry::new(&[]);
let (sessopts, _) = build_session_options_and_crate_config(&matches);
let sess = build_session(sessopts, None, registry);
assert!(!sess.diagnostic().flags.can_emit_warnings);
assert!(!sess.diagnostic().can_emit_warnings());
});

syntax::with_default_globals(|| {
Expand All @@ -97,15 +97,15 @@ fn test_can_print_warnings() {
let registry = errors::registry::Registry::new(&[]);
let (sessopts, _) = build_session_options_and_crate_config(&matches);
let sess = build_session(sessopts, None, registry);
assert!(sess.diagnostic().flags.can_emit_warnings);
assert!(sess.diagnostic().can_emit_warnings());
});

syntax::with_default_globals(|| {
let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
let registry = errors::registry::Registry::new(&[]);
let (sessopts, _) = build_session_options_and_crate_config(&matches);
let sess = build_session(sessopts, None, registry);
assert!(sess.diagnostic().flags.can_emit_warnings);
assert!(sess.diagnostic().can_emit_warnings());
});
}

Expand Down
Loading

0 comments on commit 4cc5aaa

Please sign in to comment.