Skip to content

ruff panics in debug_assert 'Prefer Fix::deletion' when fixing bokeh with --select ALL #4194

@konstin

Description

@konstin
git clone https://github.com/bokeh/bokeh # prints errors, ignore
cd bokeh
git checkout -f 3.2.0.dev2 # more errors, ignore, sorry again

In the ruff dir, checkout ac600bb and cargo build in debug mode.

In the bokeh dir:

../ruff/target/debug/ruff check --no-cache --select ALL --fix .

I haven't gotten around to minimizing this, but the relevant snippet is https://github.com/charliermarsh/ruff/blob/cab65b25da8aff6fb9cb539b55345aae64a835f0/crates/ruff_diagnostics/src/edit.rs#L33-L47

panicked at 'Prefer `Fix::deletion`', crates/ruff_diagnostics/src/edit.rs:41:9
Backtrace:    0: ruff_cli::panic::catch_unwind::{{closure}}
             at /home/konsti/ruff/crates/ruff_cli/src/panic.rs:31:25
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:2001:9
   2: std::panicking::rust_panic_with_hook
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:696:13
   3: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:581:13
   4: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
   5: rust_begin_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
   6: core::panicking::panic_fmt
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
   7: ruff_diagnostics::edit::Edit::range_replacement
             at /home/konsti/ruff/crates/ruff_diagnostics/src/edit.rs:41:9
   8: ruff::rules::pydocstyle::rules::sections::common_section
             at /home/konsti/ruff/crates/ruff/src/rules/pydocstyle/rules/sections.rs:622:36
   9: ruff::rules::pydocstyle::rules::sections::google_section
             at /home/konsti/ruff/crates/ruff/src/rules/pydocstyle/rules/sections.rs:915:5
  10: ruff::rules::pydocstyle::rules::sections::parse_google_sections
             at /home/konsti/ruff/crates/ruff/src/rules/pydocstyle/rules/sections.rs:957:9
  11: ruff::rules::pydocstyle::rules::sections::sections
             at /home/konsti/ruff/crates/ruff/src/rules/pydocstyle/rules/sections.rs:321:17
  12: ruff::checkers::ast::Checker::check_definitions
             at /home/konsti/ruff/crates/ruff/src/checkers/ast/mod.rs:5579:25
  13: ruff::checkers::ast::check_ast
             at /home/konsti/ruff/crates/ruff/src/checkers/ast/mod.rs:5677:5
  14: ruff::linter::check_path
             at /home/konsti/ruff/crates/ruff/src/linter.rs:143:40
  15: ruff::linter::lint_fix
             at /home/konsti/ruff/crates/ruff/src/linter.rs:436:22
  16: ruff_cli::diagnostics::lint_path
             at /home/konsti/ruff/crates/ruff_cli/src/diagnostics.rs:157:14
  17: ruff_cli::commands::run::lint_path::{{closure}}
             at /home/konsti/ruff/crates/ruff_cli/src/commands/run.rs:164:9
  18: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  19: __rust_try
  20: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  21: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  22: ruff_cli::panic::catch_unwind
             at /home/konsti/ruff/crates/ruff_cli/src/panic.rs:40:18
  23: ruff_cli::commands::run::lint_path
             at /home/konsti/ruff/crates/ruff_cli/src/commands/run.rs:163:18
  24: ruff_cli::commands::run::run::{{closure}}
             at /home/konsti/ruff/crates/ruff_cli/src/commands/run.rs:91:21
  25: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:274:13
  26: core::iter::adapters::map::map_fold::{{closure}}
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/iter/adapters/map.rs:84:28
  27: core::iter::traits::iterator::Iterator::fold
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/iter/traits/iterator.rs:2477:21
  28: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/iter/adapters/map.rs:124:9
  29: <rayon::iter::reduce::ReduceFolder<R,T> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/reduce.rs:105:19
  30: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/map.rs:248:21
  31: rayon::iter::plumbing::Producer::fold_with
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:110:9
  32: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:438:13
  33: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:427:21
  34: rayon_core::join::join_context::call_b::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:129:25
  35: rayon_core::job::StackJob<L,F,R>::run_inline
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:102:9
  36: rayon_core::join::join_context::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:159:36
  37: rayon_core::registry::in_worker
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:984:13
  38: rayon_core::join::join_context
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:132:5
  39: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:416:47
  40: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:418:21
  41: rayon_core::join::join_context::call_a::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:124:17
  42: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
  43: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  44: __rust_try
  45: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  46: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  47: rayon_core::unwind::halt_unwinding
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/unwind.rs:17:5
  48: rayon_core::join::join_context::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:142:24
  49: rayon_core::registry::in_worker
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:984:13
  50: rayon_core::join::join_context
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:132:5
  51: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:416:47
  52: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:427:21
  53: rayon_core::join::join_context::call_b::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:129:25
  54: rayon_core::job::StackJob<L,F,R>::run_inline
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:102:9
  55: rayon_core::join::join_context::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:159:36
  56: rayon_core::registry::in_worker
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:984:13
  57: rayon_core::join::join_context
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:132:5
  58: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:416:47
  59: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:418:21
  60: rayon_core::join::join_context::call_a::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:124:17
  61: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
  62: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  63: __rust_try
  64: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  65: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  66: rayon_core::unwind::halt_unwinding
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/unwind.rs:17:5
  67: rayon_core::join::join_context::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:142:24
  68: rayon_core::registry::in_worker
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:984:13
  69: rayon_core::join::join_context
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:132:5
  70: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:416:47
  71: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:418:21
  72: rayon_core::join::join_context::call_a::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:124:17
  73: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
  74: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  75: __rust_try
  76: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  77: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  78: rayon_core::unwind::halt_unwinding
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/unwind.rs:17:5
  79: rayon_core::join::join_context::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:142:24
  80: rayon_core::registry::in_worker
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:984:13
  81: rayon_core::join::join_context
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:132:5
  82: rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:416:47
  83: rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.7.0/src/iter/plumbing/mod.rs:427:21
  84: rayon_core::join::join_context::call_b::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/join/mod.rs:129:25
  85: rayon_core::job::JobResult<T>::call::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:218:41
  86: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
  87: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
  88: __rust_try
  89: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
  90: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
  91: rayon_core::unwind::halt_unwinding
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/unwind.rs:17:5
  92: rayon_core::job::JobResult<T>::call
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:218:15
  93: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:120:32
  94: rayon_core::job::JobRef::execute
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/job.rs:64:9
  95: rayon_core::registry::WorkerThread::execute
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:874:9
  96: rayon_core::registry::WorkerThread::wait_until_cold
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:820:17
  97: rayon_core::registry::WorkerThread::wait_until
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:803:13
  98: rayon_core::registry::main_loop
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:948:5
  99: rayon_core::registry::ThreadBuilder::run
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:54:18
 100: <rayon_core::registry::DefaultSpawn as rayon_core::registry::ThreadSpawn>::spawn::{{closure}}
             at /home/konsti/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.11.0/src/registry.rs:99:20
 101: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:134:18
 102: std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/thread/mod.rs:560:17
 103: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panic/unwind_safe.rs:271:9
 104: std::panicking::try::do_call
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487:40
 105: __rust_try
 106: std::panicking::try
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451:19
 107: std::panic::catch_unwind
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140:14
 108: std::thread::Builder::spawn_unchecked_::{{closure}}
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/thread/mod.rs:559:30
 109: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:250:5
 110: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:1987:9
 111: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/alloc/src/boxed.rs:1987:9
 112: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys/unix/thread.rs:108:17
 113: start_thread
             at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
 114: clone
             at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions