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

Range without an end causes: Uniform::new_inclusive: range overflow #167

Closed
jayvdb opened this issue Feb 7, 2024 · 1 comment
Closed

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Feb 7, 2024

Oddly, #[dummy(faker = "0.0..")] pub foo: f64 builds, but then it fails with

Uniform::new_inclusive: range overflow
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::panicking::panic
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:127:5
   3: <rand::distributions::uniform::UniformFloat<f64> as rand::distributions::uniform::UniformSampler>::new_inclusive
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rand-0.8.5/src/distributions/uniform.rs:885:17
   4: rand::distributions::uniform::Uniform<X>::new_inclusive
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rand-0.8.5/src/distributions/uniform.rs:199:17
   5: fake::impls::std::primitives::<impl fake::Dummy<core::ops::range::RangeFrom<f64>> for f64>::dummy_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/impls/std/primitives.rs:36:25
   6: <T as fake::private::FakeBase<U>>::_fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:171:13
   7: fake::Fake::fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:212:9
   8: <ros_models::types::QuantificationParameters as fake::Dummy<fake::Faker>>::dummy_with_rng
             at ./src/lib.rs:3684:9
   9: fake::impls::std::option::<impl fake::Dummy<U> for core::option::Option<T>>::dummy_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/impls/std/option.rs:10:18
  10: <T as fake::private::FakeBase<U>>::_fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:171:13
  11: fake::Fake::fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:212:9
  12: <ros_models::types::CaseAnalysis as fake::Dummy<fake::Faker>>::dummy_with_rng
             at ./src/lib.rs:211:9
  13: <T as fake::private::FakeBase<U>>::_fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:171:13
  14: fake::Fake::fake_with_rng
             at /home/jayvdb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fake-2.9.2/src/lib.rs:212:9

Using 0.0..f64::MAX fixes it, but it feels like it fake should be able to detect the appropriate end without it being specified.

@cksac
Copy link
Owner

cksac commented Feb 8, 2024

rust-random/rand#1380

@cksac cksac closed this as completed Feb 15, 2024
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

No branches or pull requests

2 participants