denoland / deno_ast

Source text parsing, lexing, and AST related functionality for Deno
https://crates.io/crates/deno_ast
MIT License
144 stars 43 forks source link

Support concurrent `swc_common` via feature #250

Open spence opened 2 months ago

spence commented 2 months ago

When using swc_common with feature = ["concurrent"], deno_ast fails to compile.

error[E0277]: `Rc<RefCell<Vec<swc_common::errors::Diagnostic>>>` cannot be sent between threads safely
   --> .../deno_ast-0.38.2/src/transpiling/mod.rs:324:46
    |
324 | impl crate::swc::common::errors::Emitter for DiagnosticCollector {
    |                                              ^^^^^^^^^^^^^^^^^^^ 
    |    `Rc<RefCell<Vec<swc_common::errors::Diagnostic>>>` cannot be sent between threads safely
    |
    = help: within `DiagnosticCollector`, the trait `Send` is not implemented for 
      `Rc<RefCell<Vec<swc_common::errors::Diagnostic>>>`, which is required by `DiagnosticCollector: Send`

error[E0308]: mismatched types
  --> .../deno_ast-0.38.2/src/emit.rs:79:7
   |
78 |     let mut writer = Box::new(JsWriter::new(
   |                               ------------- arguments to this function are incorrect
79 |       source_map.clone(),
   |       ^^^^^^^^^^^^^^^^^^ expected `Arc<SourceMap>`, found `Rc<SourceMap>`
   |
   = note: expected struct `Arc<swc_common::SourceMap>`
              found struct `Rc<swc_common::SourceMap>`

Resolves #219

cc @dsherret

CLAassistant commented 2 months ago

CLA assistant check
All committers have signed the CLA.