Commit Graph

57167 Commits

Author SHA1 Message Date
bors
97b561a094 Auto merge of #35667 - ollie27:rustdoc_opaque_structs, r=steveklabnik
rustdoc: Don't add extra newlines for fully opaque structs

Changes the definition for braced structs with only private or hidden fields to save space on the page.

Before:
```
pub struct Vec<T> {
    // some fields omitted
}
```
After:
```
pub struct Vec<T> { /* fields omitted */ }
```

This also cleans up empty braced structs.

Before:
```
pub struct Foo {
}
```
After:
```
pub struct Foo {}
```

[before](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html) [after](https://ollie27.github.io/rust_doc_test/std/vec/struct.Vec.html)

cc #34713
2016-09-14 04:57:47 -07:00
Nicholas Nethercote
4715985b07 Remove unused Token::to_binop function. 2016-09-14 15:57:16 +10:00
bors
739d57180f Auto merge of #36041 - ahmedcharles:try, r=nrc
Replace try! with ?.
2016-09-13 22:41:34 -07:00
Michael Woerister
1b3a588f55 trans: Let the collector find drop-glue for all vtables, not just VTableImpl. 2016-09-13 22:11:01 -04:00
Corey Farwell
fae439b92f Add doc examples for std::net::IpAddr construction. 2016-09-13 22:07:38 -04:00
Eugene Bulkin
b1bcd185b0 Implement add, sub, mul and div methods using checked methods for Duration 2016-09-13 17:58:45 -07:00
Eugene Bulkin
07b41b5555 Fix Duration::checked_mul documentation 2016-09-13 17:32:24 -07:00
Eugene Bulkin
606cdede0d Add checked operation methods to Duration 2016-09-13 17:21:54 -07:00
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
6d78620bd7 rustbuild: Nicer error for host builds of targets
If a triple is configured only as a target, not a host, then trying to build
that triple with host artifacts would cause a panic. Fail a little nicer
instead.

Closes #36268
2016-09-12 22:45:36 -07: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