about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-errors.js
diff options
context:
space:
mode:
authorQuinn Sinclair <me@partiallytyped.dev>2023-11-19 11:33:01 +0100
committerPartiallyTyped <me@partiallytyped.dev>2023-11-19 11:33:01 +0100
commit3c1e0afa58dbe1287c1e9a9ea704f9b76b6845cc (patch)
tree832bddb91b9eb56aa83343f921e5ca6417470c1d /tests/rustdoc-js-std/parser-errors.js
parent6eb935a578f7b2fcd87377bd571c4ff1dec48982 (diff)
downloadrust-3c1e0afa58dbe1287c1e9a9ea704f9b76b6845cc.tar.gz
rust-3c1e0afa58dbe1287c1e9a9ea704f9b76b6845cc.zip
New Lint [`impl_hash_with_borrow_str_and_bytes`]
Implements a lint to prevent implementation of Hash, Borrow<str> and
Borrow<[u8]> as it breaks Borrow<T> "semantics". According to the book,
types that implement Borrow<A> and Borrow<B> must ensure equality of
borrow results under Eq,Ord and Hash.

> In particular Eq, Ord and Hash must be equivalent for borrowed and
owned values: x.borrow() == y.borrow() should give the same result as x == y.

In the same way, hash(x) == hash(x as Borrow<[u8]>) != hash(x as Borrow<str>).

changelog: newlint [`impl_hash_with_borrow_str_and_bytes`]
Diffstat (limited to 'tests/rustdoc-js-std/parser-errors.js')
0 files changed, 0 insertions, 0 deletions