]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 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 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 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

7 years agoAuto merge of #38313 - jseyfried:self_imports, r=nrc
bors [Wed, 11 Jan 2017 20:12:26 +0000 (20:12 +0000)]
Auto merge of #38313 - jseyfried:self_imports, r=nrc

resolve: clean up the semantics of `self` in an import list

Change `self` in an import list `use foo::bar::{self, ...};` to import `bar` only in the type namespace. Today, `bar` is imported in every namespace in which `foo::bar` is defined.

This is a [breaking-change], see https://github.com/rust-lang/rust/issues/38293#issue-194817974 for examples of code that would break.

Fixes #38293.
r? @nrc

7 years agoImplement Display for char Escape*, To*case.
Clar Charr [Sat, 7 Jan 2017 18:16:03 +0000 (13:16 -0500)]
Implement Display for char Escape*, To*case.

7 years agoFix two const-eval issues related to i128 negation
Simonas Kazlauskas [Wed, 11 Jan 2017 14:28:23 +0000 (16:28 +0200)]
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 agoFix some typos in Nomicon
Ben Wiederhake [Thu, 5 Jan 2017 23:14:26 +0000 (00:14 +0100)]
Fix some typos in Nomicon

7 years agoFix docs for min/max algorithms
Vadim Petrochenkov [Wed, 11 Jan 2017 16:02:30 +0000 (19:02 +0300)]
Fix docs for min/max algorithms

7 years agoAuto merge of #38989 - arielb1:constant-mir-overflow2, r=eddyb
bors [Wed, 11 Jan 2017 15:45:28 +0000 (15:45 +0000)]
Auto merge of #38989 - arielb1:constant-mir-overflow2, r=eddyb

fix function arguments in constant promotion

we can't create the target block until *after* we promote the arguments - otherwise the arguments will be promoted into the target block. oops.

Fixes #38985.

This is a regression introduced in the beta-nominated #38833, so beta-nominating this one too (sorry @brson).

r? @eddyb

7 years agoAuto merge of #38984 - alexcrichton:less-debuginfo, r=brson
bors [Wed, 11 Jan 2017 13:42:52 +0000 (13:42 +0000)]
Auto merge of #38984 - alexcrichton:less-debuginfo, r=brson

rustbuild: Don't enable debuginfo in rustc

In #37280 we enabled line number debugging information in release artifacts,
primarily to close out #36452 where debugging information was critical for MSVC
builds of Rust to be useful in production. This commit, however, apparently had
some unfortunate side effects.

Namely it was noticed in #37477 that if `RUST_BACKTRACE=1` was set then any
compiler error would take a very long time for the compiler to exit. The cause
of the problem here was somewhat deep:

* For all compiler errors, the compiler will `panic!` with a known value. This
  tears down the main compiler thread and allows cleaning up all the various
  resources. By default, however, this panic output is suppressed for "normal"
  compiler errors.
* When `RUST_BACKTRACE=1` was set this caused every compiler error to generate a
  backtrace.
* The libbacktrace library hits a pathological case where it spends a very long
  time in its custom allocation function, `backtrace_alloc`, because the
  compiler has so much debugging information. More information about this can be
  found in #29293 with a summary at the end of #37477.

To solve this problem this commit simply removes debuginfo from the compiler but
not from the standard library. This should allow us to keep #36452 closed while
also closing #37477. I've measured the difference to be orders of magnitude
faster than it was before, so we should see a much quicker time-to-exit after a
compile error when `RUST_BACKTRACE=1` is set.

Closes #37477
Closes #37571

7 years agoAuto merge of #38925 - petrochenkov:varass, r=jseyfried
bors [Wed, 11 Jan 2017 09:22:56 +0000 (09:22 +0000)]
Auto merge of #38925 - petrochenkov:varass, r=jseyfried

Fix ICE when variant is used as a part of associated path

Fixes https://github.com/rust-lang/rust/issues/38862
r? @jseyfried

7 years agofix function arguments in constant promotion
Ariel Ben-Yehuda [Wed, 11 Jan 2017 07:50:24 +0000 (09:50 +0200)]
fix function arguments in constant promotion

we can't create the target block until *after* we promote the arguments
- otherwise the arguments will be promoted into the target block. oops.

Fixes #38985.

7 years agostd/net/udp: Improve set_nonblocking test
Tyler Julian [Wed, 11 Jan 2017 06:06:17 +0000 (22:06 -0800)]
std/net/udp: Improve set_nonblocking test

7 years agoAuto merge of #38916 - estebank:pad-suggestion-list, r=nikomatsakis
bors [Wed, 11 Jan 2017 05:27:11 +0000 (05:27 +0000)]
Auto merge of #38916 - estebank:pad-suggestion-list, r=nikomatsakis

Teach diagnostics to correct margin of multiline messages

Make the suggestion list have a correct padding:

```
error[E0308]: mismatched types
 --> file.rs:3:20
  |
3 |     let x: usize = "";
  |                    ^^ expected usize, found reference
  |
  = note: expected type `usize`
  = note:    found type `&'static str`
  = help: here are some functions which might fulfill your needs:
          - .len()
          - .foo()
          - .bar()
```

7 years agorustbuild: Don't enable debuginfo in rustc
Alex Crichton [Wed, 11 Jan 2017 04:01:54 +0000 (20:01 -0800)]
rustbuild: Don't enable debuginfo in rustc

In #37280 we enabled line number debugging information in release artifacts,
primarily to close out #36452 where debugging information was critical for MSVC
builds of Rust to be useful in production. This commit, however, apparently had
some unfortunate side effects.

Namely it was noticed in #37477 that if `RUST_BACKTRACE=1` was set then any
compiler error would take a very long time for the compiler to exit. The cause
of the problem here was somewhat deep:

* For all compiler errors, the compiler will `panic!` with a known value. This
  tears down the main compiler thread and allows cleaning up all the various
  resources. By default, however, this panic output is suppressed for "normal"
  compiler errors.
* When `RUST_BACKTRACE=1` was set this caused every compiler error to generate a
  backtrace.
* The libbacktrace library hits a pathological case where it spends a very long
  time in its custom allocation function, `backtrace_alloc`, because the
  compiler has so much debugging information. More information about this can be
  found in #29293 with a summary at the end of #37477.

To solve this problem this commit simply removes debuginfo from the compiler but
not from the standard library. This should allow us to keep #36452 closed while
also closing #37477. I've measured the difference to be orders of magnitude
faster than it was before, so we should see a much quicker time-to-exit after a
compile error when `RUST_BACKTRACE=1` is set.

Closes #37477
Closes #37571

7 years agoSimplify code since CEnum is always immediate now.
Mark Simulacrum [Thu, 5 Jan 2017 19:22:58 +0000 (12:22 -0700)]
Simplify code since CEnum is always immediate now.

7 years agoMake type_is_fat_ptr not depend on LLVM.
Mark Simulacrum [Thu, 5 Jan 2017 18:35:30 +0000 (11:35 -0700)]
Make type_is_fat_ptr not depend on LLVM.

7 years agoMake type_is_immediate not depend on LLVM.
Mark Simulacrum [Thu, 5 Jan 2017 18:31:47 +0000 (11:31 -0700)]
Make type_is_immediate not depend on LLVM.

This has the nice benefit of making it much simpler to work with,
since it now consists of a single match statement.

7 years agoAuto merge of #38960 - arielb1:blake-endian, r=michaelwoerister
bors [Wed, 11 Jan 2017 01:33:03 +0000 (01:33 +0000)]
Auto merge of #38960 - arielb1:blake-endian, r=michaelwoerister

Use little-endian encoding for Blake2 hashing on all architectures

Like many hash functions, the blake2 hash is mathematically defined on
a sequence of 64-bit words. As Rust's hash interface operates on
sequences of octets, some encoding must be used to bridge that
difference.

The Blake2 RFC (RFC 7693) specifies that:
```
   Byte (octet) streams are interpreted as words in little-endian order,
   with the least-significant byte first.
