Skip to content

Using deno_ast in a project that contains swc_common -F concurrent breaks the build  #219

Closed
@alshdavid

Description

@alshdavid

I am trying to use deno_ast in my project which also uses swc_common.

I am using it via swc_common = { version = "=0.33.18", features = ["concurrent"] }

With the concurrent feature enabled, the compiler throws:

error[E0277]: `Rc<RefCell<Vec<swc_common::errors::Diagnostic>>>` cannot be sent between threads safely
   --> /home/dalsh/.local/rust/cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_ast-0.34.2/src/transpiling/mod.rs:280:46
    |
280 | 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>>>`
note: required because it appears within the type `DiagnosticCollector`
   --> /home/dalsh/.local/rust/cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_ast-0.34.2/src/transpiling/mod.rs:266:8
    |
266 | struct DiagnosticCollector {
    |        ^^^^^^^^^^^^^^^^^^^
note: required by a bound in `swc_common::errors::Emitter`
   --> /home/dalsh/.local/rust/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_common-0.33.18/src/errors/emitter.rs:39:20
    |
39  | pub trait Emitter: crate::sync::Send {
    |                    ^^^^^^^^^^^^^^^^^ required by this bound in `Emitter` 

Is there any way around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions