From 5cf638c74a11099ba60f71867bafdd5c503cf46a Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Fri, 19 Jul 2024 17:14:09 -0700 Subject: [PATCH] fix broken doc tests --- .forgejo/workflows/test.yml | 1 + crates/fayalite/src/_docs/modules/module_bodies.rs | 2 +- .../_docs/modules/module_bodies/hdl_array_expressions.rs | 4 ++-- .../module_bodies/hdl_let_statements/inputs_outputs.rs | 3 ++- .../module_bodies/hdl_struct_variant_expressions.rs | 1 + .../fayalite/src/_docs/semantics/connection_semantics.rs | 8 ++++---- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 6cc3727..71f4a3b 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -15,4 +15,5 @@ jobs: with: save-if: ${{ github.ref == 'refs/heads/master' }} - run: cargo test + - run: cargo test --features=unstable-doc - run: cargo doc --features=unstable-doc diff --git a/crates/fayalite/src/_docs/modules/module_bodies.rs b/crates/fayalite/src/_docs/modules/module_bodies.rs index 63fe671..bd85c61 100644 --- a/crates/fayalite/src/_docs/modules/module_bodies.rs +++ b/crates/fayalite/src/_docs/modules/module_bodies.rs @@ -1,7 +1,7 @@ //! # Module Function Bodies //! //! The `#[hdl_module]` attribute lets you have statements/expressions with `#[hdl]` annotations -//! and `_hdl`-suffixed literals in the module function's body +//! and `_hdl`-suffixed literals in the module function's body. pub mod hdl_array_expressions; pub mod hdl_if_statements; diff --git a/crates/fayalite/src/_docs/modules/module_bodies/hdl_array_expressions.rs b/crates/fayalite/src/_docs/modules/module_bodies/hdl_array_expressions.rs index 516b35c..ae510b2 100644 --- a/crates/fayalite/src/_docs/modules/module_bodies/hdl_array_expressions.rs +++ b/crates/fayalite/src/_docs/modules/module_bodies/hdl_array_expressions.rs @@ -13,12 +13,12 @@ //! m.connect( //! w, //! #[hdl] -//! [4_hdl_u8, v, 3_hdl_u8, v + 7_hdl_u8] // you can make an array like this +//! [4_hdl_u8, v, 3_hdl_u8, (v + 7_hdl_u8).cast()] // you can make an array like this //! ); //! m.connect( //! w, //! #[hdl] -//! [v + 1_hdl_u8; 4] // or you can make an array repeat like this +//! [(v + 1_hdl_u8).cast(); 4] // or you can make an array repeat like this //! ); //! # } //! ``` diff --git a/crates/fayalite/src/_docs/modules/module_bodies/hdl_let_statements/inputs_outputs.rs b/crates/fayalite/src/_docs/modules/module_bodies/hdl_let_statements/inputs_outputs.rs index b070e71..23d7c8a 100644 --- a/crates/fayalite/src/_docs/modules/module_bodies/hdl_let_statements/inputs_outputs.rs +++ b/crates/fayalite/src/_docs/modules/module_bodies/hdl_let_statements/inputs_outputs.rs @@ -4,11 +4,12 @@ //! so you should read it. //! //! ``` -//! # use fayalite::{hdl_module, int::UInt, array::Array}; +//! # use fayalite::{hdl_module, int::UInt, expr::Expr, array::Array}; //! # #[hdl_module] //! # fn module() { //! #[hdl] //! let my_input: UInt<10> = m.input(); +//! let _: Expr> = my_input; // my_input has type Expr> //! #[hdl] //! let my_output: Array<[UInt<10>; 3]> = m.output(); //! # } diff --git a/crates/fayalite/src/_docs/modules/module_bodies/hdl_struct_variant_expressions.rs b/crates/fayalite/src/_docs/modules/module_bodies/hdl_struct_variant_expressions.rs index 15cbca9..1013447 100644 --- a/crates/fayalite/src/_docs/modules/module_bodies/hdl_struct_variant_expressions.rs +++ b/crates/fayalite/src/_docs/modules/module_bodies/hdl_struct_variant_expressions.rs @@ -11,6 +11,7 @@ //! ``` //! # use fayalite::{hdl_module, int::UInt, array::Array, ty::Value}; //! #[derive(Value, Clone, PartialEq, Eq, Hash, Debug)] +//! #[hdl(fixed_type)] //! pub struct MyStruct { //! pub a: UInt<8>, //! pub b: UInt<16>, diff --git a/crates/fayalite/src/_docs/semantics/connection_semantics.rs b/crates/fayalite/src/_docs/semantics/connection_semantics.rs index ef30329..7c77ff3 100644 --- a/crates/fayalite/src/_docs/semantics/connection_semantics.rs +++ b/crates/fayalite/src/_docs/semantics/connection_semantics.rs @@ -20,8 +20,8 @@ //! Connection Semantics Example: //! //! ``` -//! # use fayalite::module_hdl; -//! # #[module_hdl] +//! # use fayalite::{hdl_module, int::UInt}; +//! # #[hdl_module] //! # fn module() { //! #[hdl] //! let a: UInt<8> = m.wire(); @@ -43,8 +43,8 @@ //! # Conditional Connection Semantics //! //! ``` -//! # use fayalite::module_hdl; -//! # #[module_hdl] +//! # use fayalite::{hdl_module, int::UInt}; +//! # #[hdl_module] //! # fn module() { //! #[hdl] //! let cond: UInt<1> = m.input();