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

doc: feature-gate doctest that needs rand #290

Merged

Conversation

FreezyLemon
Copy link
Contributor

cargo test --doc --no-default-features currently fails with a compiler error:

failures:

---- src/lib.rs - (line 10) stdout ----
error[E0433]: failed to resolve: use of undeclared crate or module `rand`
 --> src/lib.rs:13:5
  |
6 | use rand::distributions::Distribution;
  |     ^^^^ use of undeclared crate or module `rand`

error[E0433]: failed to resolve: use of undeclared crate or module `rand`
 --> src/lib.rs:14:13
  |
7 | let mut r = rand::rngs::OsRng;
  |             ^^^^ use of undeclared crate or module `rand`

error[E0599]: no method named `sample` found for struct `Exp` in the current scope
 --> src/lib.rs:16:16
  |
9 | print!("{}", n.sample(&mut r));
  |                ^^^^^^ method not found in `Exp`

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
Couldn't compile the test.

failures:
    src/lib.rs - (line 10)

This was introduced in #275 and not noticed because CI doesn't run tests on all feature combinations. I think this only affects local doc builds, but it's still annoying that this was missed by CI. But testing all feature combinations with cargo-hack and --feature-powerset would likely increase the CI time dramatically. Not sure it's worth it since normal compiler errors will get caught by CI, it's just doctests that are not completely covered..

@YeungOnion
Copy link
Contributor

good point!

@YeungOnion YeungOnion merged commit c866d42 into statrs-dev:master Sep 13, 2024
7 of 9 checks passed
@FreezyLemon FreezyLemon deleted the ignore-doctest-broken-without-rand branch September 13, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants