Skip to content

Panics with Rust 1.81.0 #636

@ctron

Description

@ctron

Starting with Rust 1.81.0 we see the following issues in trunk:

thread 'notify-rs debouncer loop' panicked at library/core/src/slice/sort/shared/smallsort.rs:862:5:
user-provided comparison function does not correctly implement a total order
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
   2: core::slice::sort::shared::smallsort::panic_on_ord_violation
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/shared/smallsort.rs:862:5
   3: core::slice::sort::shared::smallsort::bidirectional_merge
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/shared/smallsort.rs:841:13
   4: core::slice::sort::shared::smallsort::small_sort_general_with_scratch
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/shared/smallsort.rs:289:9
   5: <T as core::slice::sort::shared::smallsort::StableSmallSortTypeImpl>::small_sort
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/shared/smallsort.rs:64:9
   6: core::slice::sort::stable::quicksort::quicksort
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/stable/quicksort.rs:27:13
   7: core::slice::sort::stable::drift::create_run
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/stable/drift.rs:257:9
   8: core::slice::sort::stable::drift::sort
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/stable/drift.rs:66:17
   9: core::slice::sort::stable::driftsort_main
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/stable/mod.rs:86:5
  10: core::slice::sort::stable::sort
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/slice/sort/stable/mod.rs:47:5
  11: alloc::slice::stable_sort
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:883:5
  12: alloc::slice::<impl [T]>::sort_by
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/alloc/src/slice.rs:289:9
  13: notify_debouncer_full::DebounceDataInner<T>::debounced_events
             at /home/jreimann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-debouncer-full-0.3.1/src/lib.rs:253:9
  14: notify_debouncer_full::new_debouncer_opt::{{closure}}
             at /home/jreimann/.cargo/registry/src/index.crates.io-6f17d22bba15001f/notify-debouncer-full-0.3.1/src/lib.rs:603:29

So my understanding, that's an issue with the comparator provided:

        // order events for different files chronologically, but keep the order of events for the same file
        events_expired.sort_by(|event_a, event_b| {
            // use the last path because rename events are emitted for the target path
            if event_a.paths.last() == event_b.paths.last() {
                std::cmp::Ordering::Equal
            } else {
                event_a.time.cmp(&event_b.time)
            }
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions