diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2024-01-07 19:13:04 -0500 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2024-01-07 19:16:13 -0500 |
| commit | be0293f468b7be1c2fe0128802584d364f36d244 (patch) | |
| tree | 539536213a0b62c7fec0e44bf126ed713b4868ab /compiler/rustc_expand/src | |
| parent | 75c68cfd2b9870f2953b62d250bd7d0564a7b56d (diff) | |
| download | rust-be0293f468b7be1c2fe0128802584d364f36d244.tar.gz rust-be0293f468b7be1c2fe0128802584d364f36d244.zip | |
Remove crossbeam-channel
The standard library's std::sync::mpsc basically is a crossbeam channel, and for the use case here will definitely suffice. This drops this dependency from librustc_driver.
Diffstat (limited to 'compiler/rustc_expand/src')
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs index 73a7d433b5c..448e7bfd732 100644 --- a/compiler/rustc_expand/src/proc_macro.rs +++ b/compiler/rustc_expand/src/proc_macro.rs @@ -13,16 +13,16 @@ use rustc_session::config::ProcMacroExecutionStrategy; use rustc_span::profiling::SpannedEventArgRecorder; use rustc_span::{Span, DUMMY_SP}; -struct CrossbeamMessagePipe<T> { - tx: crossbeam_channel::Sender<T>, - rx: crossbeam_channel::Receiver<T>, +struct MessagePipe<T> { + tx: std::sync::mpsc::SyncSender<T>, + rx: std::sync::mpsc::Receiver<T>, } -impl<T> pm::bridge::server::MessagePipe<T> for CrossbeamMessagePipe<T> { +impl<T> pm::bridge::server::MessagePipe<T> for MessagePipe<T> { fn new() -> (Self, Self) { - let (tx1, rx1) = crossbeam_channel::bounded(1); - let (tx2, rx2) = crossbeam_channel::bounded(1); - (CrossbeamMessagePipe { tx: tx1, rx: rx2 }, CrossbeamMessagePipe { tx: tx2, rx: rx1 }) + let (tx1, rx1) = std::sync::mpsc::sync_channel(1); + let (tx2, rx2) = std::sync::mpsc::sync_channel(1); + (MessagePipe { tx: tx1, rx: rx2 }, MessagePipe { tx: tx2, rx: rx1 }) } fn send(&mut self, value: T) { @@ -35,7 +35,7 @@ impl<T> pm::bridge::server::MessagePipe<T> for CrossbeamMessagePipe<T> { } fn exec_strategy(ecx: &ExtCtxt<'_>) -> impl pm::bridge::server::ExecutionStrategy { - pm::bridge::server::MaybeCrossThread::<CrossbeamMessagePipe<_>>::new( + pm::bridge::server::MaybeCrossThread::<MessagePipe<_>>::new( ecx.sess.opts.unstable_opts.proc_macro_execution_strategy == ProcMacroExecutionStrategy::CrossThread, ) |
