servo/servo — pull request #3374 by Manishearth (2014-09-16 17:33:30+00:00)
Title: Add lint for ensuring proper rooting of JS<T>

This adds the `unrooted_must_root` lint. Any type containing a type annotated with `#[must_root]`
must either `allow` this lint (in case it is a safe wrapper like `Temporary`)
or have a `#[must_root]` attribute itself. This gives us an annotation on all types which contain unrooted JS-managed data, starting with `JS`.

The main use case is to prevent usage of `JS` and objects containing it to be used on the stack without rooting.
To accomplish this, the lint enforces:

- Functions aside from `new()` and `new_inherited()` are not allowed to have unrooted objects in their arguments.
- Let/for bindings to an unrooted value are similarly disallowed (in case of safe usage, use `#[allow(unrooted_must_root)]` on the surrounding block; single statements can't be annotated)