Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: really ignore tests which depend on typetag when cfg(miri) #1058

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hugr/src/ops/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ pub enum Value {
/// is another `CustomSerialized` we do not attempt to recurse. This behaviour
/// may change in future.
///
/// ```rust
#[cfg_attr(not(miri), doc = "```")] // this doctest depends on typetag, so fails with miri
#[cfg_attr(miri, doc = "```ignore")]
/// use serde::{Serialize,Deserialize};
/// use hugr::{
/// types::Type,ops::constant::{OpaqueValue, ValueName, CustomConst, CustomSerialized},
Expand Down
8 changes: 5 additions & 3 deletions hugr/src/ops/constant/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use super::ValueName;
/// be serialized with two attributes, `"c"` the tag and `"v"` the
/// `CustomConst`:
///
/// ```rust
#[cfg_attr(not(miri), doc = "```")] // this doctest depends on typetag, so fails with miri
#[cfg_attr(miri, doc = "```ignore")]
/// use serde::{Serialize,Deserialize};
/// use hugr::{
/// types::Type,ops::constant::{OpaqueValue, ValueName, CustomConst},
Expand All @@ -51,7 +52,7 @@ use super::ValueName;
/// "c": "CC",
/// "v": 2
/// }));
/// ````
/// ```
#[typetag::serde(tag = "c", content = "v")]
pub trait CustomConst:
Send + Sync + std::fmt::Debug + CustomConstBoxClone + Any + Downcast
Expand Down Expand Up @@ -312,7 +313,8 @@ pub fn get_pair_of_input_values<T: CustomConst>(
Some((c0.get_custom_value()?, c1.get_custom_value()?))
}

#[cfg(test)]
// these tests depend on the `typetag` crate.
#[cfg(all(test, not(miri)))]
mod test {

use rstest::rstest;
Expand Down