Skip to content

clone bug in rustc_index::bit_set::BitSet #99006

Closed
@LeeeWee

Description

@LeeeWee

In the following code from rust/compiler/rustc_index/src/bit_set.rs, self.words should resize with from.words.len() instead of from.domain_size.

    fn clone_from(&mut self, from: &Self) {
        if self.domain_size != from.domain_size {
            self.words.resize(from.domain_size, 0);
            self.domain_size = from.domain_size;
        }

        self.words.copy_from_slice(&from.words);
    }

Otherwise, this function will panic when calling 'copy_from_slice' because of the mismatched slice length.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions