Commit Graph

56930 Commits

Author SHA1 Message Date
bors
a36e069288 Auto merge of #36213 - josephDunne:dist_version, r=brson
Add rustc version info (git hash + date) to dist tarball

a fix for #32444
2016-09-15 20:48:58 -07:00
bors
5511a93c8a Auto merge of #36439 - alexcrichton:fix-rustbuild, r=japaric
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-15 17:19:09 -07:00
bors
1265cbf4e0 Auto merge of #36393 - petrochenkov:ancient, r=eddyb
Remove some obsolete code from the compiler
2016-09-15 13:34:11 -07:00
bors
d1acabeaa2 Auto merge of #35992 - SimonSapin:rc-arc-ptr-eq, r=alexcrichton
Add `pub fn ptr_eq(this: &Self, other: &Self) -> bool` to Rc and Arc

Servo and Kuchiki have had helper functions doing this for some time.
2016-09-15 09:58:26 -07:00
Simon Sapin
5ce9feeb8c Add std::ptr::eq, for referential equality of &T references.
Fixes https://github.com/rust-lang/rfcs/issues/1155
2016-09-15 18:48:16 +02:00
Simon Sapin
eba2270a9c Add pub fn ptr_eq(this: &Self, other: &Self) -> bool to Rc and Arc.
Servo and Kuchiki have had helper functions doing this for some time.
2016-09-15 18:48:16 +02:00
bors
dc75933aba Auto merge of #36491 - Manishearth:rollup, r=Manishearth
Rollup of 9 pull requests

- Successful merges: #36384, #36405, #36425, #36429, #36438, #36454, #36459, #36461, #36463
- Failed merges: #36444
2016-09-15 06:14:26 -07:00
Manish Goregaokar
ec08128882 Rollup merge of #36463 - eugene-bulkin:duration-checked-ops, r=alexcrichton
Add checked operation methods to Duration

Addresses #35774.
2016-09-15 18:16:22 +05:30
Manish Goregaokar
0c9dc539df Rollup merge of #36461 - nikomatsakis:issue-36053, r=arielb1
clear obligations-added flag with nested fulfillcx

This flag is a debugging measure designed to detect cases where we start
a snapshot, create type variables, register obligations involving those
type variables in the fulfillment cx, and then have to unroll the
snapshot, leaving "dangling type variables" behind.  HOWEVER, in some
cases the flag is wrong. In particular, we sometimes create a
"mini-fulfilment-cx" in which we enroll obligations. As long as this
fulfillment cx is fully drained before we return, this is not a problem,
as there won't be any escaping obligations in the main cx. So we add a
fn to save/restore the flag.

Fixes #36053.

r? @arielb1
2016-09-15 18:16:22 +05:30
Manish Goregaokar
959f764f8b Rollup merge of #36459 - nikomatsakis:issue-35546, r=eddyb
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, and I am in "kill regressions" mode right now.

Fixes #35546

r? @eddyb
2016-09-15 18:16:21 +05:30
Manish Goregaokar
69a7f92a7f Rollup merge of #36454 - bluss:slice-primitive-index, r=alexcrichton
Use primitive indexing in slice's Index/IndexMut

[T]'s Index implementation is normally not used for indexing, instead
the compiler supplied indexing is used.

Use the compiler supplied version in Index/IndexMut.

This removes an inconsistency:

Compiler supplied bound check failures look like this:

thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4'

If you convince Rust to use the Index impl for slices, bounds check
failure looks like this instead:

thread 'main' panicked at 'assertion failed: index < self.len()'

The latter is used if you for example use Index generically:

```rust
use std::ops::Index;
fn foo<T: ?Sized>(x: &T) where T: Index<usize> { &x[4]; }

foo(&[1, 2, 3][..])
```
2016-09-15 18:16:21 +05:30
Manish Goregaokar
bab9238a1e Rollup merge of #36438 - jseyfried:node_ids_in_expansion, r=nrc
Assign node ids during macro expansion

After this PR,
 - The `ExtCtxt` can access `resolve`'s `Resolver` through the trait object `ext::base::Resolver`.
  - The `Resolver` trait object can load macros and replaces today's `MacroLoader` trait object.
  - The macro expander uses the `Resolver` trait object to resolve macro invocations.
 - The macro expander assigns node ids and builds the `Resolver`'s `macros_at_scope` map.
   - This is groundwork for merging import resolution and expansion.
 - Performance of expansion together with node id assignment improves by ~5%.

