-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
When using this crate in another crate part of a workspace, calling cargo test will fail at the machine!() macro. For example:
error: proc macro panicked
--> /Users/nbigaouette/example/subcrate/src/lib.rs:18:1
|
18 | / machine::machine!(
19 | | /// Different states
20 | | #[derive(Debug, PartialEq)]
21 | | enum MyState {
... |
26 | | }
27 | | );
| |__^
|
= help: message: error writing machine definition: Os { code: 2, kind: NotFound, message: "No such file or directory" }
error: aborting due to previous error
error: test failed, to rerun pass '--doc'
The error comes from this file:
Lines 448 to 456 in 20b140d
| let file_name = format!("target/machine/{}.rs", name.to_string().to_lowercase()); | |
| let _ = create_dir("target/machine"); | |
| File::create(&file_name) | |
| .and_then(|mut file| { | |
| file.seek(std::io::SeekFrom::End(0))?; | |
| file.write_all(gen.to_string().as_bytes())?; | |
| file.flush() | |
| }) | |
| .expect("error writing machine definition"); |
The macro will use target/machine to output the generated file, but this is not the proper way to get the path. The target directory is expected to be under subcrate/target but this directory does not get created by cargo. I had to manually create it for the macro to succeed.
antifuchs
Metadata
Metadata
Assignees
Labels
No labels