```

So use that encoding consistently.

Fixes #38891.

Beta-nominating since this is a regression since 1.15.

r? @michaelwoerister

7 years agoAuto merge of #38580 - shepmaster:result-sum, r=alexcrichton
bors [Tue, 10 Jan 2017 23:25:31 +0000 (23:25 +0000)]
Auto merge of #38580 - shepmaster:result-sum, r=alexcrichton

Implement `iter::Sum` and `iter::Product` for `Result`

This introduces a private iterator adapter `ResultShunt`, which allows
treating an iterator of `Result<T, E>` as an iterator of `T`.

7 years agoAuto merge of #38843 - Manishearth:proposed, r=GuillaumeGomez
bors [Tue, 10 Jan 2017 21:16:06 +0000 (21:16 +0000)]
Auto merge of #38843 - Manishearth:proposed, r=GuillaumeGomez

Improved rustdoc rendering for unstable features

This replaces "unstable" with "this is an experimental API", and uses a `<details>` tag to expand to the reason.

The `<details>` tag renders as a regular div (with the details show) on browsers which don't support it, On browsers which do support it, it shows only the summary line with an expandy-arrow next to it, and on clicking it the details will turn up below it.

This is somewhat a strawman proposal. The main issue is that we need to improve our messaging around unstable APIs. Since they turn up in the docs, we should be clearer that they are experimental (and perhaps add something about nightly-only). I'm making this PR to kickstart discussion on this.

Example rendering: http://manishearth.github.io/rust-internals-docs/std/io/trait.Read.html#method.chars

<img width="375" alt="screen shot 2017-01-04 at 10 15 37 pm" src="https://cloud.githubusercontent.com/assets/1617736/21670712/5a96c7de-d2cb-11e6-86a6-87f70818d634.png">

expands to

<img width="799" alt="screen shot 2017-01-04 at 10 15 43 pm" src="https://cloud.githubusercontent.com/assets/1617736/21670714/5db88bb4-d2cb-11e6-8fcc-5cf11d198b75.png">

cc @steveklabnik @jdub

7 years agoupdate test case to include `fn(&&u32: Foo)`
Niko Matsakis [Tue, 10 Jan 2017 20:13:21 +0000 (15:13 -0500)]
update test case to include `fn(&&u32: Foo)`

7 years agoAdd missing doc examples for Mutex
Guillaume Gomez [Tue, 10 Jan 2017 19:58:17 +0000 (20:58 +0100)]
Add missing doc examples for Mutex

7 years agoonly emit suggestion to move `&` if the inner pattern is a binding
Niko Matsakis [Tue, 10 Jan 2017 19:45:30 +0000 (14:45 -0500)]
only emit suggestion to move `&` if the inner pattern is a binding

7 years agoImplement `iter::Sum` and `iter::Product` for `Result`
Jake Goulding [Fri, 23 Dec 2016 19:30:37 +0000 (14:30 -0500)]
Implement `iter::Sum` and `iter::Product` for `Result`

This introduces a private iterator adapter `ResultShunt`, which allows
treating an iterator of `Result<T, E>` as an iterator of `T`.

7 years agoUse little-endian encoding for Blake2 hashing on all architectures
Ariel Ben-Yehuda [Tue, 10 Jan 2017 14:24:06 +0000 (16:24 +0200)]
Use little-endian encoding for Blake2 hashing on all architectures

Like many hash functions, the blake2 hash is mathematically defined on
a sequence of 64-bit words. As Rust's hash interface operates on
sequences of octets, some encoding must be used to bridge that
difference.

The Blake2 RFC (RFC 7693) specifies that:
   Byte (octet) streams are interpreted as words in little-endian order,
   with the least-significant byte first.

So use that encoding consistently.

Fixes #38891.

7 years agoAuto merge of #38958 - sanxiyn:rollup, r=sanxiyn
bors [Tue, 10 Jan 2017 14:08:21 +0000 (14:08 +0000)]
Auto merge of #38958 - sanxiyn:rollup, r=sanxiyn

Rollup of 11 pull requests

- Successful merges: #38606, #38607, #38623, #38664, #38799, #38816, #38836, #38839, #38841, #38849, #38874
- Failed merges: #38845

7 years agoRollup merge of #38874 - derekdreery:patch-1, r=steveklabnik
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:48 +0000 (20:27 +0900)]
Rollup merge of #38874 - derekdreery:patch-1, r=steveklabnik

Update vec.rs

Add a warning not to convert  char* from c to Vec<u8> (I thought you could until I asked on irc).

Reasoning is that it will help people avoid an error that could cause crashes and undefined behaviour. Only drawback is that it could confuse someone not familiar with C, but beginners are unlikely to be using this function anyway.

7 years agoRollup merge of #38849 - michaelwoerister:ich-trait-impl-test, r=nikomatsakis
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:47 +0000 (20:27 +0900)]
Rollup merge of #38849 - michaelwoerister:ich-trait-impl-test, r=nikomatsakis

ICH: Add some more test cases for trait impls.

r? @nikomatsakis

7 years agoRollup merge of #38841 - F001:Fix, r=steveklabnik
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:46 +0000 (20:27 +0900)]
Rollup merge of #38841 - F001:Fix, r=steveklabnik

Update usage of rustc

Add proc_macro crate type

7 years agoRollup merge of #38839 - frewsxcv:osstr-to-str, r=GuillaumeGomez
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:45 +0000 (20:27 +0900)]
Rollup merge of #38839 - frewsxcv:osstr-to-str, r=GuillaumeGomez

Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples.

None

7 years agoRollup merge of #38836 - ollie27:patch-1, r=steveklabnik
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:44 +0000 (20:27 +0900)]
Rollup merge of #38836 - ollie27:patch-1, r=steveklabnik

Fix typo in tuple docs

r? @steveklabnik

7 years agoRollup merge of #38816 - Manishearth:coercion-doc, r=GuillaumeGomez
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:43 +0000 (20:27 +0900)]
Rollup merge of #38816 - Manishearth:coercion-doc, r=GuillaumeGomez

Add more docs for CoerceUnsized and Unsize

here be dragons

r? @ubsan @steveklabnik

7 years agoRollup merge of #38799 - minaguib:patch-1, r=steveklabnik
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:42 +0000 (20:27 +0900)]
Rollup merge of #38799 - minaguib:patch-1, r=steveklabnik

Doc fix

7 years agoRollup merge of #38664 - apasel422:may-dangle, r=pnkfelix
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:41 +0000 (20:27 +0900)]
Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelix

Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_dangle]`

