rust-skiplist icon indicating copy to clipboard operation
rust-skiplist copied to clipboard

`OrderedSkipList::new` is unsound

Open MinusKelvin opened this issue 9 months ago • 2 comments

OrderedSkipList relies on the comparison function being well-behaved for safety purposes. OrderedSkipList::new uses the comparison function provided by the type's PartialOrd implementation, but this comparison function may not be well-behaved. From the documentation of PartialOrd:

Violating these requirements is a logic error. The behavior resulting from a logic error is not specified, but users of the trait must ensure that such logic errors do not result in undefined behavior. This means that unsafe code must not rely on the correctness of these methods.

MinusKelvin avatar May 09 '24 23:05 MinusKelvin