Question Details

No question body available.

Tags

rust borrow-checker

Answers (1)

Accepted Answer Available
Accepted Answer
January 8, 2026 Score: 3 Rep: 76,602 Quality: Expert Completeness: 80%

There are two separate things here.

Does Rust implicitly add bounds to generic lifetime parameters?

Yes. But this error is unrelated to that.

The error is because the type of the map's key and the used key must be the same, while in your example one is StrWrap. Why the suggested fix works is explained by the concept of well-formedness, which is closely related to implied bounds but not the same.


Does Rust implicitly add bounds to generic lifetime parameters?

Yes. Those are called "implied bounds". The bounds that are added are the bounds required to ensure well-formedness of the type mentioned and are not explicit.

In less formal words: when you have a type &'a T