]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoFix the powerpc64 PATH
Josh Stone [Sun, 29 Jan 2017 06:02:49 +0000 (22:02 -0800)]
Fix the powerpc64 PATH

7 years agoAdd a license to build-powerpc64le-toolchain.sh
Josh Stone [Sun, 29 Jan 2017 05:41:35 +0000 (21:41 -0800)]
Add a license to build-powerpc64le-toolchain.sh

7 years agotravis: move IBM backwards in time
Josh Stone [Sun, 29 Jan 2017 05:25:11 +0000 (21:25 -0800)]
travis: move IBM backwards in time

Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.

This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).

For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.

This is ported from rust-lang/rust-buildbot#149.

r? @alexcrichton

7 years agoAuto merge of #39375 - seeekr:patch-1, r=apasel422
bors [Sat, 28 Jan 2017 23:14:22 +0000 (23:14 +0000)]
Auto merge of #39375 - seeekr:patch-1, r=apasel422

Fix typo in liballoc/lib.rs

7 years agoFix typo in liballoc/lib.rs
Denis Andrejew [Sat, 28 Jan 2017 22:16:16 +0000 (22:16 +0000)]
Fix typo in liballoc/lib.rs

7 years agoAuto merge of #39234 - segevfiner:fix-backtraces-on-windows-gnu, r=petrochenkov
bors [Sat, 28 Jan 2017 20:32:56 +0000 (20:32 +0000)]
Auto merge of #39234 - segevfiner:fix-backtraces-on-windows-gnu, r=petrochenkov

Make backtraces work on Windows GNU targets again.

This is done by adding a function that can return a filename
to pass to backtrace_create_state. The filename is obtained in
a safe way by first getting the filename, locking the file so it can't
be moved, and then getting the filename again and making sure it's the same.

See: https://github.com/rust-lang/rust/pull/37359#issuecomment-260123399
Issue: #33985

Note though that this isn't that pretty...

I had to implement a `WideCharToMultiByte` wrapper function to convert to the ANSI code page. This will work better than only allowing ASCII provided that the ANSI code page is set to the user's local language, which is often the case.

Also, please make sure that I didn't break the Unix build.

7 years agoDisable backtrace tests on i686-pc-windows-gnu since it's broken by FPO
Segev Finer [Sat, 28 Jan 2017 19:52:31 +0000 (21:52 +0200)]
Disable backtrace tests on i686-pc-windows-gnu since it's broken by FPO

7 years agoAuto merge of #39360 - osa1:typos, r=GuillaumeGomez
bors [Sat, 28 Jan 2017 14:13:00 +0000 (14:13 +0000)]
Auto merge of #39360 - osa1:typos, r=GuillaumeGomez

Fix typos in libsyntax/tokenstream.rs

7 years agoFix typos in libsyntax/tokenstream.rs
Ömer Sinan Ağacan [Sat, 28 Jan 2017 14:00:43 +0000 (17:00 +0300)]
Fix typos in libsyntax/tokenstream.rs

7 years agoAuto merge of #39340 - GuillaumeGomez:empty_comment, r=frewsxcv
bors [Sat, 28 Jan 2017 09:41:40 +0000 (09:41 +0000)]
Auto merge of #39340 - GuillaumeGomez:empty_comment, r=frewsxcv

Don't generate doc if doc comments only filled with 'white' characters

Fixes #39339.

r? @steveklabnik

cc @rust-lang/docs

7 years agoAuto merge of #39305 - eddyb:synelide, r=nikomatsakis
bors [Sat, 28 Jan 2017 06:21:23 +0000 (06:21 +0000)]
Auto merge of #39305 - eddyb:synelide, r=nikomatsakis

Perform lifetime elision (more) syntactically, before type-checking.

The *initial* goal of this patch was to remove the (contextual) `&RegionScope` argument passed around `rustc_typeck::astconv` and allow converting arbitrary (syntactic) `hir::Ty` to (semantic) `Ty`.
I've tried to closely match the existing behavior while moving the logic to the earlier `resolve_lifetime` pass, and [the crater report](https://gist.github.com/eddyb/4ac5b8516f87c1bfa2de528ed2b7779a) suggests none of the changes broke real code, but I will try to list everything:

There are few cases in lifetime elision that could trip users up due to "hidden knowledge":
```rust
type StaticStr = &'static str; // hides 'static
trait WithLifetime<'a> {
    type Output; // can hide 'a
}

// This worked because the type of the first argument contains
// 'static, although StaticStr doesn't even have parameters.
fn foo(x: StaticStr) -> &str { x }

// This worked because the compiler resolved the argument type
// to <T as WithLifetime<'a>>::Output which has the hidden 'a.
fn bar<'a, T: WithLifetime<'a>>(_: T::Output) -> &str { "baz" }
```

In the two examples above, elision wasn't using lifetimes that were in the source, not even *needed* by paths in the source, but rather *happened* to be part of the semantic representation of the types.
To me, this suggests they should have never worked through elision (and they don't with this PR).

Next we have an actual rule with a strange result, that is, the return type here elides to `&'x str`:
```rust
impl<'a, 'b> Trait for Foo<'a, 'b> {
    fn method<'x, 'y>(self: &'x Foo<'a, 'b>, _: Bar<'y>) -> &str {
        &self.name
    }
}
```
All 3 of `'a`, `'b` and `'y` are being ignored, because the `&self` elision rule only cares that the first argument is "`self` by reference". Due implementation considerations (elision running before typeck), I've limited it in this PR to a reference to a primitive/`struct`/`enum`/`union`, but not other types, but I am doing another crater run to assess the impact of limiting it to literally `&self` and `self: &Self` (they're identical in HIR).

It's probably ideal to keep an "implicit `Self` for `self`" type around and *only* apply the rule to `&self` itself, but that would result in more bikeshed, and #21400 suggests some people expect otherwise.
Another decent option is treating `self: X, ... -> Y` like `X -> Y` (one unique lifetime in `X` used for `Y`).

