Skip to content

rust-analyzer crash #10311

@pacak

Description

@pacak
% rust-analyzer --version
rust-analyzer f1d7f98ed 2021-09-20 stable
% rust-analyzer ssr 'fn $a() -> $d { $e } ==>> pub fn $a() -> $d { $e }'
thread 'main' panicked at 'assertion failed: check_disjoint(indels)', crates/text_edit/src/lib.rs:191:5                                                                                                                                       
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:50:5
   3: text_edit::assert_disjoint
   4: ide_ssr::replacing::matches_to_edit_at_offset
   5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   6: ide_ssr::MatchFinder::edits                                                                                                                                                                                                             
   7: rust_analyzer::cli::ssr::<impl rust_analyzer::cli::flags::Ssr>::run                                                                                                                                                                     
   8: rust_analyzer::main                                                                                                                                                                                                                     
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Cargo.toml

[package]
name = "pfe"
version = "0.1.0"
authors = []
edition = "2018"

[dependencies]

Cargo.lock

# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3

[[package]]
name = "pfe"
version = "0.1.0"

src/lib.rs

use std::collections::BTreeMap;

#[derive(Debug, PartialEq, Clone, Eq, Ord, PartialOrd, Hash)]
pub struct NonEmpty<T> {
    pub head: T,
    pub tail: Vec<T>,
}

impl<T> From<T> for NonEmpty<T> {
    fn from(head: T) -> NonEmpty<T> {
        NonEmpty { head, tail: vec![] }
    }
}

#[derive(Debug, PartialEq, Clone)]
pub struct Bag<K> {
    items: BTreeMap<K, usize>,
}

impl<K: Ord> Default for Bag<K> {
    fn default() -> Self {
        Bag::new()
    }
}

impl<K: Ord> Bag<K> {
    pub fn new() -> Self {
        Bag {
            items: BTreeMap::new(),
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ssrstructural search & replaceC-bugCategory: bugS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions