&T and &T mut disjoint sets question #65
Replies: 1 comment 1 reply
-
Well, it boils down to Also, I wouldn't say any of these abstract sets "grow", they'll all already just infinite. You can take any Rust type I hope that explanation helps clarify some things! |
Beta Was this translation helpful? Give feedback.
-
I'd like to ask where I can read more about about the &T and &mut T disjoint sets mentioned in the first misconception in (T only contains owned types) in your Common Rust Lifetime Conceptions blog post. I think I get the essential idea of the first point. When it comes to generics T is the set of "everything" as opposed to "just owned types" as the T, &T, and &mut T data types might trick one into believing. &T and &mut T are disjoint sets containing all the variants of immutable and mutable references. Where I get confused is in trying to understand how the two disjoint sets grow, what's the pattern?
For example, "&&mut i32" in the &T examples makes sense if I read that as "an immutable reference to a mutable reference." Similarly, "&mut &i32" makes sense as a "mutable reference to an immutable reference". But I'm not as clear as I'd like as to how those two sets permute as they grow. I haven't seen anyone ask similar in any of the discussions and nothing I've found so far online has cleared it up for me so I'd thought I'd ask for pointers toward additional reading.
Beta Was this translation helpful? Give feedback.
All reactions