The remaining changes have to do with "object lifetime defaults" (see RFCs [599](https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md) and [1156](https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md)):
```rust
trait Trait {}
struct Ref2<'a, 'b, T: 'a+'b>(&'a T, &'b T);

// These apply specifically within a (fn) body,
// which allows type and lifetime inference:
fn main() {
    // Used to be &'a mut (Trait+'a) - where 'a is one
    // inference variable - &'a mut (Trait+'b) in this PR.
    let _: &mut Trait;

    // Used to be an ambiguity error, but in this PR it's
    // Ref2<'a, 'b, Trait+'c> (3 inference variables).
    let _: Ref2<Trait>;
}
```
What's happening here is that inference variables are created on the fly by typeck whenever a lifetime has no resolution attached to it - while it would be possible to alter the implementation to reuse inference variables based on decisions made early by `resolve_lifetime`, not doing that is more flexible and works better - it can compile all testcases from #38624 by not ending up with `&'static mut (Trait+'static)`.

The ambiguity specifically cannot be an early error, because this is only the "default" (typeck can still pick something better based on the definition of `Trait` and whether it has any lifetime bounds), and having an error at all doesn't help anyone, as we can perfectly infer an appropriate lifetime inside the `fn` body.

**TODO**: write tests for the user-visible changes.

cc @nikomatsakis @arielb1

7 years agoAuto merge of #39353 - alexcrichton:rollup, r=alexcrichton
bors [Sat, 28 Jan 2017 02:50:51 +0000 (02:50 +0000)]
Auto merge of #39353 - alexcrichton:rollup, r=alexcrichton

Rollup of 21 pull requests

- Successful merges: #38617, #39284, #39285, #39290, #39302, #39305, #39306, #39307, #39311, #39313, #39314, #39321, #39325, #39332, #39335, #39344, #39345, #39346, #39348, #39350, #39351
- Failed merges:

7 years agotest: add missing lifetime in recently added test.
Eduard-Mihai Burtescu [Fri, 27 Jan 2017 17:03:59 +0000 (19:03 +0200)]
test: add missing lifetime in recently added test.

7 years agorustc: remove unused `bounds` field from `RegionParameterDef`.
Eduard-Mihai Burtescu [Wed, 25 Jan 2017 16:39:21 +0000 (18:39 +0200)]
rustc: remove unused `bounds` field from `RegionParameterDef`.

7 years agorustc: move object default lifetimes to resolve_lifetimes.
Eduard-Mihai Burtescu [Wed, 25 Jan 2017 15:32:44 +0000 (17:32 +0200)]
rustc: move object default lifetimes to resolve_lifetimes.

7 years agorustc: always keep an explicit lifetime in trait objects.
Eduard-Mihai Burtescu [Tue, 24 Jan 2017 15:17:06 +0000 (17:17 +0200)]
rustc: always keep an explicit lifetime in trait objects.

7 years agorustc: lower trait type paths as TyTraitObject.
Eduard-Mihai Burtescu [Tue, 17 Jan 2017 14:46:23 +0000 (16:46 +0200)]
rustc: lower trait type paths as TyTraitObject.

7 years agorustc_typeck: move impl Trait checks out of RegionScope.
Eduard-Mihai Burtescu [Fri, 13 Jan 2017 13:10:37 +0000 (15:10 +0200)]
rustc_typeck: move impl Trait checks out of RegionScope.

7 years agorustc: move most of lifetime elision to resolve_lifetimes.
Eduard-Mihai Burtescu [Fri, 13 Jan 2017 13:09:56 +0000 (15:09 +0200)]
rustc: move most of lifetime elision to resolve_lifetimes.

7 years agorustc: simplify scope-tracking in resolve_lifetime.
Eduard-Mihai Burtescu [Wed, 11 Jan 2017 15:35:54 +0000 (17:35 +0200)]
rustc: simplify scope-tracking in resolve_lifetime.

7 years agorustc: clean up the style of middle::resolve_lifetime.
Eduard-Mihai Burtescu [Sun, 8 Jan 2017 20:40:04 +0000 (22:40 +0200)]
rustc: clean up the style of middle::resolve_lifetime.

7 years agorustc: always include elidable lifetimes in HIR types.
Eduard-Mihai Burtescu [Mon, 9 Jan 2017 15:46:11 +0000 (17:46 +0200)]
rustc: always include elidable lifetimes in HIR types.

7 years agorustc_typeck: pass all lifetimes through AstConv::opt_ast_region_to_region.
Eduard-Mihai Burtescu [Wed, 4 Jan 2017 21:23:11 +0000 (23:23 +0200)]
rustc_typeck: pass all lifetimes through AstConv::opt_ast_region_to_region.

7 years agorustc_typeck: force users of RegionScope to get anon_region's one by one.
Eduard-Mihai Burtescu [Wed, 4 Jan 2017 12:32:44 +0000 (14:32 +0200)]
rustc_typeck: force users of RegionScope to get anon_region's one by one.

7 years agoRollup merge of #39351 - nikomatsakis:incr-comp-skip-typeck-1, r=eddyb
Alex Crichton [Fri, 27 Jan 2017 22:41:31 +0000 (14:41 -0800)]
Rollup merge of #39351 - nikomatsakis:incr-comp-skip-typeck-1, r=eddyb

move `cast_kinds` into `TypeckTables` where it belongs

r? @eddyb

7 years agoRollup merge of #39350 - nagisa:i128-test-helpers-better-def, r=alexcrichton
Alex Crichton [Fri, 27 Jan 2017 22:41:30 +0000 (14:41 -0800)]
Rollup merge of #39350 - nagisa:i128-test-helpers-better-def, r=alexcrichton

Use __SIZEOF_INT128__ to test __int128 presence

Previously we tested whether a handful of preprocessor variables indicating certain 64 bit
platforms, but this does not work for other 64 bit targets which have support for __int128 in C
compiler.

Use the `__SIZEOF__INT128__` preprocessor variable instead. This variable gets set to 16 by gcc and
clang for every target where __int128 is supported.

7 years agoRollup merge of #39348 - steveklabnik:cyryl-mailmap, r=alexcrichton
Alex Crichton [Fri, 27 Jan 2017 22:41:29 +0000 (14:41 -0800)]
Rollup merge of #39348 - steveklabnik:cyryl-mailmap, r=alexcrichton

Fix cyryl's mailmap entry

7 years agoRollup merge of #39346 - steveklabnik:jethro-mailmap, r=brson
Alex Crichton [Fri, 27 Jan 2017 22:41:28 +0000 (14:41 -0800)]
Rollup merge of #39346 - steveklabnik:jethro-mailmap, r=brson

Fix @jethrogb's mailmap entry

cc rust-lang-nursery/thanks#51

7 years agoRollup merge of #39345 - steveklabnik:carol-mailmap, r=alexcrichton
Alex Crichton [Fri, 27 Jan 2017 22:41:27 +0000 (14:41 -0800)]
Rollup merge of #39345 - steveklabnik:carol-mailmap, r=alexcrichton

Fix up @carols10cents' mailmap entry

The previous ways didn't work; this does.

cc rust-lang-nursery/thanks#45

7 years agoRollup merge of #39344 - ollie27:links, r=steveklabnik
Alex Crichton [Fri, 27 Jan 2017 22:41:26 +0000 (14:41 -0800)]
Rollup merge of #39344 - ollie27:links, r=steveklabnik

Fix a few links in the docs

r? @steveklabnik

7 years agoRollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkov
Alex Crichton [Fri, 27 Jan 2017 22:41:24 +0000 (14:41 -0800)]
Rollup merge of #39335 - cramertj:cramertj/can_begin_expr_fix, r=petrochenkov

Fix can_begin_expr keyword behavior

Partial fix for #28784.

7 years agoRollup merge of #39332 - nagisa:another-bigendian-128, r=eddyb
Alex Crichton [Fri, 27 Jan 2017 22:41:23 +0000 (14:41 -0800)]
Rollup merge of #39332 - nagisa:another-bigendian-128, r=eddyb

Fix another endianness issue in i128 trans

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than host-endian 64-bytes. This is weird, and obviously, not documented. And rustc now works a teeny bit more on big endians.

r? @eddyb

7 years agoRollup merge of #39321 - king6cong:master, r=frewsxcv
Alex Crichton [Fri, 27 Jan 2017 22:41:21 +0000 (14:41 -0800)]
Rollup merge of #39321 - king6cong:master, r=frewsxcv

doc comment typo fix

7 years agoRollup merge of #39314 - stjepang:rewrite-sort-header, r=brson
Alex Crichton [Fri, 27 Jan 2017 22:41:20 +0000 (14:41 -0800)]
Rollup merge of #39314 - stjepang:rewrite-sort-header, r=brson

Rewrite the first sentence in slice::sort

For every method, the first sentence should consisely explain what it does,
not how. This sentence usually starts with a verb.

It's really weird for `sort` to be explained in terms of another function,
namely `sort_by`. There's no need for that because it's obvious how `sort`
sorts elements: there is `T: Ord`.

If `sort_by_key` does not have to explicitly state how it's implemented,
then `sort` doesn't either.

r? @steveklabnik

7 years agoRollup merge of #39313 - est31:drop_in_place_is_stable, r=GuillaumeGomez
Alex Crichton [Fri, 27 Jan 2017 22:41:19 +0000 (14:41 -0800)]
Rollup merge of #39313 - est31:drop_in_place_is_stable, r=GuillaumeGomez

drop_in_place is stable now, don't #![feature] it in the nomicon and a test.

It was stable since Rust 1.8.

r? @GuillaumeGomez

7 years agoRollup merge of #39311 - solson:fix-unpretty-mir-non-local, r=eddyb
Alex Crichton [Fri, 27 Jan 2017 22:41:18 +0000 (14:41 -0800)]
Rollup merge of #39311 - solson:fix-unpretty-mir-non-local, r=eddyb

Avoid ICE when pretty-printing non-local MIR item.

This comes up when using `-Zunstable-options --unpretty=mir`. Previously, rustc would ICE due to an unwrap later in this function (after `as_local_node_id`). Instead, we should just ignore items from other crates when pretty-printing MIR.

This was reported in #rust: [this playground code](https://is.gd/PSMBZS) causes an ICE if you click the MIR button. The problem is the mention of the non-local item `std::usize::MAX`, so you can reduce the test case [a lot](https://is.gd/SaLjaa).

r? @eddyb

7 years agoRollup merge of #39307 - alexcrichton:stabilize-1.16, r=brson
Alex Crichton [Fri, 27 Jan 2017 22:41:17 +0000 (14:41 -0800)]
Rollup merge of #39307 - alexcrichton:stabilize-1.16, r=brson

std: Stabilize APIs for the 1.16.0 release

This commit applies the stabilization/deprecations of the 1.16.0 release, as
tracked by the rust-lang/rust issue tracker and the final-comment-period tag.

The following APIs were stabilized:

* `VecDeque::truncate`
* `VecDeque::resize`
* `String::insert_str`
* `Duration::checked_{add,sub,div,mul}`
* `str::replacen`
* `SocketAddr::is_ipv{4,6}`
* `IpAddr::is_ipv{4,6}`
* `str::repeat`
* `Vec::dedup_by`
* `Vec::dedup_by_key`
* `Result::unwrap_or_default`
* `<*const T>::wrapping_offset`
* `<*mut T>::wrapping_offset`
* `CommandExt::creation_flags` (on Windows)
* `File::set_permissions`
* `String::split_off`

The following APIs were deprecated

* `EnumSet` - replaced with other ecosystem abstractions, long since unstable

Closes #27788
Closes #35553
Closes #35774
Closes #36436
Closes #36949
Closes #37079
Closes #37087
Closes #37516
Closes #37827
Closes #37916
Closes #37966
Closes #38080

7 years agoRollup merge of #39306 - GuillaumeGomez:newtype_help, r=eddyb
Alex Crichton [Fri, 27 Jan 2017 22:41:16 +0000 (14:41 -0800)]
Rollup merge of #39306 - GuillaumeGomez:newtype_help, r=eddyb

Add note for E0117

Fixes #39249.

I just applied the suggestion of @durka since I don't see anything else to add.

7 years agoRollup merge of #39302 - alexcrichton:upload-all, r=brson
Alex Crichton [Fri, 27 Jan 2017 22:41:13 +0000 (14:41 -0800)]
Rollup merge of #39302 - alexcrichton:upload-all, r=brson

travis: Upload all artifacts in build/dist

Previously we only uploaded tarballs, but this modifies Travis/AppVeyor to
upload everything. We shouldn't have anything else in there to worry about and
otherwise we need to be sure to pick up pkg/msi/exe installers.

7 years agoRollup merge of #39290 - canndrew:hide-uninhabitedness, r=nikomatsakis
Alex Crichton [Fri, 27 Jan 2017 22:41:12 +0000 (14:41 -0800)]
Rollup merge of #39290 - canndrew:hide-uninhabitedness, r=nikomatsakis

Hide uninhabitedness checks behind feature gate

This reverts the fix to match exhaustiveness checking so that it can be discussed. The new code is now hidden behind the `never_type` feature gate.

7 years agoRollup merge of #39285 - nrc:save-tables, r=@eddyb
Alex Crichton [Fri, 27 Jan 2017 22:41:11 +0000 (14:41 -0800)]
Rollup merge of #39285 - nrc:save-tables, r=@eddyb

save-analysis: get tables directly, accomodating them being missing

Fixes an ICE when running with save-analysis after an error

r? @eddyb

7 years agoRollup merge of #39284 - alexcrichton:manifesting, r=brson
Alex Crichton [Fri, 27 Jan 2017 22:41:10 +0000 (14:41 -0800)]
Rollup merge of #39284 - alexcrichton:manifesting, r=brson

rustbuild: Add manifest generation in-tree

This commit adds a new tool, `build-manifest`, which is used to generate a
distribution manifest of all produced artifacts. This tool is intended to
replace the `build-rust-manifest.py` script that's currently located on the
buildmaster. The intention is that we'll have a builder which periodically:

* Downloads all artifacts for a commit
* Runs `./x.py dist hash-and-sign`. This will generate `sha256` and `asc` files
  as well as TOML manifests.
* Upload all generated hashes and manifests to the directory the artifacts came
  from.
* Upload *all* artifacts (tarballs and hashes and manifests) to an archived
  location.
* If necessary, upload all artifacts to the main location.

This script is intended to just be the second step here where orchestrating
uploads and such will all happen externally from the build system itself.

cc #38531

7 years agoRollup merge of #38617 - pnkfelix:double-reference, r=pnkfelix
Alex Crichton [Fri, 27 Jan 2017 22:41:09 +0000 (14:41 -0800)]
Rollup merge of #38617 - pnkfelix:double-reference, r=pnkfelix

Detect double reference when applying binary op

``` rust
let vr = v.iter().filter(|x| {
    x % 2 == 0
});
```

will now yield the following compiler output:

``` bash
ERROR binary operation `%` cannot be applied to type `&&_`
NOTE this is a reference of a reference to a type that `%` can be applied to,
you need to dereference this variable once for this operation to work
NOTE an implementation of `std::ops::Rem` might be missing for `&&_`
```

The first NOTE is new.

Fix #33877

----

Thanks to @estebank for providing the original PR #34420 (of which this is a tweaked rebase).

7 years agoUse libc::c_char instead of i8 due to platforms with unsigned char
Segev Finer [Fri, 27 Jan 2017 23:01:16 +0000 (01:01 +0200)]
Use libc::c_char instead of i8 due to platforms with unsigned char

7 years agoDon't generate doc if doc comments only filled with 'white' characters
Guillaume Gomez [Fri, 27 Jan 2017 15:59:35 +0000 (16:59 +0100)]
Don't generate doc if doc comments only filled with 'white' characters

7 years agoAuto merge of #37057 - brson:nosuggest, r=nikomatsakis
bors [Fri, 27 Jan 2017 22:13:41 +0000 (22:13 +0000)]
Auto merge of #37057 - brson:nosuggest, r=nikomatsakis

rustc: Remove all "consider using an explicit lifetime parameter" suggestions

These give so many incorrect suggestions that having them is
detrimental to the user experience. The compiler should not be
suggesting changes to the code that are wrong - it is infuriating: not
only is the compiler telling you that _you don't understand_ borrowing,
_the compiler itself_ appears to not understand borrowing. It does not
inspire confidence.

r? @nikomatsakis

7 years agoUse __SIZEOF_INT128__ to test __int128 presence
Simonas Kazlauskas [Fri, 27 Jan 2017 21:23:26 +0000 (23:23 +0200)]
Use __SIZEOF_INT128__ to test __int128 presence

Previously we tested whether a handful of preprocessor variables indicating certain 64 bit
platforms, but this does not work for other 64 bit targets which have support for __int128 in C
compiler.

Use the __SIZEOF__INT128__ preprocessor variable instead. This variable gets set to 16 by gcc and
clang for every target where __int128 is supported.

7 years agomove `cast_kinds` into `TypeckTables` where it belongs
Niko Matsakis [Fri, 27 Jan 2017 21:16:43 +0000 (16:16 -0500)]
move `cast_kinds` into `TypeckTables` where it belongs

7 years agoFix cyryl's mailmap entry
Steve Klabnik [Fri, 27 Jan 2017 20:27:26 +0000 (15:27 -0500)]
Fix cyryl's mailmap entry

7 years agoFix @jethrogb's mailmap entry
Steve Klabnik [Fri, 27 Jan 2017 20:19:30 +0000 (15:19 -0500)]
Fix @jethrogb's mailmap entry

cc rust-lang-nursery/thanks#51

7 years agoFix up @carols10cents' mailmap entry
Steve Klabnik [Fri, 27 Jan 2017 19:29:11 +0000 (14:29 -0500)]
Fix up @carols10cents' mailmap entry

The previous ways didn't work; this does.

cc rust-lang-nursery/thanks#45

7 years agoAuto merge of #39320 - alexcrichton:less-backtraces, r=aturon
bors [Fri, 27 Jan 2017 18:12:04 +0000 (18:12 +0000)]
Auto merge of #39320 - alexcrichton:less-backtraces, r=aturon

travis: Turn off core dumps on OSX

I've seen these take up quite a bit of log space and I have the sneaking
suspicion that they're just making our test suite take longer (sometimes timing
out on 32-bit OSX now). In any case the backtraces haven't proven too useful,
unfortunately.