CC #34761

r? @pnkfelix

7 years agoRollup merge of #38623 - alexcrichton:less-osx-warnings, r=aturon
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:40 +0000 (20:27 +0900)]
Rollup merge of #38623 - alexcrichton:less-osx-warnings, r=aturon

std: Remove unused objects from compiler-builtins

We don't actually use trampoline_setup.c and all the `*tf3` business
seems related to f80/f128 business. Specifically this'll fix some
warnings showing up during builds on OSX.

7 years agoRollup merge of #38607 - estebank:test-for-36935, r=alexcrichton
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:39 +0000 (20:27 +0900)]
Rollup merge of #38607 - estebank:test-for-36935, r=alexcrichton

Test for appropriate span on second custom derive

Adds test for and closes #36935.

7 years agoRollup merge of #38606 - estebank:test-for-27522, r=petrochenkov
Seo Sanghyeon [Tue, 10 Jan 2017 11:27:38 +0000 (20:27 +0900)]
Rollup merge of #38606 - estebank:test-for-27522, r=petrochenkov

Add test for correct span for type

Adds test for and closes #27522.

7 years agoAuto merge of #38138 - rkruppe:no_std-no_loop, r=steveklabnik
bors [Tue, 10 Jan 2017 06:50:59 +0000 (06:50 +0000)]
Auto merge of #38138 - rkruppe:no_std-no_loop, r=steveklabnik

book: use abort() over loop {} for panic

Due to #28728 `loop {}` is very risky and can lead to fun debugging experiences such as #38136. Besides, aborting is probably better behavior than an infinite loop.

r? @steveklabnik

7 years agoStart warning cycle.
Jeffrey Seyfried [Tue, 10 Jan 2017 05:15:02 +0000 (05:15 +0000)]
Start warning cycle.

7 years agoChange `self` in an import list `use foo::{self, ...}` to only import a module or...
Jeffrey Seyfried [Mon, 12 Dec 2016 03:35:48 +0000 (03:35 +0000)]
Change `self` in an import list `use foo::{self, ...}` to only import a module or enum `foo`.

7 years agoImproved rustdoc rendering for unstable features
Manish Goregaokar [Thu, 5 Jan 2017 06:09:54 +0000 (22:09 -0800)]
Improved rustdoc rendering for unstable features

7 years agoAuto merge of #38947 - nrc:custom-derive-span, r=jseyfried
bors [Tue, 10 Jan 2017 04:44:04 +0000 (04:44 +0000)]
Auto merge of #38947 - nrc:custom-derive-span, r=jseyfried

Give custom derive spans an expansion ID

r? @jseyfried

7 years agosave-analysis: handle paths in type/trait context more correctly
Nick Cameron [Tue, 10 Jan 2017 03:09:13 +0000 (16:09 +1300)]
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.