**EDIT:** Since Github is reordering the commits, here is `git log`:
 - b54e1e3997: Differentiate between monotonic and non-monotonic expansion and only assign node ids during monotonic expansion.
 - 78c0039878: Expand generated test harnesses and macro registries.
 - f3c2dca353: Remove scope placeholders from the crate root.
 - c86c8d41a2: Perform node id assignment and `macros_at_scope` construction during the `InvocationCollector` and `PlaceholderExpander` folds.
 - 72a636975f: Move macro resolution into `librustc_resolve`.
 - 20b43b2323: Rewrite the unit tests in `ext/expand.rs` as a `compile-fail` test.
 - a9821e1658: Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`.
 - 60440b226d: Refactor `noop_fold_stmt_kind` out of `noop_fold_stmt`.
 - 50f94f6c95: Avoid needless reexpansions.

r? @nrc
2016-09-15 18:16:21 +05:30
Manish Goregaokar
23e0c24cad Rollup merge of #36429 - durka:patch-30, r=nagisa
fix "X is not a member of trait Y" span labels

Fixes #36428.
2016-09-15 18:16:21 +05:30
Manish Goregaokar
7494bc7c50 Rollup merge of #36425 - michaelwoerister:stable-projection-bounds, r=eddyb
Fix indeterminism in ty::TraitObject representation.

Make sure that projection bounds in `ty::TraitObject` are sorted in a way that is stable across compilation sessions and crate boundaries.

This PR
+  moves `DefPathHashes` up into `librustc` so it can be used there to create a stable sort key for `DefId`s,
+ changes `PolyExistentialProjection::sort_key()` to take advantage of the above,
+ and removes the unused `PolyProjectionPredicate::sort_key()` and `ProjectionTy::sort_key()` methods.

Fixes #36155
2016-09-15 18:16:20 +05:30
Manish Goregaokar
ebef6ad0e4 Rollup merge of #36405 - solson:typo, r=eddyb
Delete stray ` character in error message.
2016-09-15 18:16:20 +05:30
Manish Goregaokar
726850170d Rollup merge of #36384 - petrochenkov:derclone, r=alexcrichton
Improve shallow `Clone` deriving

`Copy` unions now support `#[derive(Clone)]`.
Less code is generated for `#[derive(Clone, Copy)]`.
+
Unions now support `#[derive(Eq)]`.
Less code is generated for `#[derive(Eq)]`.

---
Example of code reduction:
```
enum E {
	A { a: u8, b: u16 },
	B { c: [u8; 100] },
}
```
Before:
```
fn clone(&self) -> E {
    match (&*self,) {
        (&E::A { a: ref __self_0, b: ref __self_1 },) => {
            ::std::clone::assert_receiver_is_clone(&(*__self_0));
            ::std::clone::assert_receiver_is_clone(&(*__self_1));
            *self
        }
        (&E::B { c: ref __self_0 },) => {
            ::std::clone::assert_receiver_is_clone(&(*__self_0));
            *self
        }
    }
}
```
After:
```
fn clone(&self) -> E {
    {
        let _: ::std::clone::AssertParamIsClone<u8>;
        let _: ::std::clone::AssertParamIsClone<u16>;
        let _: ::std::clone::AssertParamIsClone<[u8; 100]>;
        *self
    }
}
```

All the matches are removed, bound assertions are more lightweight.
`let _: Checker<CheckMe>;`, unlike `checker(&check_me);`, doesn't have to be translated by rustc_trans and then inlined by LLVM, it doesn't even exist in MIR, this means faster compilation.

---
Union impls are generated like this:
```
union U {
	a: u8,
	b: u16,
	c: [u8; 100],
}
```
```
fn clone(&self) -> U {
    {
        let _: ::std::clone::AssertParamIsCopy<Self>;
        *self
    }
}
```

Fixes https://github.com/rust-lang/rust/issues/36043
cc @durka
r? @alexcrichton
2016-09-15 18:16:19 +05:30
bors
e2c64d1690 Auto merge of #36372 - sfackler:sum-prod-overflow, r=alexcrichton
Inherit overflow checks for sum and product

We have previously documented the fact that these will panic on overflow, but I think this behavior is what people actually want/expect. `#[rustc_inherit_overflow_checks]` didn't exist when we discussed these for stabilization.

r? @alexcrichton

Closes #35807
2016-09-15 02:43:01 -07:00
bors
16ff9e22cd Auto merge of #36347 - knight42:str-replacen, r=alexcrichton
Implement std::str::replacen

Replaces first N matches of a pattern with another string.