7 years agoFix a few links in the docs
Oliver Middleton [Fri, 27 Jan 2017 18:08:51 +0000 (18:08 +0000)]
Fix a few links in the docs

7 years agoAuto merge of #39282 - petrochenkov:selfstab, r=nikomatsakis
bors [Fri, 27 Jan 2017 12:23:23 +0000 (12:23 +0000)]
Auto merge of #39282 - petrochenkov:selfstab, r=nikomatsakis

Stabilize Self and associated types in struct expressions and patterns

Rebase of https://github.com/rust-lang/rust/pull/37734
Closes https://github.com/rust-lang/rust/issues/37544
r? @nikomatsakis

7 years agoAuto merge of #39252 - alexcrichton:less-exports, r=nrc
bors [Fri, 27 Jan 2017 10:01:45 +0000 (10:01 +0000)]
Auto merge of #39252 - alexcrichton:less-exports, r=nrc

Hide a few more standard library symbols

These commits touch up some of the symbol visibility rules for some crates related to the standard library, notably:

* Symbols that are `pub extern` and `#[no_mangle]` which are internal-to-rust ABI things are no longer at the `C` export level, but the `Rust` export level. This includes allocators, panic runtimes, and compiler builtins.
* The libbacktrace library is now compiled with `-fvisibility=hidden` to ensure that we don't export those symbols.

