Hi! I am very new to Rust and trying to get Bazel's rules_rust to work. With these deps:
[dependencies]
serde = "=1.0.116"
serde_derive = "=1.0.116"
serde_json = "=1.0.58"
I am trying to do this:
rust_library(
name = "my_lib",
srcs = ["src/lib.rs"],
deps = ["//third_party/cargo:serde", "//third_party/cargo:serde_json"],
proc_macro_deps = ["//third_party/cargo:serde_derive"],
)
but I keep on bumping into the following kind of exception. I'm probably doing something very wrong, so might someone right off the bat be able to say what's wrong? With cargo build
this works, so it's probably something else.
INFO: From Compiling Rust lib syn v1.0.42 (88 files):
error[E0277]: the trait bound `proc_macro2::TokenStream: std::convert::From<proc_macro::TokenStream>` is not satisfied
--> external/raze__syn__1_0_42/src/buffer.rs:106:20
|
106 | Self::new2(stream.into())
| ^^^^^^^^^^^^^ the trait `std::convert::From<proc_macro::TokenStream>` is not implemented for `proc_macro2::TokenStream`
|
= help: the following implementations were found:
<proc_macro2::TokenStream as std::convert::From<proc_macro2::TokenTree>>
= note: required because of the requirements on the impl of `std::convert::Into<proc_macro2::TokenStream>` for `proc_macro::TokenStream`
error[E0277]: the trait bound `proc_macro2::TokenStream: std::convert::From<proc_macro::TokenStream>` is not satisfied
--> external/raze__syn__1_0_42/src/parse.rs:1138:21
|
1138 | self.parse2(proc_macro2::TokenStream::from(tokens))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<proc_macro::TokenStream>` is not implemented for `proc_macro2::TokenStream`
|
= help: the following implementations were found:
<proc_macro2::TokenStream as std::convert::From<proc_macro2::TokenTree>>
= note: required by `std::convert::From::from`
cargo raze outputted this:
Loaded override settings: RazeSettings {
workspace_path: "//third_party/cargo",
incompatible_relative_workspace_path: false,
target: "x86_64-unknown-linux-gnu",
crates: {},
gen_workspace_prefix: "raze",
genmode: Remote,
output_buildfile_suffix: "BUILD.bazel",
default_gen_buildrs: false,
}
Generated ./remote/BUILD.bazel successfully
Generated ./remote/itoa-0.4.6.BUILD.bazel successfully
Generated ./remote/proc-macro2-1.0.24.BUILD.bazel successfully
Generated ./remote/quote-1.0.7.BUILD.bazel successfully
Generated ./remote/ryu-1.0.5.BUILD.bazel successfully
Generated ./remote/serde-1.0.116.BUILD.bazel successfully
Generated ./remote/serde_derive-1.0.116.BUILD.bazel successfully
Generated ./remote/serde_json-1.0.58.BUILD.bazel successfully
Generated ./remote/syn-1.0.42.BUILD.bazel successfully
Generated ./remote/unicode-xid-0.2.1.BUILD.bazel successfully
Generated ./BUILD.bazel successfully
Generated ./crates.bzl successfully
Any ideas?