You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Construct a vector of size `N` from a `GenericArray`.
///
/// # Examples
/// ```
/// # #[macro_use] extern crate sized_vec;
/// # use std::convert::TryFrom;
/// # use sized_vec::Vec;
/// # use typenum::U3;
/// # use generic_array::GenericArray;
/// # fn main() {
/// let array = GenericArray::from([1, 2, 3]);
/// let good_vec: Vec<U3, _> = Vec::from(array);
/// assert_eq!(svec![1, 2, 3], good_vec);
/// # }
/// ```
Under the current beta version of rust 1.36, we get an error from cargo test on this crate due to line 1098.
But as far as I can tell, the reason we are seeing this error now is not because of a regression in the compiler's behavior, but rather because this documentation example is dead code by default. The cfg flag at the front, under 1.35 and earlier, cause rustdoc not to include it. Right now rustdocmight include it in 1.36 ("might" because of rust-lang/rust#61199 ), but the real point here is that this code example is not being tested by default, and that might represent a bug somewhere here overall.
Maybe the impl there should be guarded by just cfg(feature = "generic-array")? Why is it cfg(any(test, feature = "generic-array")) ?
The text was updated successfully, but these errors were encountered:
The cfg checks for test because I don't want to have to use the --all-features flag on cargo test, and generic-array is a dev-dependency as well as an optional dependency, which I'd have expected to be available when testing. You're right, though, that test seems to have been ignored up until now, and, more curiously, on current nightly cargo test fails as you've noted, while cargo test --all-features compiles and passes the test, so it would seem rustdoc doesn't include my listed dev-dependencies.
So I think I'm just going to make sure CI uses cargo test --all-featuresand remove the test guard from the cfg.
Spawned off of rust-lang/rust#61563
If you look at:
sized-vec/src/lib.rs
Lines 1082 to 1101 in 617bb45
Under the current beta version of rust 1.36, we get an error from
cargo test
on this crate due to line 1098.But as far as I can tell, the reason we are seeing this error now is not because of a regression in the compiler's behavior, but rather because this documentation example is dead code by default. The
cfg
flag at the front, under 1.35 and earlier, causerustdoc
not to include it. Right nowrustdoc
might include it in 1.36 ("might" because of rust-lang/rust#61199 ), but the real point here is that this code example is not being tested by default, and that might represent a bug somewhere here overall.Maybe the
impl
there should be guarded by justcfg(feature = "generic-array")
? Why is itcfg(any(test, feature = "generic-array"))
?The text was updated successfully, but these errors were encountered: