Skip to content

Commit

Permalink
fix: Move declarative.yaml example to the hugr-core crate (#1131)
Browse files Browse the repository at this point in the history
This is a file used for the `hugr-core` docs, so it should be included
in that crate.

When trying to `cargo publish`, I got an error due to it not getting
packaged.
```
error: couldn't read src/extension/../../../hugr/examples/extension/declarative.yaml: No such file or directory (os error 2)
  --> src/extension/declarative.rs:12:10
   |
12 | #![doc = include_str!("../../../hugr/examples/extension/declarative.yaml")]
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
```
  • Loading branch information
aborgna-q authored May 29, 2024
1 parent d89b6f1 commit f26b5be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions hugr-core/src/extension/declarative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
//! ### Example
//!
//! ```yaml
#![doc = include_str!("../../../hugr/examples/extension/declarative.yaml")]
#![doc = include_str!("../../examples/extension/declarative.yaml")]
//! ```
//!
//! The definition can be loaded into a registry using the [`load_extensions`] or [`load_extensions_file`] functions.
//! ```rust
//! # const DECLARATIVE_YAML: &str = include_str!("../../../hugr/examples/extension/declarative.yaml");
//! # const DECLARATIVE_YAML: &str = include_str!("../../examples/extension/declarative.yaml");
//! # use hugr::extension::declarative::load_extensions;
//! // Required extensions must already be present in the registry.
//! let mut reg = hugr::std_extensions::logic::LOGIC_REG.clone();
Expand Down Expand Up @@ -327,7 +327,7 @@ extensions:
"#;

/// The yaml used in the module documentation.
const EXAMPLE_YAML_FILE: &str = "../hugr/examples/extension/declarative.yaml";
const EXAMPLE_YAML_FILE: &str = "examples/extension/declarative.yaml";

#[rstest]
#[case(EMPTY_YAML, 1, 0, 0, &PRELUDE_REGISTRY)]
Expand Down

0 comments on commit f26b5be

Please sign in to comment.