From f26b5bed88ec5afcab8d8cbad002b47ad7419a20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Borgna?= <121866228+aborgna-q@users.noreply.github.com> Date: Wed, 29 May 2024 14:56:43 +0100 Subject: [PATCH] fix: Move `declarative.yaml` example to the `hugr-core` crate (#1131) 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) ``` --- {hugr => hugr-core}/examples/extension/declarative.yaml | 0 hugr-core/src/extension/declarative.rs | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename {hugr => hugr-core}/examples/extension/declarative.yaml (100%) diff --git a/hugr/examples/extension/declarative.yaml b/hugr-core/examples/extension/declarative.yaml similarity index 100% rename from hugr/examples/extension/declarative.yaml rename to hugr-core/examples/extension/declarative.yaml diff --git a/hugr-core/src/extension/declarative.rs b/hugr-core/src/extension/declarative.rs index 99ea08adb..80c44b40f 100644 --- a/hugr-core/src/extension/declarative.rs +++ b/hugr-core/src/extension/declarative.rs @@ -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(); @@ -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)]