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

Fix lints introduced by clippy 1.78 and 1.79 #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

strohel
Copy link
Member

@strohel strohel commented Jun 27, 2024

  • Check test_all.sh is passed: Hmm, they don't. I'm getting:
    test examples/u3v/register_map.rs ... error
    Test case failed at runtime.
    
    STDERR:
    ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
    warning: `/home/strohel/work/cameleon/.cargo/config` is deprecated in favor of `config.toml`
    note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
    thread 'main' panicked at library/core/src/panicking.rs:220:5:
    unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_nounwind_fmt
       2: core::panicking::panic_nounwind
       3: core::slice::raw::from_raw_parts::precondition_check
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ub_checks.rs:66:21
       4: core::slice::raw::from_raw_parts
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ub_checks.rs:73:17
       5: rusb::interface_descriptor::InterfaceDescriptor::endpoint_descriptors
                 at /home/strohel/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rusb-0.9.3/src/interface_descriptor.rs:95:13
       6: cameleon_device::u3v::device_builder::DeviceBuilder::find_u3v_iad_in_if_desc
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:166:24
       7: cameleon_device::u3v::device_builder::DeviceBuilder::find_u3v_iad_in_config_desc
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:150:40
       8: cameleon_device::u3v::device_builder::DeviceBuilder::find_u3v_iad
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:133:36
       9: cameleon_device::u3v::device_builder::DeviceBuilder::new
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:50:45
      10: cameleon_device::u3v::device_builder::enumerate_devices::{{closure}}
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:29:27
      11: core::iter::adapters::filter_map::filter_map_try_fold::{{closure}}
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/adapters/filter_map.rs:49:28
      12: core::iter::traits::iterator::Iterator::try_fold
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/traits/iterator.rs:2410:21
      13: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::try_fold
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/adapters/filter_map.rs:140:9
      14: core::iter::traits::iterator::Iterator::find_map
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/traits/iterator.rs:2912:9
      15: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/adapters/filter_map.rs:64:9
      16: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/vec/spec_from_iter_nested.rs:26:32
      17: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/vec/spec_from_iter.rs:33:9
      18: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/vec/mod.rs:2972:9
      19: core::iter::traits::iterator::Iterator::collect
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/iter/traits/iterator.rs:2004:9
      20: cameleon_device::u3v::device_builder::enumerate_devices
                 at /home/strohel/work/cameleon/device/src/u3v/device_builder.rs:31:8
      21: cameleon::u3v::enumerate_cameras
                 at /home/strohel/work/cameleon/cameleon/src/u3v/mod.rs:76:19
      22: trybuild000::main
                 at /home/strohel/work/cameleon/cameleon/examples/u3v/register_map.rs:11:23
      23: core::ops::function::FnOnce::call_once
                 at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/ops/function.rs:250:5
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    thread caused non-unwinding panic. aborting.
    ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
    
    Looks like unrelated possibly safety issue?
  • Add fix #{ISSUE_NUMBER} if the corresponding issue exists.
  • Fill out ## Changelog section. If the change is for only internal use, please write None to the section.

Changelog

None

@strohel strohel requested review from bschwind and Y-Nak June 27, 2024 08:40
Copy link
Contributor

@bschwind bschwind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@strohel the test script passes for me on my machine, but the error from yours is a bit scary! Does it pass for you on main?

@strohel
Copy link
Member Author

strohel commented Jul 5, 2024

@bschwind yeah I also get it on main if I comment out # -- -D warnings in test_all.sh to make it get past compilation.

I was on nightly, but I tried on rust 1.79 stable, and got the same error. Maybe this could be Linux-specific?

@mbernat could you please try cloning the cameleon repo on your beefy Linux laptop and running ./test_all.sh?

@mbernat
Copy link

mbernat commented Aug 8, 2024

@strohel will do. Somehow I completely missed this notification, sorry! 🙇

@mbernat
Copy link

mbernat commented Aug 8, 2024

I'm getting the same error, as expected.

thread 'main' panicked at library/core/src/panicking.rs:220:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`

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.

None yet

3 participants