]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoFix UB in test helpers
Simonas Kazlauskas [Mon, 16 Jan 2017 09:46:00 +0000 (11:46 +0200)]
Fix UB in test helpers

Macro expansion producing defined has undefined behavior in C/C++.

7 years agoAuto merge of #38806 - comex:lint-attr-fix, r=nrc
bors [Mon, 16 Jan 2017 05:17:39 +0000 (05:17 +0000)]
Auto merge of #38806 - comex:lint-attr-fix, r=nrc

Fix lint attributes on non-item nodes.

Currently, late lint checking uses two HIR visitors: LateContext and
IdVisitor.  IdVisitor only overrides visit_id, and for each node searches
for builtin lints previously added to the session; LateContext overrides
a number of methods, and runs late lints.  When LateContext encounters an
item, it first has IdVisitor walk everything in it except nested items
(OnlyBodies), then recurses into it itself - i.e. there are two separate
walks.

Aside from apparently being unnecessary, this separation prevents lint
attributes (allow/deny/warn) on non-item HIR nodes from working
properly.  Test case:

```rust
// generates warning without this change
fn main() { #[allow(unreachable_code)] loop { break; break; } }
```

LateContext contains logic to merge attributes seen into the current lint
settings while walking (with_lint_attrs), but IdVisitor does not.  So
such attributes will affect late lints (because they are called from
LateContext), and if the node contains any items within it, they will
affect builtin lints within those items (because that IdVisitor is run
while LateContext is within the attributed node), but otherwise the
attributes will be ignored for builtin lints.

This change simply removes IdVisitor and moves its visit_id into
LateContext itself.  Hopefully this doesn't break anything...

Also added walk calls to visit_lifetime and visit_lifetime_def
respectively, so visit_lifetime_def will recurse into the lifetime and
visit_lifetime will recurse into the name.  In principle this could
confuse lint plugins.  This is "necessary" because walk_lifetime calls
visit_id on the lifetime; of course, an alternative would be directly
calling visit_id (which would require manually iterating over the
lifetimes in visit_lifetime_def), but that seems less clean.

7 years agoAuto merge of #39042 - alexcrichton:upload-more, r=brson
bors [Sun, 15 Jan 2017 23:49:24 +0000 (23:49 +0000)]
Auto merge of #39042 - alexcrichton:upload-more, r=brson

travis: Expand dist builder coverage

This commit adds six new travis matrix entires for doing cross-compiled
distribution builds of the compiler. The support added in #38731 allows us to
quickly compile a complete suite of distribution artifacts for cross-compiled
platforms, and currently each matrix entry (when fully cached) clocks in around
an hour to finish. Note that a full test run typically takes about two hours
right now.

With further optimizations coming down the pike in #39026 this commit also
starts doubling up cross-compiled distribution builders on each matrix entry. We
initially planned to do one build per entry, but it's looking like we may be
able to get by with more than one in each entry. Depending on how long these
builds take we may even be able to up it to three, but we'll start with two
first.

This commit then completes the suite of cross-compiled compilers that we're
going to compile, adding it for a whole litany of platforms detailed in the
changes to the docker files here. The existing `cross` image is also trimmed
down quite a bit to avoid duplicate work, and we'll eventually provision it for
far more cross compilation as well.

Note that the gcc toolchains installed to compile most of these compilers are
inappropriate for actualy distribution. The glibc they pull in is much newer
than we'd like, so before we turn nightlies off we'll need to tweak these docker
files to custom build toolchains like the current `linux-cross` docker image
does.

7 years agoAuto merge of #38610 - djzin:master, r=sfackler
bors [Sun, 15 Jan 2017 21:44:51 +0000 (21:44 +0000)]
Auto merge of #38610 - djzin:master, r=sfackler

Implementation of plan in issue #27787 for btree_range

Still some ergonomics to be worked on, the ::<str,_> is particularly unsightly

7 years agotravis: Expand dist builder coverage
Alex Crichton [Fri, 13 Jan 2017 17:18:09 +0000 (09:18 -0800)]
travis: Expand dist builder coverage

This commit adds six new travis matrix entires for doing cross-compiled
distribution builds of the compiler. The support added in #38731 allows us to
quickly compile a complete suite of distribution artifacts for cross-compiled
platforms, and currently each matrix entry (when fully cached) clocks in around
an hour to finish. Note that a full test run typically takes about two hours
right now.

With further optimizations coming down the pike in #39026 this commit also
starts doubling up cross-compiled distribution builders on each matrix entry. We
initially planned to do one build per entry, but it's looking like we may be
able to get by with more than one in each entry. Depending on how long these
builds take we may even be able to up it to three, but we'll start with two
first.

This commit then completes the suite of cross-compiled compilers that we're
going to compile, adding it for a whole litany of platforms detailed in the
changes to the docker files here. The existing `cross` image is also trimmed
down quite a bit to avoid duplicate work, and we'll eventually provision it for
far more cross compilation as well.

Note that the gcc toolchains installed to compile most of these compilers are
inappropriate for actualy distribution. The glibc they pull in is much newer
than we'd like, so before we turn nightlies off we'll need to tweak these docker
files to custom build toolchains like the current `linux-cross` docker image
does.

7 years agoAuto merge of #39063 - ruuda:covered-switch, r=alexcrichton
bors [Sun, 15 Jan 2017 15:03:10 +0000 (15:03 +0000)]
Auto merge of #39063 - ruuda:covered-switch, r=alexcrichton

Fix covered-switch-default warnings in RustWrapper

These switch statements cover all possible values, so the default case is dead code (it contains an `llvm_unreachable anyway`), triggering a `-Wcovered-switch-default` warning that pollutes the build output. Moving the unreachable after the switch resolves these warnings.

r? @rkruppe

7 years agoAuto merge of #39055 - aidanhs:aphs-deinit-before-init, r=alexcrichton
bors [Sun, 15 Jan 2017 13:00:49 +0000 (13:00 +0000)]
Auto merge of #39055 - aidanhs:aphs-deinit-before-init, r=alexcrichton

If submodule init fails, try from scratch

See #39051

I wonder if the cause could be some strange not-quite-checked-out state in a submodule. Try and fix this by force deinitialising everything before initialising (this will not throw away downloaded objects, git will skip them on the next attempt at cloning).

r? @alexcrichton

7 years agoAuto merge of #39052 - alexcrichton:fix-rebuild, r=brson
bors [Sun, 15 Jan 2017 11:03:48 +0000 (11:03 +0000)]
Auto merge of #39052 - alexcrichton:fix-rebuild, r=brson

rustbuild: Skip the build_helper crate in tests

I've been noticing some spurious recompiles of the final stage on Travis lately
and in debugging them I found a case where we were a little to eager to update
a stamp file due to the build_helper library being introduced during the testing
phase.

Part of the rustbuild system detects when libstd is recompiled and automatically
cleans out future directories to ensure that dirtyness propagation works. To do
this rustbuild doesn't know the artifact name of the standard library so it just
probes everything in the target directory, looking to see if anything changed.

The problem here happened where:

* First, rustbuild would compile everything (a normal build)
* Next, rustbuild would run all tests
* During testing, the libbuild_helper library was introduced into the target
  directory, making it look like a change happened because a file is newer
  than the newest was before
* Detecting a change, the next compilation would then cause rustbuild to clean
  out old artifacts and recompile everything again.

This commit fixes this problem by correcting rustbuild to just not test the
build_helper crate at all. This crate doesn't have any unit tests, nor is it
intended to. That way the target directories should stay the same throughout
testing after a previous build.

7 years agoAuto merge of #39045 - redox-os:process_try_wait, r=brson
bors [Sun, 15 Jan 2017 08:01:19 +0000 (08:01 +0000)]
Auto merge of #39045 - redox-os:process_try_wait, r=brson

Add try_wait to Redox process

This implements Process::try_wait on Redox

7 years agoAuto merge of #39040 - estebank:relevant-impl-multiline, r=nikomatsakis
bors [Sun, 15 Jan 2017 05:48:34 +0000 (05:48 +0000)]
Auto merge of #39040 - estebank:relevant-impl-multiline, r=nikomatsakis

Use multiline Diagnostic for "relevant impl" list

Provide the following output:

```
error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
  --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:38:8
   |
38 |     f1.foo(1usize);
   |        ^^^ the trait `Foo<usize>` is not implemented for `Bar`
   |
   = help: the following implementations were found:
             <Bar as Foo<i8>>
             <Bar as Foo<i16>>
             <Bar as Foo<i32>>
             <Bar as Foo<u8>>
           and 2 others

error: aborting due to previous error
```

instead of

```
error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
  --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:38:8
   |
38 |     f1.foo(1usize);
   |        ^^^ the trait `Foo<usize>` is not implemented for `Bar`
   |
   = help: the following implementations were found:
   = help:   <Bar as Foo<i8>>
   = help:   <Bar as Foo<i16>>
   = help:   <Bar as Foo<i32>>
   = help:   <Bar as Foo<u8>>
   = help: and 2 others

error: aborting due to previous error
```

7 years agoAuto merge of #39026 - alexcrichton:more-less-cross-stage0, r=aturon
bors [Sun, 15 Jan 2017 00:18:04 +0000 (00:18 +0000)]
Auto merge of #39026 - alexcrichton:more-less-cross-stage0, r=aturon

rustbuild: Actually don't build stage0 target rustc

This was attempted in #38853 but erroneously forgot one more case of where the
compiler was compiled. This commit fixes that up and adds a test to ensure this
doesn't sneak back in.

7 years agoMerge branch 'master' into lint-attr-fix
comex [Sat, 14 Jan 2017 23:04:27 +0000 (18:04 -0500)]
Merge branch 'master' into lint-attr-fix

7 years agoAuto merge of #39020 - michaelwoerister:dep-graph-dfs-caching, r=nikomatsakis
bors [Sat, 14 Jan 2017 22:00:43 +0000 (22:00 +0000)]
Auto merge of #39020 - michaelwoerister:dep-graph-dfs-caching, r=nikomatsakis

incr.comp.: Add some caching to Predecessors construction.

This speeds up the "serialize dep graph" pass for libsyntax from 45 secs to 15 secs on my machine. Still far from ideal, but things will get better when we change the metadata hashing strategy.

The `CACHING_THRESHOLD` value of 60 has been arrived at experimentally. It seemed to give the best speedup.

r? @nikomatsakis

7 years agoAuto merge of #38992 - nagisa:i128-minvallit, r=eddyb
bors [Sat, 14 Jan 2017 19:47:23 +0000 (19:47 +0000)]
Auto merge of #38992 - nagisa:i128-minvallit, r=eddyb

Fix two const-eval issues related to i128 negation

First issue here was the fact that we’d only allow negating integers in i64 range in case the
integer was not infered yes. While this is not the direct cause of the issue, its still good to fix
it.

The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW
has the expected value (0x8000_..._0000), match using this value as a pattern is handled
incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So
what we do here is extract this pattern into an explicit `==` until the next snapshot.

Fixes #38987

7 years agoadd required imports & feature
Djzin [Sat, 14 Jan 2017 17:40:52 +0000 (17:40 +0000)]
add required imports & feature

7 years agoAuto merge of #38982 - clarcharr:expect_err, r=aturon
bors [Sat, 14 Jan 2017 17:33:46 +0000 (17:33 +0000)]
Auto merge of #38982 - clarcharr:expect_err, r=aturon

