Typeck: Disallow scalar casts to bare_fn.

Bare functions are another example of a scalar but non-numeric
type (like char) that should be handled separately in casts.
This disallows expressions like `0 as extern "Rust" fn() -> int;`.

It might be advantageous to allow casts between bare functions
and raw pointers in unsafe code in the future, to pass function
pointers between Rust and C.

Closes #8728
Drop struct fields if the user destructor fails

This commit changes drop glue generated for structs to use the invoke LLVM
instruction instead of call. What this means is that if the user destructor
triggers an unwinding, then the fields of the struct will still ge dropped.

This is not an attempt to support failing while failing, as that's mostly a
problem of runtime support. This is more of an issue of soundness in making sure
that destructors are appropriately run. The test included fails before this
commit, and only has one call to fail!(), yet it doesn't destroy its struct
fields.
Add a type_id intrinsic

Closes #9913
Remove unnecessary unwind messages

Now that the type_id intrinsic is working across crates, all of these
unnecessary messages can be removed to have the failure type for a task truly be
~Any and only ~Any
Stop propagating link arguments across crates

This is a fairly brittle modle that doesn't scale well across many crates. It's
unlikely that all of the downstream crates will have all of the original native
dependencies of all the upstream crates. In the case that FFI functions are
reachable, then it should be the responsibility of the downstream crate to link
against the correct library, or the upstream crate should prevent the functions
from being reachable.
Statically link sundown to librustdoc

Closes #10103
fix cross-crate destructor inlining

Closes #7793
Added octal literal support.
Statically link libuv to librustuv

Similarly to the previous commit, libuv is only used by this library, so there's
no need for it to be linked into librustrt and available to all crates by
default.
Grammar error and vim syntax highlighting mistake fixed.
auto merge of #10199 : alexcrichton/rust/no-propagate, r=brson

This commit removes the propagation of `link_args` attributes across crates. The first commit message has the reasons as to why. Additionally, this starts statically linking some C/C++ helper libraries that we have to their respective crates instead of throwing then in librustrt and then having everything depend on librustrt.

The major downside of this movement is that we're losing the ability to control visible symbols. I couldn't figure out a way to internalize symbols from a static library during the linking process, so everyone who links to librustdoc will be able to use its sundown implementation (not exactly ideal). I'm not entirely sure how to fix this (beyond generating a list of all public symbols, including rust ones, and passing that to the linker), but we may have a much easier time with this once we start using llvm's linker toolchain.

There's certainly a lot more possibilities in where this can go, but I didn't want to go too deep just yet. The main idea here is to stop propagating linker arguments and then see how we're able to start statically linking libraries as a result.

r? @catamorphism, you're going to be working on linking soon, so feel free to completely throw this away for something else!
auto merge of #10242 : thestinger/rust/inline_dtor, r=alexcrichton

Closes #7793
replace RetVoid with Unreachable to fix lint

The function is marked `noreturn`, so it shouldn't return.
auto merge of #10244 : thestinger/rust/abort, r=alexcrichton

The function is marked `noreturn`, so it shouldn't have this.
Rename files to match current recommendations.

New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, rustuv, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
auto merge of #10143 : chris-morgan/rust/filename-consistency, r=huonw

New standards have arisen in recent months, mostly for the use of
rustpkg, but the main Rust codebase has not been altered to match these
new specifications. This changeset rectifies most of these issues.

- Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for
  consistency with current styles; this affects extra, rustc, rustdoc,
  rustpkg, std, syntax.

- Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for
  `std::num` and `std::terminfo`.

- Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str`
  directory, to be consistent with its import path of `std::ascii`;
  libstd is flat at present so it's more appropriate thus.

While this removes some `#[path = "..."]` directives, it does not remove
all of them, and leaves certain other inconsistencies, such as `std::u8`
et al. which are actually stored in `src/libstd/num/` (one subdirectory
down). No quorum has been reached on this issue, so I felt it best to
leave them all alone at present. #9208 deals with the possibility of
making libstd more hierarchical (such as changing the crate to match the
current filesystem structure, which would make the module path
`std::num::u8`).

There is one thing remaining in which this repository is not
rustpkg-compliant: rustpkg would have `src/std/` et al. rather than
`src/libstd/` et al. I have not endeavoured to change that at this point
as it would guarantee prompt bitrot and confusion. A change of that
magnitude needs to be discussed first.
Create epub versions of tutorial and ref manual.

Pandoc can create epub verions of the markdown files. Since the docs
are lengthy, epubs are handy to have around. Two rules to create epub
versions of the reference manual and the main tutorial are added here.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
Fixed formatting.

The code block shows up inline without proper formatting without this
newline.

Signed-off-by: Noufal Ibrahim <noufal@nibrahim.net.in>
auto merge of #10219 : alexcrichton/rust/drop-invoke, r=pcwalton

This commit changes drop glue generated for structs to use the invoke LLVM
instruction instead of call. What this means is that if the user destructor
triggers an unwinding, then the fields of the struct will still ge dropped.

This is not an attempt to support failing while failing, as that's mostly a
problem of runtime support. This is more of an issue of soundness in making sure
that destructors are appropriately run. The test included fails before this
commit, and only has one call to fail!(), yet it doesn't destroy its struct
fields.
docs: Replace std::iterator with std::iter.