diff --git a/units/src/parse.rs b/units/src/parse.rs index 6127a8f9e..b3a6598e2 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -53,6 +53,7 @@ impl AsRef for ParseIntError { /// Not strictly necessary but serves as a lint - avoids weird behavior if someone accidentally /// passes non-integer to the `parse()` function. +// This trait is not dyn-compatible because `FromStr` is not dyn-compatible. pub trait Integer: FromStr + TryFrom + Sized + sealed::Sealed { diff --git a/units/tests/api.rs b/units/tests/api.rs index 0fec691bd..00ad9b084 100644 --- a/units/tests/api.rs +++ b/units/tests/api.rs @@ -247,6 +247,18 @@ fn regression_default() { assert_eq!(got, want); } +#[test] +fn dyn_compatible() { + // If this builds then traits are dyn compatible. + struct Traits { + a: Box>, + // These traits are explicitly not dyn compatible. + // b: Box, + // c: Box, + // d: Box, + } +} + #[cfg(feature = "arbitrary")] impl<'a> Arbitrary<'a> for Types { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result {