7 years agoAttempt at fixing dead code lints
Segev Finer [Fri, 27 Jan 2017 09:33:24 +0000 (11:33 +0200)]
Attempt at fixing dead code lints

7 years agostd: Compile libbacktrace with -fvisibility=hidden
Alex Crichton [Sun, 22 Jan 2017 20:58:56 +0000 (12:58 -0800)]
std: Compile libbacktrace with -fvisibility=hidden

We don't want these symbols exported from the standard library, this is
just an internal implementation detail of the standard library
currently.

Closes #34984

7 years agorustc: Don't export builtins/panic/alloc syms
Alex Crichton [Sun, 22 Jan 2017 20:53:35 +0000 (12:53 -0800)]
rustc: Don't export builtins/panic/alloc syms

This hides symbols from various unstable and implementation-detail
crates of the standard library. Although typically transitive exported
`pub extern` functions are exported from cdylibs, these crates aren't
necessary as they're all implementation details.

Closes #34493

7 years agoAuto merge of #39281 - michaelwoerister:make-cc-incr-comp-opt-in, r=nikomatsakis
bors [Fri, 27 Jan 2017 07:36:43 +0000 (07:36 +0000)]
Auto merge of #39281 - michaelwoerister:make-cc-incr-comp-opt-in, r=nikomatsakis

