Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "the trait bound proc_macro2::Span: From<proc_macro::Span> is not satisfied" error when building #3093

Closed
edwincoronado opened this issue Dec 21, 2021 · 3 comments
Labels

Comments

@edwincoronado
Copy link
Contributor

Describe the bug

I have a project in which one of the dependencies is using swc and swc_commons crates, when I run cargo build --release I get the following error:

sh-4.2# cargo build --release
    Updating git repository `https://github.com/swc-project/swc`
    Updating git submodule `https://github.com/tc39/test262-parser-tests.git`
   Compiling serde_derive v1.0.132
   Compiling tracing-attributes v0.1.18
   Compiling thiserror-impl v1.0.30
   Compiling proc-macro-error v1.0.4
error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro-error-1.0.4/src/lib.rs:549:37
    |
549 |                 first: self.clone().into(),
    |                                     ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`
    |
    = note: required because of the requirements on the impl of `Into<proc_macro2::Span>` for `proc_macro::Span`

error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
   --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro-error-1.0.4/src/lib.rs:550:36
    |
550 |                 last: self.clone().into(),
    |                                    ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`
    |
    = note: required because of the requirements on the impl of `Into<proc_macro2::Span>` for `proc_macro::Span`

This is happening both on MacOS and Centos (Linux)
System info:
CentOS Linux release 7.9.2009 (Core)
cargo 1.57.0 (b2e52d7ca 2021-10-21)
rustc 1.57.0 (f1edd0429 2021-11-29)
proc-macro-error v1.0.4

My project's Cargo.toml looks like this (masked some information with *** for security/privacy reasons)

[package]

name = "***"
version = "1.0.0"
authors = ***
edition = "2021"

[lib]
crate_type = ["cdylib"]
path = "src/lib.rs"

[dependencies]
anyhow = "1.0.42"
wee_alloc = { version = "0.4.5", optional = true }
once_cell = "1.3.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
swc = { git = "https://github.com/swc-project/swc", rev = "726fc696" }
swc_common = { git = "https://github.com/swc-project/swc", rev = "726fc696" }
jni = "0.19.0"


[features]
default = ["wee_alloc"]

Previously, my project was using swc and swc_common rev = "9c620476" and it was building just fine, but bumping it to rev = "726fc696" throws the described error. I have also filed this bug with proc-macro-error in case this is an issue with the lib.

Thanks!

Input code

No response

Config

No response

Playground link

No response

Expected behavior

Cargo should build the release target just fine.

Version

726fc69

Additional context

No response

@kdy1
Copy link
Member

kdy1 commented Dec 21, 2021

This is not an error of swc

@kdy1 kdy1 closed this as completed Dec 21, 2021
@kdy1 kdy1 added invalid and removed C-bug labels Dec 21, 2021
@edwincoronado
Copy link
Contributor Author

For anyone else experiencing this, I was able to workaround the issue by doing:

  1. rustup update
  2. rustup default nightly
  3. cargo build --release

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 20, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants