This fixes segmentation fault of new rt tests.
For example
```
use core::rt::test::*;
use core::rt::comm::*;
use core::cell::Cell;
fn main() {
do run_in_newsched_task {
let (port, chan) = oneshot::<~int>();
let port_cell = Cell(port);
do spawntask_immediately {
assert!(port_cell.take().recv() == ~10);
}
chan.send(~10);
}
}
```
r? @nikomatsakis The way we deal with unreachable expressions in trans is pretty ad hoc,
but this at least doesn't make it worse, and eliminates the LLVM
assertion failure reported in #5741.
The way we deal with unreachable expressions in trans is pretty ad hoc,
but this at least doesn't make it worse, and eliminates the LLVM
assertion failure reported in #5741.
Fixes https://github.com/mozilla/rust/issues/6578 by merging the 3 different ways to build an AST into a single `AstBuilder` trait, creating a more uniform and briefer interface.
Also, converts the `ext_ctxt` trait-object to be a plain struct, as well as renaming it to `ExtCtxt`.
Seems to make expansion slightly faster for the normal case (e.g. `libcore` and `libstd`), but slower for `librustc` (slightly) and `libsyntax` (0.3s -> 0.8s! I'm investigating this, but I'd prefer this patch to land relatively quickly.).
`git blame` suggests maybe @graydon or @erickt are familiar with this area of the code. r?
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules
1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning.
2. For the same case, emit warnings for boxed vectors when slices are required.
After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
r?
Mostly refactoring, and adding some of the remaining types described in #4419.
The [`Local`](3b4ff41511/src/libcore/rt/local.rs (L17)) trait collects some common, often unsafe patterns around task-local and thread-local values. Making all these types safe is largely the aim of #6210.