expect_err for Result.

This adds an `expect_err` method to `Result`. Considering how `unwrap_err` already exists, this seems to make sense. Inconsistency noted in Manishearth/rust-clippy#1435.

7 years agoupdate array_vec to use new rangeargument
djzin [Sat, 14 Jan 2017 17:06:00 +0000 (17:06 +0000)]
update array_vec to use new rangeargument

7 years agoupdate docs with new syntax
djzin [Tue, 27 Dec 2016 15:37:36 +0000 (15:37 +0000)]
update docs with new syntax

7 years agoupdate docs with new syntax
djzin [Tue, 27 Dec 2016 15:28:58 +0000 (15:28 +0000)]
update docs with new syntax

7 years agofix warnings in doctests
djzin [Tue, 27 Dec 2016 15:27:18 +0000 (15:27 +0000)]
fix warnings in doctests

7 years agoshorten range syntax
djzin [Tue, 27 Dec 2016 11:35:56 +0000 (11:35 +0000)]
shorten range syntax

7 years agomake rangeargument methods non-default; simplify impl
djzin [Tue, 27 Dec 2016 10:22:17 +0000 (10:22 +0000)]
make rangeargument methods non-default; simplify impl

7 years agosimplify some ranges
djzin [Tue, 27 Dec 2016 10:05:49 +0000 (10:05 +0000)]
simplify some ranges

7 years agofix failing test
djzin [Mon, 26 Dec 2016 11:44:23 +0000 (11:44 +0000)]
fix failing test

7 years agoadd type annotations to doctest
djzin [Sun, 25 Dec 2016 09:37:35 +0000 (09:37 +0000)]
add type annotations to doctest

7 years agoadd test for range_mut
djzin [Sat, 24 Dec 2016 23:46:00 +0000 (23:46 +0000)]
add test for range_mut

7 years agouse str range for string btreemap in test
djzin [Sat, 24 Dec 2016 23:45:30 +0000 (23:45 +0000)]
use str range for string btreemap in test

7 years agouse rangeargument for range_mut
djzin [Sat, 24 Dec 2016 23:10:00 +0000 (23:10 +0000)]
use rangeargument for range_mut

7 years agoallow unsized types in `RangeArgument`
djzin [Sat, 24 Dec 2016 16:18:24 +0000 (16:18 +0000)]
allow unsized types in `RangeArgument`

7 years agofix up tests
djzin [Sat, 24 Dec 2016 16:17:22 +0000 (16:17 +0000)]
fix up tests

7 years agofix up tests
djzin [Fri, 23 Dec 2016 23:51:32 +0000 (23:51 +0000)]
fix up tests

7 years agochange argument for btree_range
djzin [Fri, 23 Dec 2016 23:51:00 +0000 (23:51 +0000)]
change argument for btree_range

7 years agoimpl RangeArgument for (Bound<T>, Bound<T>)
djzin [Fri, 23 Dec 2016 21:19:21 +0000 (21:19 +0000)]
impl RangeArgument for (Bound<T>, Bound<T>)

7 years agohave RangeArgument return a Bound<&T> from each of its methods
djzin [Fri, 23 Dec 2016 19:15:56 +0000 (19:15 +0000)]
have RangeArgument return a Bound<&T> from each of its methods

7 years agoAuto merge of #38952 - nrc:save-impl-fix, r=eddyb
bors [Sat, 14 Jan 2017 15:28:11 +0000 (15:28 +0000)]
Auto merge of #38952 - nrc:save-impl-fix, r=eddyb

save-analysis: handle paths in type/trait context more correctly

TBH, this is still not perfect, witness the FIXME, but it is an improvement. In particular it means we get information about trait references in impls.

7 years agoFix covered-switch-default warnings in RustWrapper
Ruud van Asseldonk [Sat, 14 Jan 2017 14:38:12 +0000 (15:38 +0100)]
Fix covered-switch-default warnings in RustWrapper

These switch statements cover all possible values, so the default case
is dead code (it contains an llvm_unreachable anyway), triggering a
-Wcovered-switch-default warning. Moving the unreachable after the
switch resolves these warnings. This keeps the build output clean.

7 years agoAuto merge of #38944 - michaelwoerister:incr-generics-partitioning, r=nikomatsakis
bors [Sat, 14 Jan 2017 13:17:16 +0000 (13:17 +0000)]
Auto merge of #38944 - michaelwoerister:incr-generics-partitioning, r=nikomatsakis

trans: Treat generics like regular functions, not like #[inline] function, during CGU partitioning

This PR makes generics be treated just like regular functions during CGU partitioning:

+ the function instantiation is placed in a codegen unit based on the function's DefPath,
+ unless it is marked with `#[inline]`  -- which causes a private copy of the function to be placed in every referencing codegen unit.

This has the following effects:
+ Multi codegen unit builds will become faster because code for generic functions is duplicated less.
+ Multi codegen unit builds might have lower runtime performance, since generics are not available for inlining automatically any more.
+ Single codegen unit builds are not affected one way or the other.

This partitioning scheme is particularly good for incremental compilation as it drastically reduces the number of false positives during codegen unit invalidation.

I'd love to have a benchmark suite for estimating the effect on runtime performance for changes like this one.

r? @nikomatsakis

cc @rust-lang/compiler

7 years agoAuto merge of #38935 - redox-os:fix_path_redox, r=brson
bors [Sat, 14 Jan 2017 11:03:25 +0000 (11:03 +0000)]
Auto merge of #38935 - redox-os:fix_path_redox, r=brson

Fix is_absolute on Redox

Due to not using prefixes on Redox, yet, it must be added as an exception to Path::is_absolute.

7 years agoAuto merge of #38927 - petrochenkov:leven, r=jseyfried
bors [Sat, 14 Jan 2017 08:48:28 +0000 (08:48 +0000)]
Auto merge of #38927 - petrochenkov:leven, r=jseyfried

