I might not make clear of my question, Sorry. The question is , why this code segment passed the complier check, but I still get a wrong answer, so, Does there any error with my code ?
That is exactly what he was answering. The automatically derived Hash impl doesn't produce the same results as hashing the string representation, hence, you must implement it manually.
Generic code typically uses Borrow<T> when it relies on the identical behavior of these additional trait implementations. These traits will likely appear as additional trait bounds.
In particular Eq, Ord and Hash must be equivalent for borrowed and owned values: […]
The key may be any borrowed form of the map’s key type, but Hash and Eq on the borrowed form must match those for the key type.
Regarding your question:
Yes, there is an error in your code!
The error is that you implemented Borrow but didn't ensure that Hash behaves the same for the owned (AbType) and the borrowed (str) type. By writing #[derive(Hash)], you instructed the compiler to automatically provide a Hash implementation, but this isn't the same as str's Hash implementation (for the particular str values you provide).
If you implement Borrow, you must ensure that Hash::hash acts the same irrgegardless of whether you feed a AbType::Rss or a string "rss" into it.
The compiler is not capable to catch these kind of errors. They are called "logic errors".