Commit Graph

57006 Commits

Author SHA1 Message Date
Niko Matsakis
693676da4f add missing test 2016-09-13 18:33:35 -04:00
bors
b1363a73ed Auto merge of #35021 - japaric:rustc-builtins, r=alexcrichton
crate-ify compiler-rt into compiler-builtins

libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics - this is a [breaking-change]. Users
of the `std` have to do nothing extra as the std crate depends
on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400

---

r? @alexcrichton
2016-09-13 15:08:12 -07:00
Vadim Petrochenkov
b57f1099b5 Remove parsing of obsolete pre-1.0 syntaxes 2016-09-13 23:33:50 +03:00
Vadim Petrochenkov
03161e9b12 Remove some more dead code from mem categorization 2016-09-13 23:33:50 +03:00
Vadim Petrochenkov
4b6c4c08df Remove some ancient code providing special support for newtypes 2016-09-13 23:33:50 +03:00
Niko Matsakis
b49a26ec6f invoke drop glue with a ptr to (data, meta)
This is done by creating a little space on the stack. Hokey, but it's
the simplest fix I can see.
2016-09-13 16:05:12 -04:00
Michael Woerister
7ec9b81326 TypeIdHasher: Remove more redundant explicit visit calls. 2016-09-13 16:01:39 -04:00
Michael Woerister
377c3e1123 Fix rebasing fallout. 2016-09-13 15:46:21 -04:00
Alex Crichton
848cfe20a0 Link test to compiler builtins and make unstable
This commit fixes a test which now needs to explicitly link to the
`compiler_builtins` crate as well as makes the `compiler_builtins` crate
unstable.
2016-09-13 12:27:26 -07:00
Michael Woerister
869d14447a TypeIdHasher: Let projections be hashed implicitly by the visitor. 2016-09-13 15:22:51 -04:00
Michael Woerister
75a0dd0fca Make TypeIdHasher use DefPath::deterministic_hash() for stability. 2016-09-13 15:22:51 -04:00
Michael Woerister
94d75013bc Remove redundant sorting of projections in TypeIdHasher. 2016-09-13 15:22:51 -04:00
Michael Woerister
5c923f0159 Remove redundant sorting of projection bounds in tyencode. 2016-09-13 15:22:51 -04:00
Michael Woerister
5a881e920e Make sure that projection bounds in ty::TraitObject are sorted in a way that is stable across compilation sessions and crate boundaries. 2016-09-13 15:22:51 -04:00
bors
2fd060815f Auto merge of #36181 - seanmonstar:likely, r=nikomatsakis
core: add likely and unlikely intrinsics

I'm no good at reading assembly, but I have tried a stage1 compiler with this patch, and it does cause different asm output. Additionally, testing this compiler on my httparse crate with some `likely` usage added in to the branches does affect benchmarks. However, I'm sure a codegen test should be included, if anyone knows what it should look like.

There isn't an entry in `librustc_trans/context.rs` in this diff, because it already exists (`llvm.expect.i1` is used for array indices).

----

Even though this does affect httparse benchmarks, it doesn't seem to affect it the same way GCC's `__builtin_expect` affects picohttpparser. I was confused that the deviation on the benchmarks grew hugely when testing this, especially since I'm absolutely certain that the branchs where I added `likely` were always `true`. I chalk that up to GCC and LLVM handle branch prediction differently.

cc #26179
2016-09-13 10:54:55 -07:00
Alex Crichton
265620225d rustc: Don't pass --whole-archive for compiler-builtins
This flag is intended for rlibs included once, not rlibs that are repeatedly
included.
2016-09-13 08:11:20 -07:00
bors
c87ba3f122 Auto merge of #36264 - matklad:zeroing-cstring, r=alexcrichton
Zero first byte of CString on drop

