• T&T, and &mut T are all infinite sets, since it’s possible to borrow a type ad-infinitum.
  • T is a superset of both &T and &mut T.
  • &T and &mut T are disjoint sets.

(from 1)

trait Trait {}
impl<T> Trait for &T {}
impl<T> Trait for &mut T {}
Type VariableT&T&mut T
Examplesi32&i32&mut i32&&i32&mut &mut i32, …&i32&&i32&&mut i32, …&mut i32&mut &mut i32&mut &i32, …

Footnotes

  1. https://github.com/pretzelhammer/rust-blog/blob/master/posts/common-rust-lifetime-misconceptions.md#1-t-only-contains-owned-types