incr.comp.: Make cross-crate tracking for incr. comp. opt-in.

The current implementation of cross-crate dependency tracking can cause quite long compile times and high memory usage for some crates (see #39208 for example). This PR therefore makes that part of dependency tracking optional. Incremental compilation still works, it will only have very coarse dep-tracking for upstream crates.

r? @nikomatsakis

7 years agoFix can_begin_expr keyword behavior
Taylor Cramer [Fri, 27 Jan 2017 05:51:20 +0000 (21:51 -0800)]
Fix can_begin_expr keyword behavior

7 years agoAuto merge of #39139 - estebank:issue-38147, r=nikomatsakis
bors [Fri, 27 Jan 2017 04:57:12 +0000 (04:57 +0000)]
Auto merge of #39139 - estebank:issue-38147, r=nikomatsakis

Point to immutable arg/fields when trying to use as &mut

Present the following output when trying to access an immutable borrow's
field as mutable:

```
error[E0389]: cannot borrow data mutably in a `&` reference
  --> $DIR/issue-38147-1.rs:27:9
   |
26 | fn f(&self) {
   |      -----  use `&mut self` here to make mutable
27 |     f.s.push('x');
   |     ^^^ assignment into an immutable reference
```

And the following when trying to access an immutable struct field as mutable:

```
error: cannot borrow immutable borrowed content `*self.s` as mutable
  --> $DIR/issue-38147-3.rs:17:9
   |
12 |     s: &'a String
   |     ------------- use `&'a mut String` here to make mutable
...|
16 |     fn f(&self) {
   |          -----  use `&mut self` here to make mutable
17 |         self.s.push('x');
   |         ^^^^^^ cannot borrow as mutable
```

Fixes #38147.

7 years agoFix another endian-ness issue in i128 trans
Simonas Kazlauskas [Fri, 27 Jan 2017 02:36:12 +0000 (04:36 +0200)]
Fix another endian-ness issue in i128 trans

Apparently LLVMArbitraryPrecisionInteger demands integers to be in low-endian 64-bytes, rather than
host-endian 64-bytes. This is weird, and obviously, not documented. Also, fixed now. And rustc now
works a teeny bit more on big endians.

7 years agoAuto merge of #39158 - petrochenkov:bounds, r=nikomatsakis
bors [Fri, 27 Jan 2017 01:27:12 +0000 (01:27 +0000)]
Auto merge of #39158 - petrochenkov:bounds, r=nikomatsakis

Bounds parsing refactoring 2

See https://github.com/rust-lang/rust/pull/37511 for previous discussion.
cc @matklad

Relaxed parsing rules:
 - zero bounds after `:` are allowed in all contexts.
 - zero predicates are allowed after `where`.
- trailing separator `,` is allowed after predicates in `where` clauses not followed by `{`.

Other parsing rules:
 - trailing separator `+` is still allowed in all bound lists.

Code is also cleaned up and tests added.

I haven't touched parsing of trait object types yet, I'll do it later.

7 years agorustc: Remove all "consider using an explicit lifetime parameter" suggestions
Brian Anderson [Sun, 9 Oct 2016 17:30:11 +0000 (10:30 -0700)]
rustc: Remove all "consider using an explicit lifetime parameter" suggestions

These give so many incorrect suggestions that having them is
detrimental to the user experience. The compiler should not be
suggesting changes to the code that are wrong - it is infuriating: not
only is the compiler telling you that _you don't understand_ borrowing,
_the compiler itself_ appears to not understand borrowing. It does not
inspire confidence.

7 years agoPoint to immutable arg/fields when trying to use as &mut
Esteban Küber [Tue, 17 Jan 2017 07:42:11 +0000 (23:42 -0800)]
Point to immutable arg/fields when trying to use as &mut

Point to immutable borrow arguments and fields when trying to use them as
mutable borrows. Add label to primary span on "cannot borrow as mutable"
errors.

Present the following output when trying to access an immutable borrow's
field as mutable:

```
error[E0389]: cannot borrow data mutably in a `&` reference
  --> $DIR/issue-38147-1.rs:27:9
   |
26 | fn f(&self) {
   |      -----  use `&mut self` here to make mutable
27 |     f.s.push('x');
   |     ^^^ assignment into an immutable reference
```

And the following when trying to access an immutable struct field as mutable:

```
error: cannot borrow immutable borrowed content `*self.s` as mutable
  --> $DIR/issue-38147-3.rs:17:9
   |
12 |     s: &'a String
   |     ------------- use `&'a mut String` here to make mutable
...|
16 |     fn f(&self) {
   |          -----  use `&mut self` here to make mutable
17 |         self.s.push('x');
   |         ^^^^^^ cannot borrow as mutable
```

7 years agoAvoid ICE when pretty-printing non-local MIR item.
Scott Olson [Thu, 26 Jan 2017 05:16:38 +0000 (21:16 -0800)]
Avoid ICE when pretty-printing non-local MIR item.

This comes up when using `-Zunstable-options --unpretty=mir`.
Previously, rustc would ICE due to an unwrap later in this function
(after `as_local_node_id`). Instead, we should just ignore items from
other crates when pretty-printing MIR.

7 years agosave-analysis: get tables directly, accomodating them being missing
Nick Cameron [Wed, 25 Jan 2017 01:40:47 +0000 (14:40 +1300)]
save-analysis: get tables directly, accomodating them being missing

Fixes an ICE when running with save-analsysis after an error

7 years agodoc comment typo fix
king6cong [Thu, 26 Jan 2017 18:05:33 +0000 (02:05 +0800)]
doc comment typo fix

7 years agoAuto merge of #39066 - arielb1:lifetime-extension-test, r=nikomatsakis
bors [Thu, 26 Jan 2017 17:42:52 +0000 (17:42 +0000)]
Auto merge of #39066 - arielb1:lifetime-extension-test, r=nikomatsakis

End temporary lifetimes being extended by `let X: &_` hints

cc #39283

r? @nikomatsakis

7 years agotravis: Turn off core dumps on OSX
Alex Crichton [Thu, 26 Jan 2017 17:04:07 +0000 (09:04 -0800)]
travis: Turn off core dumps on OSX

I've seen these take up quite a bit of log space and I have the sneaking
suspicion that they're just making our test suite take longer (sometimes timing
out on 32-bit OSX now). In any case the backtraces haven't proven too useful,
unfortunately.

7 years agoAuto merge of #39309 - eddyb:map-shmap, r=nikomatsakis
bors [Thu, 26 Jan 2017 15:02:23 +0000 (15:02 +0000)]
Auto merge of #39309 - eddyb:map-shmap, r=nikomatsakis

Rename tcx.map to the far more descriptive tcx.hir.

Also a bit more renaming because `ast_map` and `'ast` were still used with HIR.
Main motivation is to "free up" `tcx.map`, or rather, `tcx.maps`, to consolidate `ty::maps` there.

r? @nikomatsakis

7 years agoBetter comments for FIXMEs
Vadim Petrochenkov [Thu, 26 Jan 2017 14:41:37 +0000 (17:41 +0300)]
Better comments for FIXMEs

7 years agoAuto merge of #38819 - GuillaumeGomez:main_func_wrong_type, r=GuillaumeGomez
bors [Thu, 26 Jan 2017 12:23:13 +0000 (12:23 +0000)]
Auto merge of #38819 - GuillaumeGomez:main_func_wrong_type, r=GuillaumeGomez

Add a distinct error code and description for "main function has wron…

…g type"

7 years agorustc: don't call the HIR AST.
Eduard-Mihai Burtescu [Thu, 26 Jan 2017 01:21:50 +0000 (03:21 +0200)]
rustc: don't call the HIR AST.

7 years agorustc: rename TyCtxt's `map` field to `hir`.
Eduard-Mihai Burtescu [Thu, 26 Jan 2017 00:41:06 +0000 (02:41 +0200)]
rustc: rename TyCtxt's `map` field to `hir`.

7 years agoAdd note for E0117
Guillaume Gomez [Wed, 25 Jan 2017 22:28:59 +0000 (23:28 +0100)]
Add note for E0117

7 years agoUpdate error code number
Guillaume Gomez [Thu, 26 Jan 2017 10:17:17 +0000 (11:17 +0100)]
Update error code number

7 years agoAdd a distinct error code and description for "main function has wrong type"
Guillaume Gomez [Wed, 4 Jan 2017 11:56:33 +0000 (12:56 +0100)]
Add a distinct error code and description for "main function has wrong type"

7 years agoRewrite the first sentence in slice::sort
Stjepan Glavina [Thu, 26 Jan 2017 10:09:45 +0000 (11:09 +0100)]
Rewrite the first sentence in slice::sort

For every method, the first sentence should consisely explain what it does,
not how. This sentence usually starts with a verb.

It's really weird for `sort` to be explained in terms of another function,
namely `sort_by`. There's no need for that because it's obvious how `sort`
sorts elements: there is `T: Ord`.

If `sort_by_key` does not have to explicitly state how it's implemented,
then `sort` doesn't either.

7 years agoAuto merge of #39075 - est31:remove_reflect, r=nikomatsakis
bors [Thu, 26 Jan 2017 09:54:03 +0000 (09:54 +0000)]
Auto merge of #39075 - est31:remove_reflect, r=nikomatsakis

Remove Reflect

PR for removing the `Reflect` trait. Opened so that a crater run can be done for testing the impact: https://github.com/rust-lang/rust/issues/27749#issuecomment-272665163

Fixes #27749

7 years agodrop_in_place is stable now, don't #![feature] it in the nomicon and a test
est31 [Thu, 26 Jan 2017 09:37:20 +0000 (10:37 +0100)]
drop_in_place is stable now, don't #![feature] it in the nomicon and a test

It was stable since Rust 1.8.

7 years agoAuto merge of #39000 - nikomatsakis:incr_comp_crosscontaminate_impl_item, r=michaelwo...
bors [Thu, 26 Jan 2017 04:25:03 +0000 (04:25 +0000)]
Auto merge of #39000 - nikomatsakis:incr_comp_crosscontaminate_impl_item, r=michaelwoerister

process trait/impl items directly from the visitor callback

The current setup processes impl/trait items while visiting
the impl/trait. This means we basically have this setup:

    <Lots> -> TypeckItemBody(Impl) -> Tables(ImplItem{0,1,2,3})

But this was largely an artifact of the older code. By moving the
processing of items into method dedicated for their use, we produce this
setup:

    <Little> -> TypeckItemBody(ImplItem0) -> Tables(ImplItem0)
    ...
    <Little> -> TypeckItemBody(ImplItem3) -> Tables(ImplItem3)

r? @michaelwoerister

Also, we might consider removing the `TypeckItemBody` node altogether and just using `Tables` as the task. `Tables` is its primary output, I imagine? That would reduce size of dep-graph somewhat.

cc @eddyb -- perhaps this pattern applies elsewhere?

7 years agoAuto merge of #38961 - steveklabnik:fix-sort-wording, r=alexcrichton
bors [Thu, 26 Jan 2017 01:51:26 +0000 (01:51 +0000)]
Auto merge of #38961 - steveklabnik:fix-sort-wording, r=alexcrichton

Fix wording around sort guarantees

Fixes #38524

/cc @rust-lang/libs @stjepang

7 years agostd: Stabilize APIs for the 1.16.0 release
Alex Crichton [Wed, 25 Jan 2017 23:37:20 +0000 (15:37 -0800)]
std: Stabilize APIs for the 1.16.0 release

This commit applies the stabilization/deprecations of the 1.16.0 release, as
tracked by the rust-lang/rust issue tracker and the final-comment-period tag.

The following APIs were stabilized:

* `VecDeque::truncate`
* `VecDeque::resize`
* `String::insert_str`
* `Duration::checked_{add,sub,div,mul}`
* `str::replacen`
* `SocketAddr::is_ipv{4,6}`
* `IpAddr::is_ipv{4,6}`
* `str::repeat`
* `Vec::dedup_by`
* `Vec::dedup_by_key`
* `Result::unwrap_or_default`
* `<*const T>::wrapping_offset`
* `<*mut T>::wrapping_offset`
* `CommandExt::creation_flags` (on Windows)
* `File::set_permissions`
* `String::split_off`

The following APIs were deprecated

* `EnumSet` - replaced with other ecosystem abstractions, long since unstable

Closes #27788
Closes #35553
Closes #35774
Closes #36436
Closes #36949
Closes #37079
Closes #37087
Closes #37516
Closes #37827
Closes #37916
Closes #37966
Closes #38080

7 years agoAuto merge of #38920 - petrochenkov:selfimpl, r=eddyb
bors [Wed, 25 Jan 2017 23:08:56 +0000 (23:08 +0000)]
Auto merge of #38920 - petrochenkov:selfimpl, r=eddyb

Partially implement RFC 1647 (`Self` in impl headers)

The name resolution part is easy, but the typeck part contains an unexpected problem.

It turns out that `Self` type *depends* on bounds and `where` clauses, so we need to convert them first to determine what the `Self` type is! If bounds/`where` clauses can refer to `Self` then we have a cyclic dependency.
This is required to support impls like this:
```
// Found in libcollections
impl<I: IntoIterator> SpecExtend<I> for LinkedList<I::Item> { .... }
                                                      ^^^^^ associated type `Item` is found using information from bounds

```
I'm not yet sure how to resolve this issue.
One possible solution (that feels hacky) is to make two passes over generics - first collect predicates ignoring everything involving `Self`, then determine `Self`, then collect predicates again without ignoring anything. (Some kind of lazy on-demand checking or something looks like a proper solution.)

This patch in its current state doesn't solve the problem with `Self` in bounds, so the only observable things it does is improving error messages and supporting `impl Trait<Self> for Type {}`.

There's also a question about feature gating. It's non-trivial to *detect* "newly resolved" `Self`s to feature gate them, but it's simple to *enable* the new resolution behavior when the feature gate is already specified. Alternatively this can be considered a bug fix and merged without a feature gate.

cc https://github.com/rust-lang/rust/issues/38864
r? @nikomatsakis
cc @eddyb
Whitespace ignoring diff https://github.com/rust-lang/rust/pull/38920/files?w=1

7 years agorename `Tables` to `TypeckTables`
Niko Matsakis [Wed, 25 Jan 2017 21:24:00 +0000 (16:24 -0500)]
rename `Tables` to `TypeckTables`

7 years agoremove outdated text
Niko Matsakis [Wed, 25 Jan 2017 20:56:30 +0000 (15:56 -0500)]
remove outdated text

7 years agomerge TypeckItemBody and Tables depnodes
Niko Matsakis [Thu, 12 Jan 2017 23:11:02 +0000 (18:11 -0500)]
merge TypeckItemBody and Tables depnodes

7 years agofix the test case by supplying proper options
Niko Matsakis [Thu, 12 Jan 2017 17:01:18 +0000 (12:01 -0500)]
fix the test case by supplying proper options

7 years agopacify the mercilous tidy
Niko Matsakis [Wed, 11 Jan 2017 21:13:07 +0000 (16:13 -0500)]
pacify the mercilous tidy

7 years agoprocess trait/impl items directly from the visitor callback
Niko Matsakis [Wed, 11 Jan 2017 20:46:11 +0000 (15:46 -0500)]
process trait/impl items directly from the visitor callback

The current setup processes impl/trait items while visiting
the impl/trait. This means we basically have this setup:

    <Lots> -> TypeckItemBody(Impl) -> Tables(ImplItem{0,1,2,3})

But this was largely an artifact of the older code. By moving the
processing of items into method dedicated for their use, we produce this
setup:

    <Little> -> TypeckItemBody(ImplItem0) -> Tables(ImplItem0)
    ...
    <Little> -> TypeckItemBody(ImplItem3) -> Tables(ImplItem3)

7 years agoAuto merge of #38856 - zackw:process-envs, r=aturon
bors [Wed, 25 Jan 2017 20:24:02 +0000 (20:24 +0000)]
Auto merge of #38856 - zackw:process-envs, r=aturon

Add std::process::Command::envs()

`Command::envs()` adds a vector of key-value pairs to the child
process environment all at once.  Suggested in #38526.

This is not fully baked and frankly I'm not sure it even _works_, but I need some help finishing it up, and this is the simplest way to show you what I've got.  The problems I know exist and don't know how to solve, from most to least important, are:

* [ ] I don't know if the type signature of the new function is correct.
* [x] The new test might not be getting run.  I didn't see it go by in the output of `x.py test src/libstd --stage 1`.
* [x] The tidy check says ``process.rs:402: different `since` than before`` which I don't know what it means.

r? @brson

7 years agotravis: Upload all artifacts in build/dist
Alex Crichton [Wed, 25 Jan 2017 19:55:30 +0000 (11:55 -0800)]
travis: Upload all artifacts in build/dist

Previously we only uploaded tarballs, but this modifies Travis/AppVeyor to
upload everything. We shouldn't have anything else in there to worry about and
otherwise we need to be sure to pick up pkg/msi/exe installers.

7 years agoRemove trailing whitespace
Stjepan Glavina [Fri, 20 Jan 2017 08:11:11 +0000 (09:11 +0100)]
Remove trailing whitespace

7 years agoFix: insertion_len -> max_insertion
Stjepan Glavina [Tue, 17 Jan 2017 00:11:06 +0000 (01:11 +0100)]
Fix: insertion_len -> max_insertion

7 years agoExpand the sort docs
Stjepan Glavina [Sat, 14 Jan 2017 00:46:30 +0000 (01:46 +0100)]
Expand the sort docs

7 years agoFix wording around sort guarantees
Steve Klabnik [Tue, 10 Jan 2017 15:23:21 +0000 (10:23 -0500)]
Fix wording around sort guarantees

Fixes #38524

7 years agorustbuild: Add manifest generation in-tree
Alex Crichton [Tue, 24 Jan 2017 22:37:04 +0000 (14:37 -0800)]
rustbuild: Add manifest generation in-tree

This commit adds a new tool, `build-manifest`, which is used to generate a
distribution manifest of all produced artifacts. This tool is intended to
replace the `build-rust-manifest.py` script that's currently located on the
buildmaster. The intention is that we'll have a builder which periodically:

* Downloads all artifacts for a commit
* Runs `./x.py dist hash-and-sign`. This will generate `sha256` and `asc` files
  as well as TOML manifests.
* Upload all generated hashes and manifests to the directory the artifacts came
  from.
* Upload *all* artifacts (tarballs and hashes and manifests) to an archived
  location.
* If necessary, upload all artifacts to the main location.

This script is intended to just be the second step here where orchestrating
uploads and such will all happen externally from the build system itself.

7 years agoAuto merge of #39296 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 25 Jan 2017 17:23:54 +0000 (17:23 +0000)]
Auto merge of #39296 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #38930, #39212, #39251, #39267, #39276, #39278
- Failed merges:

7 years agoRollup merge of #39278 - das-g:patch-1, r=steveklabnik
Guillaume Gomez [Wed, 25 Jan 2017 16:08:20 +0000 (17:08 +0100)]
Rollup merge of #39278 - das-g:patch-1, r=steveklabnik

fix book: refer to `add_two` as "tested function"

refer to `add_two` as "tested function" rather than "test function", which would be `it_works`