Hi! This is one more attempt to ameliorate `CString::new("...").unwrap().as_ptr()` problem (related RFC: https://github.com/rust-lang/rfcs/pull/1642).

One of the biggest problems with this code is that it may actually work in practice, so the idea of this PR is to proactively break such invalid code.

Looks like writing a `null` byte at the start of the CString should do the trick, and I think is an affordable cost: zeroing a single byte in `Drop` should be cheap enough compared to actual memory deallocation which would follow.

I would actually prefer to do something like

```Rust
impl Drop for CString {
    fn drop(&mut self) {
        let pattern = b"CTHULHU FHTAGN ";
        let bytes = self.inner[..self.inner.len() - 1];
        for (d, s) in bytes.iter_mut().zip(pattern.iter().cycle()) {
            *d = *s;
        }
    }
}
```

because Cthulhu error should be much easier to google, but unfortunately this would be too expensive in release builds, and we can't implement things `cfg(debug_assertions)` conditionally in stdlib.

Not sure if the whole idea or my implementation (I've used ~~`transmute`~~ `mem::unitialized` to workaround move out of Drop thing) makes sense :)
2016-09-13 04:57:23 -07:00
Jeffrey Seyfried
b54e1e3997 Differentiate between monotonic and non-monotonic expansion and
only assign node ids during monotonic expansion.
2016-09-13 09:40:28 +00:00
Jeffrey Seyfried
78c0039878 Expand generated test harnesses and macro registries. 2016-09-13 09:40:28 +00:00
Jeffrey Seyfried
f3c2dca353 Remove scope placeholders from the crate root. 2016-09-13 09:40:28 +00:00
Jeffrey Seyfried
c86c8d41a2 Perform node id assignment and macros_at_scope construction during
the `InvocationCollector` and `PlaceholderExpander` folds.
2016-09-13 09:40:28 +00:00
Jeffrey Seyfried
72a636975f Move macro resolution into librustc_resolve. 2016-09-13 09:40:26 +00:00
bors
58450c047e Auto merge of #36446 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #36357, #36380, #36389, #36397, #36402
- Failed merges:
2016-09-13 01:39:36 -07:00
Guillaume Gomez
c05424f250 Rollup merge of #36402 - kmcallister:gh-29331-array-docs, r=GuillaumeGomez
Tweak array docs

Fixes #29331.

r? @GuillaumeGomez
2016-09-13 10:25:50 +02:00
Guillaume Gomez
d6aa4e828c Rollup merge of #36397 - SuperFluffy:bufwriter_unnecessary_cmp, r=aturon
Remove unnecessary `cmp::min` from BufWriter::write

The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-09-13 10:25:49 +02:00
Guillaume Gomez
2a88e6c42e Rollup merge of #36389 - jfirebaugh:E0297, r=GuillaumeGomez
Update E0297 to new error format

Fixes #35521.
Part of #35233.

I didn't attempt the bonus of narrowing the span to focus on the "for `<pattern>`" piece (it's my first time contributing), but I'm happy to do so given some hints.

r? @jonathandturner
2016-09-13 10:25:49 +02:00
Guillaume Gomez
f658548c93 Rollup merge of #36380 - kylog:fix-typo, r=steveklabnik
book: fix a typo
2016-09-13 10:25:49 +02:00
Guillaume Gomez
a8d594f59d Rollup merge of #36357 - kmcallister:gh-29362-mem-docs, r=GuillaumeGomez
Tweak std::mem docs (#29362)

r? @steveklabnik
2016-09-13 10:25:49 +02:00
Ximin Luo
332ba1286e mk: add a all-no-docs target to build everything except docs
This makes things slightly more efficient for Debian's auto-builders where the
docs can be built on just one architecture, and distributed to users of all
other architectures as well.
2016-09-13 10:09:36 +02:00
Alex Crichton
5841678f51 rustbuild: Fix cross-compiles to MinGW on Linux
Closes #36290
Closes #36291
2016-09-12 22:41:17 -07:00
Jeffrey Seyfried
20b43b2323 Rewrite the unit tests in ext/expand.rs as a compile-fail test. 2016-09-13 05:31:17 +00:00
Jeffrey Seyfried
a9821e1658 Refactor ExtCtxt to use a Resolver instead of a MacroLoader. 2016-09-13 05:31:16 +00:00
Jeffrey Seyfried
60440b226d Refactor noop_fold_stmt_kind out of noop_fold_stmt. 2016-09-13 05:11:51 +00:00
Jeffrey Seyfried
50f94f6c95 Avoid needless reexpansions. 2016-09-13 05:11:45 +00:00
Alex Crichton
2140c4ba36 rustc: Always link compiler-builtins last
All crates depend on compiler-builtins, so we need to always include the crate
last.
2016-09-12 21:52:02 -07:00
Alex Crichton
194a91b0ce rustbuild: Fix dependency tracking with new Cargo
The recent Cargo update changed filenames, which broke a lot of incremental
rustbuild builds. What it thought were the output files were indeed no longer
the output files! (wreaking havoc).

This commit updates this to stop guessing filenames of Cargo and just manage
stamp files instead.
2016-09-12 21:49:17 -07:00
athulappadan
5798003438 Doc correction: btree 2016-09-13 10:13:52 +05:30
Jorge Aparicio
521ffe9dbe it's also compiler-rt.lib on windows-gnu 2016-09-12 21:22:15 -07:00
Jorge Aparicio
e5d0bb12ec no emutls for you, windows 2016-09-12 21:22:15 -07:00
Jorge Aparicio
e6da837e99 it's libcompiler-rt.lib on windows 2016-09-12 21:22:15 -07:00
Jorge Aparicio
3fd5fdd8d3 crate-ify compiler-rt into compiler-builtins
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics. Users of the `std` have to do nothing
extra as the std crate depends on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400
2016-09-12 21:22:15 -07:00
bors
09905b1177 Auto merge of #36019 - frewsxcv:take-into-inner, r=alexcrichton
Introduce `into_inner` method on `std::io::Take`.

https://github.com/rust-lang/rust/issues/23755
2016-09-12 20:33:47 -07:00
Alex Burka
0a62676c73 fix "X is not a member of trait Y" span labels
The span labels for associated types and consts were hardcoded to `Foo`
rather than substituting the name of the trait.

This also normalizes the wording for associated methods', traits', and
consts' span labels.

Fixes #36428.
2016-09-13 03:13:13 +00:00
knight42
ebda77072a Add tests for str::replacen 2016-09-13 10:16:31 +08:00
knight42
be2fa70c16 Implement std::str::replacen 2016-09-13 10:16:31 +08:00
bors
fa9d8cc8ac Auto merge of #35960 - nikomatsakis:incr-comp-krate-edges, r=michaelwoerister
fix a few errant `Krate` edges

Exploring the effect of small changes on `syntex` reuse, I discovered the following sources of unnecessary edges from `Krate`

r? @michaelwoerister
2016-09-12 17:15:26 -07:00
Steven Fackler
7bd25a3048 Remove stray attribute 2016-09-12 15:55:02 -07:00
Niko Matsakis
9ca578687b check stack discipline of tasks 2016-09-12 17:43:44 -04:00
bors
5531c314a2 Auto merge of #36354 - mikhail-m1:master, r=jonathandturner
fix span for errors E0537, E0535 & E0536

fix #36182 as part of #35233
2016-09-12 14:05:41 -07:00
bors
f81f4964d2 Auto merge of #36204 - c4rlo:patch-3, r=GuillaumeGomez
README.md: fix a "\" in table heading to be "/"
2016-09-12 10:54:08 -07:00