resolve: Levenshtein-based suggestions for non-import paths

This patch addresses both items from https://github.com/rust-lang/rust/issues/30197#issuecomment-264846000 and therefore implements the largest part of https://github.com/rust-lang/rust/issues/30197.

r? @jseyfried

7 years agoAuto merge of #38914 - est31:tidy-gate-tests, r=nikomatsakis
bors [Sat, 14 Jan 2017 06:43:03 +0000 (06:43 +0000)]
Auto merge of #38914 - est31:tidy-gate-tests, r=nikomatsakis

Make tidy check for lang gate tests

Add gate tests to the checks that tidy performs. Excerpt from the commit message of the main commit:

    Require compile-fail tests for new lang features

    Its non trivial to test lang feature gates, and people
    forget to add such tests. So we extend the features lint
    of the tidy tool to ensure that all new lang features
    contain a new compile-fail test.

    Of course, one could drop this requirement and just
    grep all tests in run-pass for #![feature(abc)] and
    then run this test again, removing the mention,
    requiring that it fails.

    But this only tests for the existence of a compilation
    failure. Manual tests ensure that also the correct lines
    spawn the error, and also test the actual error message.

    For library features, it makes no sense to require such
    a test, as here code is used that is generic for all
    library features.

The tidy lint extension now checks the compile-fail test suite for occurences of "gate-test-X" where X is a feature. Alternatively, it also accepts file names with the form "feature-gate-X.rs". If a lang feature is found that has no such check, we emit a tidy error.

I've applied the markings to all tests I could find in the test suite. I left a small (20 elements) whitelist of features that right now have no gate test, or where I couldn't find one. Once this PR gets merged, I'd like to close issue #22820 and open a new one on suggestion of @nikomatsakis to track the removal of all elements from that whitelist (already have a draft). Writing such a small test can be a good opportunity for a first contribution, so I won't touch it (let others have the fun xD).

cc @brson , @pnkfelix (they both discussed about this in the issue linked above).

7 years agoAuto merge of #39021 - alexcrichton:try-debug-travis, r=brson
bors [Sat, 14 Jan 2017 04:29:44 +0000 (04:29 +0000)]
Auto merge of #39021 - alexcrichton:try-debug-travis, r=brson

travis: Attempt to debug OSX linker segfaults

This commit attempts to debug the segfaults that we've been seeing on OSX on
Travis. I have no idea what's going on here mostly, but let's try to look at
core dumps and get backtraces to see what's going on. This commit itself is
mostly a complete shot in the dark, I'm not sure if this even works...

cc #38878

7 years agoIf submodule init fails, try from scratch
Aidan Hobson Sayers [Sat, 14 Jan 2017 03:10:45 +0000 (03:10 +0000)]
If submodule init fails, try from scratch

7 years agoAuto merge of #38854 - Mark-Simulacrum:immediate-refactor, r=eddyb
bors [Sat, 14 Jan 2017 02:18:04 +0000 (02:18 +0000)]
Auto merge of #38854 - Mark-Simulacrum:immediate-refactor, r=eddyb

Simplify type_is_immediate and type_is_fat_ptr

r? @eddyb

7 years agoAuto merge of #39030 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Fri, 13 Jan 2017 23:56:11 +0000 (23:56 +0000)]
Auto merge of #39030 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 10 pull requests

- Successful merges: #38362, #38636, #38877, #38946, #38965, #38986, #38994, #38995, #39024, #39027
- Failed merges:

7 years agoAvoid using load/stores on first class aggregates
Björn Steinbrink [Sat, 7 Jan 2017 18:06:28 +0000 (11:06 -0700)]
Avoid using load/stores on first class aggregates

LLVM usually prefers using memcpys over direct loads/store of first
class aggregates. The check in type_is_immediate to mark certain small
structs was originally part of the code to handle such immediates in
function arguments, and it had a counterpart in load_ty/store_ty to
actually convert small aggregates to integers.

But since then, the ABI handling has been refactored and takes care of
converting small aggregates to integers. During that refactoring, the
code to handle small aggregates in load_ty/store_ty has been removed,
and so we accidentally started using loads/stores on FCA values.

Since type_is_immediate() is no longer responsible for ABI-related
conversions, and using a memcpy even for small aggregates is usually
better than performing a FCA load/store, we can remove that code part
and only handle simple types as immediates there.

This integrates PR #38906 onto this branch.

Fixes #38906.

7 years agorustbuild: Skip the build_helper crate in tests
Alex Crichton [Fri, 13 Jan 2017 23:11:34 +0000 (15:11 -0800)]
rustbuild: Skip the build_helper crate in tests

I've been noticing some spurious recompiles of the final stage on Travis lately
and in debugging them I found a case where we were a little to eager to update
a stamp file due to the build_helper library being introduced during the testing
phase.

Part of the rustbuild system detects when libstd is recompiled and automatically
cleans out future directories to ensure that dirtyness propagation works. To do
this rustbuild doesn't know the artifact name of the standard library so it just
probes everything in the target directory, looking to see if anything changed.

The problem here happened where:

* First, rustbuild would compile everything (a normal build)
* Next, rustbuild would run all tests
* During testing, the libbuild_helper library was introduced into the target
  directory, making it look like a change happened because a file is newer
  than the newest was before
* Detecting a change, the next compilation would then cause rustbuild to clean
  out old artifacts and recompile everything again.

This commit fixes this problem by correcting rustbuild to just not test the
build_helper crate at all. This crate doesn't have any unit tests, nor is it
intended to. That way the target directories should stay the same throughout
testing after a previous build.

7 years agoAdd try_wait to Redox process
Jeremy Soller [Fri, 13 Jan 2017 22:41:50 +0000 (15:41 -0700)]
Add try_wait to Redox process

7 years agoFix is_absolute on Redox
Jeremy Soller [Mon, 9 Jan 2017 00:43:30 +0000 (17:43 -0700)]
Fix is_absolute on Redox

7 years agoexpect_err for Result.
Clar Charr [Wed, 11 Jan 2017 03:17:47 +0000 (22:17 -0500)]
expect_err for Result.

7 years agoresolve: Levenshtein-based suggestions for non-import paths
Vadim Petrochenkov [Sun, 8 Jan 2017 16:47:06 +0000 (19:47 +0300)]
resolve: Levenshtein-based suggestions for non-import paths

7 years agoUse multiline Diagnostic for "relevant impl" list
Esteban Küber [Fri, 13 Jan 2017 19:40:44 +0000 (11:40 -0800)]
Use multiline Diagnostic for "relevant impl" list

Provide the following output:

```
error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
  --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:38:8
   |
38 |     f1.foo(1usize);
   |        ^^^ the trait `Foo<usize>` is not implemented for `Bar`
   |
   = help: the following implementations were found:
             <Bar as Foo<i8>>
             <Bar as Foo<i16>>
             <Bar as Foo<i32>>
             <Bar as Foo<u8>>
           and 2 others

error: aborting due to previous error
```

instead of

```
error[E0277]: the trait bound `Bar: Foo<usize>` is not satisfied
  --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:38:8
   |
38 |     f1.foo(1usize);
   |        ^^^ the trait `Foo<usize>` is not implemented for `Bar`
   |
   = help: the following implementations were found:
   = help:   <Bar as Foo<i8>>
   = help:   <Bar as Foo<i16>>
   = help:   <Bar as Foo<i32>>
   = help:   <Bar as Foo<u8>>
   = help: and 2 others

error: aborting due to previous error
```

7 years agoAuto merge of #39036 - aidanhs:aphs-robust-docker, r=alexcrichton
bors [Fri, 13 Jan 2017 19:26:49 +0000 (19:26 +0000)]
Auto merge of #39036 - aidanhs:aphs-robust-docker, r=alexcrichton

Remove strictly-unnecessary flags for docker

cc #39035

In addition to `--tty` I've removed `--interactive` as I don't think there's any reason for it to be there (it only hooks up stdin, which shouldn't be used anyway).

If this looks like it's working over a few days then I'll also alter the libc scripts.

r? @alexcrichton

7 years agoupdate mailmap
Steve Klabnik [Fri, 13 Jan 2017 19:24:48 +0000 (14:24 -0500)]
update mailmap

7 years agoRemove strictly-unnecessary flags for docker
Aidan Hobson Sayers [Fri, 13 Jan 2017 18:05:06 +0000 (18:05 +0000)]
Remove strictly-unnecessary flags for docker

7 years agoAuto merge of #38890 - petrochenkov:noresolve, r=nrc
bors [Fri, 13 Jan 2017 16:59:25 +0000 (16:59 +0000)]
Auto merge of #38890 - petrochenkov:noresolve, r=nrc

resolve: Do not use "resolve"/"resolution" in error messages

Use less jargon-y wording instead.
`cannot find <struct> <S> in <this scope>` and `cannot find <struct> <S> in <module a::b>` are used for base messages (this also harmonizes nicely with "you can import it into scope" suggestions) and `not found in <this scope>` and `not found in <a::b>` are used for short labels in fall-back case.
I tweaked some other diagnostics to avoid using "resolve" (see, e.g., `librustc_resolve/macros.rs`), but haven't touched messages for imports.

Closes https://github.com/rust-lang/rust/issues/38750
r? @nrc

7 years agoRollup merge of #39027 - behnam:typo, r=frewsxcv
Guillaume Gomez [Fri, 13 Jan 2017 09:42:34 +0000 (10:42 +0100)]
Rollup merge of #39027 - behnam:typo, r=frewsxcv

[libcollections] [doc] Fix typo in documentation

Replace two instances of `an raw` with `a raw` in documentation blocks.

7 years agoRollup merge of #39024 - stjepang:owned-to-string, r=steveklabnik
Guillaume Gomez [Fri, 13 Jan 2017 09:42:33 +0000 (10:42 +0100)]
Rollup merge of #39024 - stjepang:owned-to-string, r=steveklabnik

Change `to_owned` to `to_string` in docs

We should teach conversion from `str` to `String` using `to_string` rather than the legacy `to_owned`.

7 years agoRollup merge of #38995 - petrochenkov:minmax, r=GuillaumeGomez
Guillaume Gomez [Fri, 13 Jan 2017 09:42:32 +0000 (10:42 +0100)]
Rollup merge of #38995 - petrochenkov:minmax, r=GuillaumeGomez

Fix docs for min/max algorithms

I thought at first "what did they think about when stabilizing this!?", but it turned out it's just wrong docs. Phew.

r? @steveklabnik

Test:
```
use std::cmp::Ordering;

struct S(u8, u8);

impl PartialEq for S {
    fn eq(&self, other: &Self) -> bool {
        self.0 == other.0
    }
}
impl PartialOrd for S {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.0.cmp(&other.0))
    }
}
impl Ord for S {
    fn cmp(&self, other: &Self) -> Ordering {
        self.0.cmp(&other.0)
    }
}

fn main() {
    let arr = [S(0, 1), S(0, 2)];
    println!("min {:?}", arr.iter().min());
    println!("min_by {:?}", arr.iter().min_by(|x, y| x.0.cmp(&y.0)));
    println!("min_by_key {:?}", arr.iter().min_by_key(|x| x.0));
    println!("max {:?}", arr.iter().max());
    println!("max_by {:?}", arr.iter().max_by(|x, y| x.0.cmp(&y.0)));
    println!("max_by_key {:?}", arr.iter().max_by_key(|x| x.0));
}
```
Output:
```
rustc 1.15.0-beta.3 (a035041ba 2017-01-07)
min Some(S(0, 1))
min_by Some(S(0, 1))
min_by_key Some(S(0, 1))
max Some(S(0, 2))
max_by Some(S(0, 2))
max_by_key Some(S(0, 2))
```

7 years agoRollup merge of #38994 - BenWiederhake:master, r=sanxiyn
Guillaume Gomez [Fri, 13 Jan 2017 09:42:31 +0000 (10:42 +0100)]
Rollup merge of #38994 - BenWiederhake:master, r=sanxiyn

Fix some typos in Nomicon

I waited a bit before creating this PR in case I find more typos – I didn't.

I've read `CONTRIBUTING.md` but didn't `make check`, and `make doc` takes incredibly long. (Among other things, `make doc` builds llvm from scratch.  Not sure if that's intentional.)

7 years agoRollup merge of #38986 - APTy:fix-nonblocking-test, r=aturon
Guillaume Gomez [Fri, 13 Jan 2017 09:42:30 +0000 (10:42 +0100)]
Rollup merge of #38986 - APTy:fix-nonblocking-test, r=aturon

std/net/udp: Improve set_nonblocking test

While writing a separate change, I noticed the current test for `UdpSocket::set_nonblocking()` is fairly ineffective.

This fixes the test so that it validates that a correct error is returned on calls to `recv()` when no data is available.

7 years agoRollup merge of #38965 - GuillaumeGomez:mutex_docs, r=frewsxcv
Guillaume Gomez [Fri, 13 Jan 2017 09:42:29 +0000 (10:42 +0100)]
Rollup merge of #38965 - GuillaumeGomez:mutex_docs, r=frewsxcv

Add missing doc examples for Mutex

r? @frewsxcv

7 years agoRollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcv
Guillaume Gomez [Fri, 13 Jan 2017 09:42:28 +0000 (10:42 +0100)]
Rollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcv

Add missing links and examples for path modules and structs

r? @frewsxcv

7 years agoRollup merge of #38877 - jdub:patch-1, r=sanxiyn
Guillaume Gomez [Fri, 13 Jan 2017 09:42:27 +0000 (10:42 +0100)]
Rollup merge of #38877 - jdub:patch-1, r=sanxiyn

libcompiler_builtins: Don't build emutls.c

Rather than improving the check, let's ditch emutls.c entirely.

7 years agoRollup merge of #38636 - shahn:extend, r=steveklabnik
Guillaume Gomez [Fri, 13 Jan 2017 09:42:26 +0000 (10:42 +0100)]
Rollup merge of #38636 - shahn:extend, r=steveklabnik

Clarify Extend behaviour wrt existing keys

This seems to be consistent with all the Extend implementations I found, and isn't documented anywhere else afaik.

7 years agoRollup merge of #38362 - GuillaumeGomez:instant_doc, r=frewsxcv
Guillaume Gomez [Fri, 13 Jan 2017 09:42:25 +0000 (10:42 +0100)]
Rollup merge of #38362 - GuillaumeGomez:instant_doc, r=frewsxcv

Instant doc

r? @frewsxcv

7 years agoAuto merge of #38909 - clarcharr:char_struct_display, r=alexcrichton
bors [Fri, 13 Jan 2017 07:24:53 +0000 (07:24 +0000)]
Auto merge of #38909 - clarcharr:char_struct_display, r=alexcrichton

Implement Display for char Escape*, To*case.

See: rust-lang/rfcs#1848.

A good example of where this is useful would be in the example `print!("{}", 'ß'.to_uppercase())`.

Not sure if this requires a formal RFC, but I decided to write the code for it anyway regardless.

7 years ago[libcollections] [doc] Fix typo in documentation
Behnam Esfahbod [Fri, 13 Jan 2017 03:23:35 +0000 (19:23 -0800)]
[libcollections] [doc] Fix typo in documentation

7 years agoAuto merge of #38748 - alexcrichton:upload, r=brson
bors [Fri, 13 Jan 2017 02:56:20 +0000 (02:56 +0000)]
Auto merge of #38748 - alexcrichton:upload, r=brson

travis: Start uploading artifacts on commits

This commit starts adding the infrastructure for uploading release artifacts
from AppVeyor/Travis on each commit. The idea is that eventually we'll upload a
full release to AppVeyor/Travis in accordance with plans [outlined earlier].

Right now this configures Travis/Appveyor to upload all tarballs in the `dist`
directory, and various images are updated to actually produce tarballs in these
directories. These are nowhere near ready to be actual release artifacts, but
this should allow us to play around with it and test it out. Once this commit
lands we should start seeing artifacts uploaded on each commit.

[outlined earlier]: https://internals.rust-lang.org/t/rust-ci-release-infrastructure-changes/4489

7 years agorustbuild: Actually don't build stage0 target rustc
Alex Crichton [Fri, 13 Jan 2017 00:43:44 +0000 (16:43 -0800)]
rustbuild: Actually don't build stage0 target rustc

This was attempted in #38853 but erroneously forgot one more case of where the
compiler was compiled. This commit fixes that up and adds a test to ensure this
doesn't sneak back in.

7 years agoChange `to_owned` to `to_string` in docs
Stjepan Glavina [Fri, 13 Jan 2017 00:57:48 +0000 (01:57 +0100)]
Change `to_owned` to `to_string` in docs

We should teach conversion from `str` to `String` using `to_string`
rather than the legacy `to_owned`.

7 years agoAuto merge of #38675 - infinity0:more-jemalloc-fixes, r=alexcrichton
bors [Fri, 13 Jan 2017 00:56:45 +0000 (00:56 +0000)]
Auto merge of #38675 - infinity0:more-jemalloc-fixes, r=alexcrichton

More jemalloc fixes

- Disable jemalloc on s390x as well (closes #38596)
- Disable jemalloc tests on platforms where it is disabled (closes #38612)

7 years agotravis: Start uploading artifacts on commits
Alex Crichton [Sun, 1 Jan 2017 01:42:40 +0000 (17:42 -0800)]
travis: Start uploading artifacts on commits

This commit starts adding the infrastructure for uploading release artifacts
from AppVeyor/Travis on each commit. The idea is that eventually we'll upload a
full release to AppVeyor/Travis in accordance with plans [outlined earlier].

Right now this configures Travis/Appveyor to upload all tarballs in the `dist`
directory, and various images are updated to actually produce tarballs in these
directories. These are nowhere near ready to be actual release artifacts, but
this should allow us to play around with it and test it out. Once this commit
lands we should start seeing artifacts uploaded on each commit.

[outlined earlier]: https://internals.rust-lang.org/t/rust-ci-release-infrastructure-changes/4489

7 years agotravis: Attempt to debug OSX linker segfaults
Alex Crichton [Thu, 12 Jan 2017 22:58:55 +0000 (14:58 -0800)]
travis: Attempt to debug OSX linker segfaults

This commit attempts to debug the segfaults that we've been seeing on OSX on
Travis. I have no idea what's going on here mostly, but let's try to look at
core dumps and get backtraces to see what's going on. This commit itself is
mostly a complete shot in the dark, I'm not sure if this even works...

cc #38878

7 years agoAlso mark the struct_field_attributes regression test
est31 [Thu, 12 Jan 2017 22:55:32 +0000 (23:55 +0100)]
Also mark the struct_field_attributes regression test

Rebase on top of PR 38814 made required this.

7 years agoAdd docs
est31 [Wed, 11 Jan 2017 01:34:30 +0000 (02:34 +0100)]
Add docs

7 years agoMark even more tests as gate tests
est31 [Wed, 11 Jan 2017 01:25:44 +0000 (02:25 +0100)]
Mark even more tests as gate tests

Now, no feature outside of the whitelist is
without a test marked as its gate test.

7 years agoUse a whitelist and print nice hints
est31 [Wed, 11 Jan 2017 01:25:02 +0000 (02:25 +0100)]
Use a whitelist and print nice hints

7 years agoAutomatically treat test files "feature-gate-$f.rs" as gate tests for feature $f
est31 [Wed, 11 Jan 2017 01:21:49 +0000 (02:21 +0100)]
Automatically treat test files "feature-gate-$f.rs" as gate tests for feature $f

7 years agoDon't require gate tests for removed features
est31 [Wed, 11 Jan 2017 01:20:30 +0000 (02:20 +0100)]
Don't require gate tests for removed features

7 years agoAdd gate-test- to some already existing tests
est31 [Sun, 8 Jan 2017 02:57:27 +0000 (03:57 +0100)]
Add gate-test- to some already existing tests

7 years agoRequire compile-fail tests for new lang features
est31 [Sun, 8 Jan 2017 02:24:40 +0000 (03:24 +0100)]
Require compile-fail tests for new lang features

Its non trivial to test lang feature gates, and people
forget to add such tests. So we extend the features lint
of the tidy tool to ensure that all new lang features
contain a new compile-fail test.

Of course, one could drop this requirement and just
grep all tests in run-pass for #![feature(abc)] and
then run this test again, removing the mention,
requiring that it fails.

But this only tests for the existence of a compilation
failure. Manual tests ensure that also the correct lines
spawn the error, and also test the actual error message.

For library features, it makes no sense to require such
a test, as here code is used that is generic for all
library features.

7 years agoUse only one feature struct, and use hash maps in both occasions
est31 [Sun, 8 Jan 2017 01:48:37 +0000 (02:48 +0100)]
Use only one feature struct, and use hash maps in both occasions

7 years agoAuto merge of #38650 - infinity0:master, r=alexcrichton
bors [Thu, 12 Jan 2017 22:52:32 +0000 (22:52 +0000)]
Auto merge of #38650 - infinity0:master, r=alexcrichton

Detect mips CPUs in ./configure

This mirrors existing logic already in src/bootstrap/bootstrap.py

7 years agoincr.comp.: Add some caching to Predecessors construction.
Michael Woerister [Thu, 12 Jan 2017 22:06:42 +0000 (17:06 -0500)]
incr.comp.: Add some caching to Predecessors construction.

7 years agoAdd some more info to -Zincremental-info
Michael Woerister [Thu, 12 Jan 2017 22:03:32 +0000 (17:03 -0500)]
Add some more info to -Zincremental-info

7 years agoAuto merge of #38814 - Ralith:cfg-fields, r=jseyfried
bors [Thu, 12 Jan 2017 20:44:02 +0000 (20:44 +0000)]
Auto merge of #38814 - Ralith:cfg-fields, r=jseyfried

syntax: enable attributes and cfg on struct fields

This enables conditional compilation of field initializers in a struct literal, simplifying construction of structs whose fields are themselves conditionally present. For example, the intializer for the constant in the following becomes legal, and has the intuitive effect:

```rust
struct Foo {
    #[cfg(unix)]
    bar: (),
}

const FOO: Foo = Foo {
    #[cfg(unix)]
    bar: (),
};
```

It's not clear to me whether this calls for the full RFC process, but the implementation was simple enough that I figured I'd begin the conversation with code.

7 years agoMark some BitVector methods with #[inline]
Michael Woerister [Thu, 12 Jan 2017 20:13:02 +0000 (15:13 -0500)]
Mark some BitVector methods with #[inline]

7 years agoDisable jemalloc tests on platforms where it is disabled (closes #38612)
Ximin Luo [Thu, 12 Jan 2017 20:10:31 +0000 (21:10 +0100)]
Disable jemalloc tests on platforms where it is disabled (closes #38612)

See also #37392

7 years agoAdd mips architectures to conditional-compile test
Ximin Luo [Thu, 29 Dec 2016 13:26:53 +0000 (14:26 +0100)]
Add mips architectures to conditional-compile test

7 years agoDetect mips CPUs in ./configure
Ximin Luo [Wed, 28 Dec 2016 12:56:29 +0000 (13:56 +0100)]
Detect mips CPUs in ./configure

This mirrors existing logic already in src/bootstrap/bootstrap.py

7 years agoDisable jemalloc on s390x as well (closes #38596)
Ximin Luo [Thu, 29 Dec 2016 14:14:30 +0000 (15:14 +0100)]
Disable jemalloc on s390x as well (closes #38596)

See also #37320 and #37392

7 years agoAuto merge of #38569 - chris-morgan:rustdoc-highlight-kw-2, r=steveklabnik
bors [Thu, 12 Jan 2017 18:32:28 +0000 (18:32 +0000)]
Auto merge of #38569 - chris-morgan:rustdoc-highlight-kw-2, r=steveklabnik

Fix rustdoc highlighting of `&` and `*`

Whitespace tokens were included, so the span check used with `&` was incorrect, and it was never highlighted as kw-2 (RefKeyword).

The `*` in `*foo` and `*const T` should also be highlighted kw-2, so I added them. Note that this *will* cause mishighlighting of code like `1*2`, but that should have been written `1 * 2`. Same deal with `1&2`.

7 years agoAuto merge of #38779 - Craig-Macomber:bench, r=alexcrichton
bors [Thu, 12 Jan 2017 14:42:02 +0000 (14:42 +0000)]
Auto merge of #38779 - Craig-Macomber:bench, r=alexcrichton

Do not run outer setup part of benchmarks multiple times to fix issue 20142

Fix #20142

This is my first real rust code, so I expect the quality is quite bad. Please let me know in which ways it is horrible and I'll fix it.

Previously the whole benchmark function was rerun many times, but with this change, only the callback passed to iter is rerun. This improves performances by saving benchmark startup time. The setup used to be called a minimum of 101 times, and now only runs once.

I wasn't sure exactly what should be done for the case where iter is never called, so I left a FIXME for that: currently it does not error, and I added tests to cover that.

I have left the algorithm and statistics unchanged: I don't like how the minimum number of runs is 301 (that's bad for very slow benchmarks) but I consider such changes out of scope for this fix.

7 years agoAuto merge of #38654 - alexcrichton:rustbuild-destdir, r=brson
bors [Thu, 12 Jan 2017 08:31:50 +0000 (08:31 +0000)]
Auto merge of #38654 - alexcrichton:rustbuild-destdir, r=brson

rustbuild: Implement DESTDIR support

This commit primarily starts supporting the `DESTDIR` environment variable like
the old build system. Along the way this brings `config.toml` up to date with
support in `config.mk` with install options supported.

Closes #38441

7 years agoresolve: Do not use "resolve"/"resolution" in error messages
Vadim Petrochenkov [Wed, 11 Jan 2017 22:18:08 +0000 (01:18 +0300)]
resolve: Do not use "resolve"/"resolution" in error messages

7 years agosyntax: struct field attributes and cfg
Benjamin Saunders [Wed, 4 Jan 2017 03:13:01 +0000 (19:13 -0800)]
syntax: struct field attributes and cfg

7 years agoAuto merge of #37926 - bluss:from-utf8-small-simplification, r=sfackler
bors [Thu, 12 Jan 2017 05:14:50 +0000 (05:14 +0000)]
Auto merge of #37926 - bluss:from-utf8-small-simplification, r=sfackler

UTF-8 validation: Compute block end upfront

Simplify the conditional used for ensuring that the whole word loop is
only used if there are at least two whole words left to read.

This makes the function slightly smaller and simpler, a 0-5% reduction
in runtime for various test cases.

7 years agoAuto merge of #38867 - alexcrichton:ignore-test-on-windows, r=brson
bors [Thu, 12 Jan 2017 03:13:48 +0000 (03:13 +0000)]
Auto merge of #38867 - alexcrichton:ignore-test-on-windows, r=brson

std: Ignore close_read_wakes_up on Windows

It looks like in practice at least this test will not pass on Windows.
Empirically it is prone to blocking forever, presumably because a call to
`shutdown` doesn't actually wake up other threads on Windows.

We don't document this as a guarantee for `shutdown`, nor do we internally rely
on it. This test originated in a time long since passed when it was leveraged
for canceling I/O, but nowadays there's nothing fancy happening in the standard
library so it's not really a productive test anyway, hence just ignoring it on
Windows.

Closes #31657

7 years agoAuto merge of #38605 - estebank:fix-38371, r=nikomatsakis
bors [Thu, 12 Jan 2017 01:01:06 +0000 (01:01 +0000)]
Auto merge of #38605 - estebank:fix-38371, r=nikomatsakis

Suggest solutions for `fn foo(&foo: Foo)`

For a given file:

```rust
struct Foo {}

fn foo(&foo: Foo) {}
```

suggest:

```
error[E0308]: mismatched types
 --> file.rs:3:8
  |
3 | fn foo(&foo: Foo) {}
  |        ^^^^ expected struct `Foo`, found reference
  |
  = note: expected type `Foo`
  = note:    found type `&_`
  = help: did you mean `foo: &Foo`?
```

Fix #38371.

7 years agoAdd missing links and examples for path modules and structs
Guillaume Gomez [Mon, 9 Jan 2017 21:42:39 +0000 (22:42 +0100)]
Add missing links and examples for path modules and structs