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

Nursery rule panicked at 'assertion failed: start.raw <= end.raw', /home/rafal/test/ruff/crates/ruff_text_size/src/range.rs:48:9 #7059

Closed
qarmin opened this issue Sep 2, 2023 · 0 comments · Fixed by #7063
Assignees
Labels
bug Something isn't working fuzzer Surfaced via fuzzing.

Comments

@qarmin
Copy link

qarmin commented Sep 2, 2023

Ruff 0.0.287 (latest changes from main branch)

ruff  *.py --select NURSERY --no-cache --fix

file content:

import collections, functools, operator
class Operations(object):
    allwed_binary_operations = sum((BinaryOperationsByCategory[category] for category in allowed_categories), [])

error:

panicked at 'assertion failed: start.raw <= end.raw', /home/rafal/test/ruff/crates/ruff_text_size/src/range.rs:48:9
Backtrace:    0: ruff_cli::panic::catch_unwind::{{closure}}
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/alloc/src/boxed.rs:2007:9
   2: std::panicking::rust_panic_with_hook
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:709:13
   3: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:595:13
   4: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/sys_common/backtrace.rs:151:18
   5: rust_begin_unwind
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
   6: core::panicking::panic_fmt
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
   7: core::panicking::panic
             at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:117:5
   8: ruff::linter::lint_fix
   9: ruff_cli::diagnostics::lint_path
  10: rayon::iter::plumbing::bridge_producer_consumer::helper
  11: ruff_cli::commands::check::check
  12: ruff_cli::check
  13: ruff_cli::run
  14: ruff::main
  15: std::sys_common::backtrace::__rust_begin_short_backtrace
  16: main
  17: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  18: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:360:3
  19: _start

Looks similar to #5331, but rule TCH003 not cause this problem(at least alone)

143776206214.py.zip

@MichaReiser MichaReiser added the bug Something isn't working label Sep 2, 2023
@charliermarsh charliermarsh self-assigned this Sep 2, 2023
@charliermarsh charliermarsh added the fuzzer Surfaced via fuzzing. label Sep 2, 2023
charliermarsh added a commit that referenced this issue Sep 2, 2023
If a user has `import collections, functools, operator`, and we try to
import from `functools` and `operator`, we end up adding two identical
synthetic edits to preserve that import statement. We need to dedupe
them.

Closes #7059.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fuzzer Surfaced via fuzzing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants