diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2019-01-07 16:25:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-07 16:25:35 +0100 |
| commit | e319f12cf4bfb89b744d83c043fc0ca0dc036080 (patch) | |
| tree | 2740a9f906d676ffb721107e7fb3c6e1052e041d | |
| parent | c89b07aa520517d911aa269bef7f260fa61c6718 (diff) | |
| parent | 75b2e143f125d7e214b8d3e54b3079caba1cc065 (diff) | |
| download | rust-e319f12cf4bfb89b744d83c043fc0ca0dc036080.tar.gz rust-e319f12cf4bfb89b744d83c043fc0ca0dc036080.zip | |
Rollup merge of #57308 - Zoxc:controller-sync, r=michaelwoerister
Make CompileController thread-safe
| -rw-r--r-- | src/librustc_data_structures/sync.rs | 1 | ||||
| -rw-r--r-- | src/librustc_driver/driver.rs | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index d935eb7bdab..c18a5328dd5 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -323,6 +323,7 @@ cfg_if! { } pub fn assert_sync<T: ?Sized + Sync>() {} +pub fn assert_send<T: ?Sized + Send>() {} pub fn assert_send_val<T: ?Sized + Send>(_t: &T) {} pub fn assert_send_sync_val<T: ?Sized + Sync + Send>(_t: &T) {} diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 0204d041a24..bfff592a5dd 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -402,14 +402,15 @@ pub struct CompileController<'a> { /// Allows overriding default rustc query providers, /// after `default_provide` has installed them. - pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a>, + pub provide: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>, /// Same as `provide`, but only for non-local crates, /// applied after `default_provide_extern`. - pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a>, + pub provide_extern: Box<dyn Fn(&mut ty::query::Providers) + 'a + sync::Send>, } impl<'a> CompileController<'a> { pub fn basic() -> CompileController<'a> { + sync::assert_send::<Self>(); CompileController { after_parse: PhaseController::basic(), after_expand: PhaseController::basic(), @@ -499,7 +500,7 @@ pub struct PhaseController<'a> { // If true then the compiler will try to run the callback even if the phase // ends with an error. Note that this is not always possible. pub run_callback_on_error: bool, - pub callback: Box<dyn Fn(&mut CompileState) + 'a>, + pub callback: Box<dyn Fn(&mut CompileState) + 'a + sync::Send>, } impl<'a> PhaseController<'a> { |
