I found this quite confusing when the 'static
bound was recently removed from Send
. I had to update the bound on a trait object that I was passing around with Arc
, the implementation of the object was basically a plain struct with no references so annotating the thing as having lifetime 'static
seemed strange to me. Before the Send
change, when I had to implement Send
and Sync
in order to send it across threads those all made sense, but the compiler asking me to add 'static
made me stop and think. I had to go searching for a stack overflow that covers it and describes that the 'static
bound doesn’t prescribe that the object have 'static
lifetime but rather that it contains either no references at all, or only static ones.
The reference describes it similarly: Type Kinds
All the other Type Kinds: Send
, Copy
, Drop
all look like traits; and all of them, including 'static
act like traits when used as a bound. Why does 'static
look like a lifetime bound when it’s really a bit different?
Now that I’ve done the research and learned what it is I don’t imagine it will cause me any pain. I just thought I’d bring it up as a possible point of confusion for new users, since now that it was removed from Send we will be seeing many more 'static
bounds.