For now, this reference is a best-effort document. We strive for validity
and completeness, but are not yet there. In the future, the docs and lang
teams will work together to figure out how best to do this. Until then, this
is a best-effort attempt. If you find something wrong or missing, file an
issue or
send in a pull request.

Trait and lifetime bounds provide a way for generic items to
restrict which types and lifetimes are used as their parameters. Bounds can be
provided on any type in a where clause. There are also shorter forms for
certain common cases:

Bounds written after declaring a generic parameter:
fn f<A: Copy>() {} is the same as fn f<A> where A: Copy () {}.

Bounds on an item must be satisfied when using the item. When type checking and
borrow checking a generic item, the bounds can be used to determine that a
trait is implemented for a type. For example, given Ty: Trait

In the body of a generic function, methods from Trait can be called on Ty
values. Likewise associated constants on the Trait can be used.

Associated types from Trait can be used.

Generic functions and types with a T: Trait bounds can be used with Ty
being used for T.

Lifetime bounds can be applied to types or other lifetimes. The bound 'a: 'b
is usually read as 'aoutlives'b. 'a: 'b means that 'a lasts longer
than 'b, so a reference &'a () is valid whenever &'b () is valid.

Higher-ranked lifetimes may also be specified just before the trait, the only
difference is the scope of the lifetime parameter, which extends only to the
end of the following trait instead of the whole bound. This function is
equivalent to the last one.