```
assert_eq!("acaaa".replacen(a, "b", 3), "bcbba")
```
2016-09-14 20:29:15 -07:00
Eugene Bulkin
b6321bd133 Add feature crate attribute for duration_checked_ops to docs 2016-09-14 17:13:06 -07:00
Eugene Bulkin
f2eb4f11d0 Fix doc-tests for Duration 2016-09-14 15:41:19 -07:00
bors
6ffdda1ba1 Auto merge of #36293 - liigo:docblock-short, r=steveklabnik
rustdoc: don't collapse `docblock-short`

![docblock-short](https://cloud.githubusercontent.com/assets/346530/18267298/137d2542-7451-11e6-9c8e-dd4e1f1fea29.png)
2016-09-14 15:39:23 -07:00
bors
5bdf79bf37 Auto merge of #36270 - petrochenkov:pipwarnagain, r=nikomatsakis
Make `private_in_public` compatibility lint warn-by-default again

More details: https://internals.rust-lang.org/t/regression-report-stable-2016-08-16-vs-beta-2016-08-26/3930/10

r? @nikomatsakis
2016-09-14 12:04:30 -07:00
Ulrik Sverdrup
a4ee9c6e96 core: Use primitive indexing in slice's Index/IndexMut
[T]'s Index implementation is normally not used for indexing, instead
the compiler supplied indexing is used.

Use the compiler supplied version in Index/IndexMut.

This removes an inconsistency:

Compiler supplied bound check failures look like this:

thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4'

If you convince Rust to use the Index impl for slices, bounds check
failure looks like this instead:

thread 'main' panicked at 'assertion failed: index < self.len()'

The latter is used if you for example use Index generically::

   use std::ops::Index;
   fn foo<T: ?Sized>(x: &T) where T: Index<usize> { &x[4]; }

   foo(&[1, 2, 3][..])
2016-09-14 20:19:35 +02:00
bors
5a5736db91 Auto merge of #36472 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #36334, #36335, #36363, #36374, #36467
- Failed merges:
2016-09-14 08:28:05 -07:00
Guillaume Gomez
e368cdd2d5 Rollup merge of #36467 - frewsxcv:ipaddr, r=GuillaumeGomez
Add doc examples for std::net::IpAddr construction.

None
2016-09-14 17:15:37 +02:00
Guillaume Gomez
a89690ec00 Rollup merge of #36396 - athulappadan:Default-docs, r=bluss
Documentation of what Default does for each type

Addresses #36265
I haven't changed the following types due to doubts:

1)src/libstd/ffi/c_str.rs
2)src/libcore/iter/sources.rs
3)src/libcore/hash/mod.rs
4)src/libcore/hash/mod.rs
5)src/librustc/middle/privacy.rs

r? @steveklabnik
2016-09-14 17:15:37 +02:00
Guillaume Gomez
4476b7b43b Rollup merge of #36374 - dangcheng:patch-1, r=steveklabnik
book: fix mistake (File::open -> File::create)
2016-09-14 17:15:37 +02:00
Guillaume Gomez
99c2f72814 Rollup merge of #36363 - GuillaumeGomez:add_urls, r=steveklabnik
Add urls

r? @steveklabnik
2016-09-14 17:15:37 +02:00
Guillaume Gomez
d939cbeefe Rollup merge of #36334 - GuillaumeGomez:run_but, r=steveklabnik
Set run button transparent instead of invisible

r? @steveklabnik

And of course a screenshot:

![screenshot from 2016-09-08 01-15-45](https://cloud.githubusercontent.com/assets/3050060/18331849/31fe1f8c-7562-11e6-9ae9-1dab44089ec6.png)
2016-09-14 17:15:36 +02:00
Niko Matsakis
6353e30bb2 clear obligations-added flag with nested fulfillcx
This flag is a debugging measure designed to detect cases where we start
a snapshot, create type variables, register obligations involving those
type variables in the fulfillment cx, and then have to unroll the
snapshot, leaving "dangling type variables" behind.  HOWEVER, in some
cases the flag is wrong. In particular, we sometimes create a
"mini-fulfilment-cx" in which we enroll obligations. As long as this
fulfillment cx is fully drained before we return, this is not a problem,
as there won't be any escaping obligations in the main cx. So we add a
fn to save/restore the flag.
2016-09-14 11:04:39 -04:00
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
bors
739d57180f Auto merge of #36041 - ahmedcharles:try, r=nrc
Replace try! with ?.
2016-09-13 22:41:34 -07: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