Skip to content

DOCS_RS=1 cargo build fails, even with a patch to proc-macro2 #114

Open
@wtdcode

Description

@wtdcode

DOCS_RS=1 cargo build fails with (note a cargo clean is crucial to reproduce):

error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
   --> /home/mio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proc-macro-error2-2.0.1/src/lib.rs:554:32
    |
554 |                 first: (*self).into(),
    |                                ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`
    |
    = note: required for `proc_macro::Span` to implement `Into<proc_macro2::Span>`

error[E0277]: the trait bound `proc_macro2::Span: From<proc_macro::Span>` is not satisfied
   --> /home/mio/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proc-macro-error2-2.0.1/src/lib.rs:555:31
    |
555 |                 last: (*self).into(),
    |                               ^^^^ the trait `From<proc_macro::Span>` is not implemented for `proc_macro2::Span`
    |
    = note: required for `proc_macro::Span` to implement `Into<proc_macro2::Span>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `proc-macro-error2` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

I have a PR to fix proc-macro-error2: dtolnay/proc-macro2#501 but even with that, dynasm gives new errors. To reproduce, add these lines to Cargo.toml:

[patch.crates-io]
# Track issue: https://github.com/dtolnay/proc-macro2/pull/501
proc-macro2 = { git = "https://github.com/wtdcode/proc-macro2", branch = "impl-proc-macro-span" }

This passes DOCS_RS=1 cargo build but unfortunately any users (including us, LibAFL) using dynasmrt::dynasm! will still gets an error. This looks a fault in dynasm crate and thus I reported it here.

To reproduce, build a simple test DOCS_RS=1 cargo build --test aarch64_immediate_checking would reproduce. Note cargo clean is still necessary to reproduce this.

... (removed many duplicate errors)
error[E0425]: cannot find value `ops` in this scope
    --> testing/tests/aarch64_immediate_checking.rs:10:9
     |
10   | /         dynasmrt::dynasm!($ops
11   | |             ; .arch aarch64
12   | |             $($t)*
13   | |         )
     | |_________^ not found in this scope
...
1036 | /     dynasm!(ops
1037 | |         ; fmov v1.d2, hide(0.0)
1038 | |     );
     | |_____- in this macro invocation
     |
     = note: this error originates in the macro `dynasmrt::dynasm` which comes from the expansion of the macro `dynasm` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0425`.
error: could not compile `testing` (test "aarch64_immediate_checking") due to 85 previous errors

Related issue: GnomedDev/proc-macro-error-2#12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions