[package]
name = "my-macro"
version = "0.1.0"
edition = "2021"
[dependencies]
paste = "1.0"
app
./app/my-app/src/main.rs
use my_macro::the_macro;
the_macro!(Foo, bar);
fn main() {
println!("Hello, world!");
}
./app/my-app/Cargo.toml
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"
[dependencies]
my-macro = { path = "../../lib/my-macro" }
root
[workspace]
members = [
"app/my-app",
"lib/*"
]
default-members = ["app/my-app"]
Error
error[E0433]: failed to resolve: use of undeclared crate or module `paste`
--> app/my-app/src/main.rs:3:1
|
3 | the_macro!(Foo, bar);
| ^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `paste`
|
= note: this error originates in the macro `the_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0433`.
error: could not compile `my-app` due to previous error
I have two crates, a lib that defined macro and an app that uses that macro. and I get this error:
tree:
lib
./lib/my-macro/src/the_macro.rs
./lib/my-macro/src/lib.rs
./lib/my-macro/Cargo.toml
app
./app/my-app/src/main.rs
./app/my-app/Cargo.toml
root
Error
sample repo