Improved the search by including a levenshtein distance calculation which enables the docs search function to be more forgiving for spelling mistakes
Updated the licensing information for the Levenshtein distance function
doc: Monty Hall simulation for std::rand

A larger example for std::rand
doc: More efficient Monty Hall simulation
doc: use //! instead of /*! ... */ in std::rand
remove unused field CrateContext::uses_gc
Refactored syntax::fold.

Prior to this, the code there had a few issues:

- Default implementations inconsistently either had the prefix `noop_` or
  not.
- Some default methods where implemented in terms of a public noop function
  for user code to call, others where implemented directly on the trait
  and did not allow users of the trait to reuse the code.
- Some of the default implementations where private, and thus not reusable
  for other implementors.
- There where some bugs where default implementations called other default
  implementations directly, rather than to the underlying Folder, with the
  result of some AST nodes never being visited even if the user implemented that
  method. (For example, the current Folder never folded struct fields)

This commit solves this situation somewhat radically by making _all_
`fold_...` functions in the module into Folder methods, and implementing
them all in terms of public `noop_...` functions for other implementors to
call out to.

Some public functions had to be renamed to fit the new system, so this is a
breaking change.

[breaking-change]
Add a few more derivings to AST types
Port Rust to DragonFlyBSD

Not included are two required patches:

* LLVM: segmented stack support for DragonFly [1]

* jemalloc: simple configure patches

[1]: http://reviews.llvm.org/D4705
Guide: testing
rustrt: Allow dropping a brand-new Task

When a new task fails to spawn, it triggers a task failure of the spawning task.
This ends up causing runtime aborts today because of the destructor bomb in the
Task structure. The bomb doesn't actually need to go off until *after* the task
has run at least once.

This now prevents a runtime abort when a native thread fails to spawn.
native: Don't deadlock the runtime on spawn failure

Previously, the call to bookkeeping::increment() was never paired with a
decrement when the spawn failed (due to unwinding). This fixes the problem by
returning a "bomb" from increment() which will decrement on drop, and then
moving the bomb into the child task's procedure which will be dropped naturally.
green: Prevent runtime corruption on spawn failure

Like with libnative, when a green task failed to spawn it would leave the world
in a corrupt state where the local scheduler had been dropped as well as the
local task. Also like libnative, this patch sets up a "bomb" which when it goes
off will restore the state of the world.
auto merge of #15944 : alexcrichton/rust/task-dont-die, r=brson

Previously both spawning mechanisms were not resilient to task failures which were initiated from the task spawning infrastructure.

Closes #15895
Update docs for TLS -> TLD

The correct terminology is Task-Local Data, or TLD. Task-Local Storage,
or TLS, is the old terminology that was abandoned because of the
confusion with Thread-Local Storage (TLS).
avoid redundant translation of items during monomorphization
Derive PartialOrd, Ord and Hash for bitflags types.

In order to prevent users from having to manually implement Hash and Ord for
bitflags types, this commit derives these traits automatically.

This breaks code that has manually implemented any of these traits for types
created by the bitflags! macro. Change this code by removing implementations
of these traits.

[breaking-change]
Implement Default for std::io::FilePermission
Library changes for RFC #43
Add two helper functions for dealing with OwnedPtr paths