]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agorustbuild: Clean build/dist on `make clean`
Alex Crichton [Tue, 7 Feb 2017 19:39:42 +0000 (11:39 -0800)]
rustbuild: Clean build/dist on `make clean`

Prevents stale artifacts from sticking around by accident!

7 years agoAuto merge of #39500 - michaelwoerister:fix-ich-testing, r=nikomatsakis
bors [Mon, 6 Feb 2017 14:10:13 +0000 (14:10 +0000)]
Auto merge of #39500 - michaelwoerister:fix-ich-testing, r=nikomatsakis

Let the dep-tracking test framework check that all #[rustc_dirty] attrs have been actually checked

r? @nikomatsakis

7 years agoAdd comment about why the regular unused-attributes infrastructure
Michael Woerister [Mon, 6 Feb 2017 08:56:58 +0000 (03:56 -0500)]
Add comment about why the regular unused-attributes infrastructure
is not used for #[rustc_dirty]/#[rustc_clean].

7 years agoAuto merge of #38436 - bluecereal:patch-1, r=frewsxcv
bors [Mon, 6 Feb 2017 06:55:10 +0000 (06:55 +0000)]
Auto merge of #38436 - bluecereal:patch-1, r=frewsxcv

Update if-let.md

Calling if-let a combination of if and let is confusing, as some may be led to believe that it's a literal combination, instead of syntactic sugar added to the language as a convenience.  What's there to stop someone from thinking if-let is just if and let together?

I do think this article does a good job of implying what's really going on; however, I was only able to notice this after I had begun to understand if/while-let statements, courtesy of the Rust IRC chat.

Basically, this article lacks the clarity and explicitness an inexperienced programmer like me needs in order to understand the contents fully.  This is shown by my inability to understand the if-let concept from this page of the Book alone.

I think convenience, sugar, and (if-let != if + let) should all be made mention of in a clear, explicit manner. I lack confidence in my understanding of this issue, so I wrote just enough to hopefully get my thoughts across.

7 years agoUpdate if-let.md
bluecereal [Mon, 6 Feb 2017 01:20:43 +0000 (20:20 -0500)]
Update if-let.md

7 years agoAuto merge of #38897 - nikomatsakis:issue-32330-followup, r=arielb1
bors [Sun, 5 Feb 2017 22:53:10 +0000 (22:53 +0000)]
Auto merge of #38897 - nikomatsakis:issue-32330-followup, r=arielb1

make lifetimes that only appear in return type early-bound

This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a fuller explanation and offering a `--explain` message in some cases.

This needs a crater run before we land.

r? @arielb1

7 years agomake lifetimes that only appear in return type early-bound
Niko Matsakis [Fri, 6 Jan 2017 19:35:23 +0000 (14:35 -0500)]
make lifetimes that only appear in return type early-bound

This is the full and proper fix for #32330. This also makes some effort
to give a nice error message (as evidenced by the `ui` test), sending
users over to the tracking issue for a full explanation.

7 years agoAuto merge of #39567 - frewsxcv:rollup, r=frewsxcv
bors [Sun, 5 Feb 2017 19:33:55 +0000 (19:33 +0000)]
Auto merge of #39567 - frewsxcv:rollup, r=frewsxcv

Rollup of 12 pull requests

- Successful merges: #39439, #39472, #39481, #39491, #39501, #39509, #39514, #39519, #39526, #39528, #39530, #39538
- Failed merges:

7 years agoRollup merge of #39538 - stjepang:slightly-optimize-sort, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:15 +0000 (12:45 -0500)]
Rollup merge of #39538 - stjepang:slightly-optimize-sort, r=alexcrichton

Slightly optimize slice::sort

First, get rid of some bound checks.

Second, instead of comparing by ternary `compare` function, use a binary function testing whether an element is less than some other element. This apparently makes it easier for the compiler to reason about the code. I've noticed the same effect with [pdqsort](https://github.com/stjepang/pdqsort) crate.

Benchmark:

```
name                                        before ns/iter        after ns/iter         diff ns/iter   diff %
slice::bench::sort_large_ascending          8,969 (8919 MB/s)     7,410 (10796 MB/s)          -1,559  -17.38%
slice::bench::sort_large_big_ascending      355,640 (3599 MB/s)   359,137 (3564 MB/s)          3,497    0.98%
slice::bench::sort_large_big_descending     427,112 (2996 MB/s)   424,721 (3013 MB/s)         -2,391   -0.56%
slice::bench::sort_large_big_random         2,207,799 (579 MB/s)  2,138,804 (598 MB/s)       -68,995   -3.13%
slice::bench::sort_large_descending         13,694 (5841 MB/s)    13,514 (5919 MB/s)            -180   -1.31%
slice::bench::sort_large_mostly_ascending   239,697 (333 MB/s)    203,542 (393 MB/s)         -36,155  -15.08%
slice::bench::sort_large_mostly_descending  270,102 (296 MB/s)    234,263 (341 MB/s)         -35,839  -13.27%
slice::bench::sort_large_random             513,406 (155 MB/s)    470,084 (170 MB/s)         -43,322   -8.44%
slice::bench::sort_large_random_expensive   23,650,321 (3 MB/s)   23,675,098 (3 MB/s)         24,777    0.10%
slice::bench::sort_medium_ascending         143 (5594 MB/s)       132 (6060 MB/s)                -11   -7.69%
slice::bench::sort_medium_descending        197 (4060 MB/s)       188 (4255 MB/s)                 -9   -4.57%
slice::bench::sort_medium_random            3,358 (238 MB/s)      3,271 (244 MB/s)               -87   -2.59%
slice::bench::sort_small_ascending          32 (2500 MB/s)        32 (2500 MB/s)                   0    0.00%
slice::bench::sort_small_big_ascending      97 (13195 MB/s)       97 (13195 MB/s)                  0    0.00%
slice::bench::sort_small_big_descending     247 (5182 MB/s)       249 (5140 MB/s)                  2    0.81%
slice::bench::sort_small_big_random         502 (2549 MB/s)       498 (2570 MB/s)                 -4   -0.80%
slice::bench::sort_small_descending         55 (1454 MB/s)        61 (1311 MB/s)                   6   10.91%
slice::bench::sort_small_random             358 (223 MB/s)        356 (224 MB/s)                  -2   -0.56%
```

7 years agoRollup merge of #39530 - TimNN:more-gdb, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:14 +0000 (12:45 -0500)]
Rollup merge of #39530 - TimNN:more-gdb, r=alexcrichton

ignore more gdb versions with buggy rust support

This extends the versions of gdb which were ignored in #39039. While just ignoring gdb versions up to 7.12.1 would have been sufficient for now, I believe (after consulting https://sourceware.org/gdb/wiki/Internals%20Versions)  that ignoring versions up to 7.12.9 will prevent the tests failing again for 7.12.2, etc. while still running all tests for the development versions of gdb (which will be >= 7.12.10 as far as I can tell).

This should fix #39522.

cc @Manishearth, @michaelwoerister, #38948

7 years agoRollup merge of #39528 - dylanmckay:llvm-4.0-diglobalvar, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:13 +0000 (12:45 -0500)]
Rollup merge of #39528 - dylanmckay:llvm-4.0-diglobalvar, r=alexcrichton

[LLVM 4.0] Support a debug info API change for LLVM 4.0

Instead of directly creating a `DIGlobalVariable`, we now have to create
a `DIGlobalVariableExpression` which itself contains a reference to a
'DIGlobalVariable'.

This is a straightforward change.

In the future, we should rename `DIGlobalVariable` in the FFI
bindings, assuming we will only refer to `DIGlobalVariableExpression`
and not `DIGlobalVariable`.

7 years agoRollup merge of #39526 - canndrew:uninhabited-while-let-fix, r=arielb1
Corey Farwell [Sun, 5 Feb 2017 17:45:12 +0000 (12:45 -0500)]
Rollup merge of #39526 - canndrew:uninhabited-while-let-fix, r=arielb1

Uninhabited while-let pattern fix

This fix makes it so while-let with an unsatisfiable pattern raises a correct warning rather than an incorrect error.

7 years agoRollup merge of #39519 - nagisa:more-snap, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:11 +0000 (12:45 -0500)]
Rollup merge of #39519 - nagisa:more-snap, r=alexcrichton

More snap cleanup

r? @alexcrichton

7 years agoRollup merge of #39514 - tbu-:pr_less_syscalls_fd, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:10 +0000 (12:45 -0500)]
Rollup merge of #39514 - tbu-:pr_less_syscalls_fd, r=alexcrichton

Use less syscalls in `FileDesc::set_{nonblocking,cloexec}`

Only set the flags if they differ from what the OS reported, use
`FIONBIO` to atomically set the non-blocking IO flag on Linux.

7 years agoRollup merge of #39509 - petrochenkov:rb2, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:08 +0000 (12:45 -0500)]
Rollup merge of #39509 - petrochenkov:rb2, r=alexcrichton

libbacktrace: Fix uninitialized variable

Fixes https://github.com/rust-lang/rust/issues/39468

7 years agoRollup merge of #39501 - phungleson:libcorebench, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:07 +0000 (12:45 -0500)]
Rollup merge of #39501 - phungleson:libcorebench, r=alexcrichton

Extract libcore benchmarks to a separate folder

Fix #39484

r? @alexcrichton since you seem to know about this :)

Thanks!

7 years agoRollup merge of #39491 - dumbbell:support-aarch64-unknown-freebsd, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:06 +0000 (12:45 -0500)]
Rollup merge of #39491 - dumbbell:support-aarch64-unknown-freebsd, r=alexcrichton

Support aarch64-unknown-freebsd

7 years agoRollup merge of #39481 - ishitatsuyuki:master, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:05 +0000 (12:45 -0500)]
Rollup merge of #39481 - ishitatsuyuki:master, r=alexcrichton

liballoc_jemalloc: fix linking with system library

Fix #39215

7 years agoRollup merge of #39472 - est31:unadjusted_only_for_win, r=nagisa
Corey Farwell [Sun, 5 Feb 2017 17:45:04 +0000 (12:45 -0500)]
Rollup merge of #39472 - est31:unadjusted_only_for_win, r=nagisa

Don't use "unadjusted" ABI on non windows platforms

We introduced the unadjusted ABI to work around wrong
(buggy) ABI expectations by LLVM on Windows [1].
Therefore, it should be solely used on Windows and not
on other platforms, like right now is the case.

[1]: see this comment for details https://github.com/rust-lang/rust/pull/38482#issuecomment-269074031

7 years agoRollup merge of #39439 - king6cong:move, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 17:45:02 +0000 (12:45 -0500)]
Rollup merge of #39439 - king6cong:move, r=alexcrichton

rename other than copy/remove

7 years agoAuto merge of #39408 - ollie27:i128_try_from, r=alexcrichton
bors [Sun, 5 Feb 2017 16:57:29 +0000 (16:57 +0000)]
Auto merge of #39408 - ollie27:i128_try_from, r=alexcrichton

Fix TryFrom for i128/u128

Another case of `as` cast silent truncation being error prone.

This also adds a few missing TryFrom tests to libcoretest.

cc #33417
cc #35118

7 years agoFix make tidy
Andrew Cann [Sun, 5 Feb 2017 14:29:06 +0000 (22:29 +0800)]
Fix make tidy

7 years agoAuto merge of #39563 - frewsxcv:rollup, r=frewsxcv
bors [Sun, 5 Feb 2017 14:15:18 +0000 (14:15 +0000)]
Auto merge of #39563 - frewsxcv:rollup, r=frewsxcv

Rollup of 19 pull requests

- Successful merges: #38518, #38921, #38959, #38983, #39009, #39107, #39193, #39289, #39312, #39393, #39442, #39443, #39453, #39454, #39471, #39477, #39478, #39527, #39552
- Failed merges:

7 years agoRollup merge of #39552 - zackmdavis:more_struct_aliases_stabilization_version, r...
Corey Farwell [Sun, 5 Feb 2017 14:14:57 +0000 (09:14 -0500)]
Rollup merge of #39552 - zackmdavis:more_struct_aliases_stabilization_version, r=petrochenkov

correct version in which more_struct_aliases was/will be stable

The stabilizing commit is 5056a437, which is not in 1.14, but is (at
time of writing) on the 1.16 beta branch. [See discussion](https://github.com/rust-lang/rust/pull/39282#discussion_r99481687).

7 years agoRollup merge of #39527 - king6cong:bootstrap-doc, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:56 +0000 (09:14 -0500)]
Rollup merge of #39527 - king6cong:bootstrap-doc, r=alexcrichton

README path correction

7 years agoRollup merge of #39478 - alexcrichton:add-xpy, r=japaric
Corey Farwell [Sun, 5 Feb 2017 14:14:54 +0000 (09:14 -0500)]
Rollup merge of #39478 - alexcrichton:add-xpy, r=japaric

rustbuild: Add x.py to source tarballs

We should be sure to add our build system entry point!

Closes #39476

7 years agoRollup merge of #39477 - jimmycuadra:try-from-parameter-name, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:53 +0000 (09:14 -0500)]
Rollup merge of #39477 - jimmycuadra:try-from-parameter-name, r=alexcrichton

Add a name for the parameter to `TryFrom::try_from`.

Although signatures with anonymous parameters may not be deprecated or removed at this point, the team seems to agree that the ability to have an anonymous parameter is unfortunate historical baggage, and that we shouldn't create new code that uses it.

Context: https://github.com/rust-lang/rust/issues/33417#issuecomment-276933861

7 years agoRollup merge of #39471 - djc:bootstrap-user, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:51 +0000 (09:14 -0500)]
Rollup merge of #39471 - djc:bootstrap-user, r=alexcrichton

Fix bootstrap.py issues with new rustbuild build system (fixes #39469)

7 years agoRollup merge of #39454 - abonander:proc_macro_tracking_issue, r=jseyfried
Corey Farwell [Sun, 5 Feb 2017 14:14:50 +0000 (09:14 -0500)]
Rollup merge of #39454 - abonander:proc_macro_tracking_issue, r=jseyfried

Change tracking issue for `proc_macro` feature to #38356

r? @jseyfried

7 years agoRollup merge of #39453 - nrc:save-path, r=nikomatsakis
Corey Farwell [Sun, 5 Feb 2017 14:14:49 +0000 (09:14 -0500)]
Rollup merge of #39453 - nrc:save-path, r=nikomatsakis

save-analysis: be more paranoid about generated paths

fixes https://github.com/rust-lang-nursery/rls/issues/160

7 years agoRollup merge of #39443 - phungleson:remove-unresolved-things, r=nikomatsakis
Corey Farwell [Sun, 5 Feb 2017 14:14:48 +0000 (09:14 -0500)]
Rollup merge of #39443 - phungleson:remove-unresolved-things, r=nikomatsakis

Don't suggest to use things which weren't found either

Fixes #38054

The best code I can come up with, suggestions are welcome.

Basically, removing ```. Did you mean to use `DoesntExist1`?``` in the code below, because it is useless.

```rust
error[E0432]: unresolved import `DoesntExist1`
 --> src/lib.rs:1:5
  |
1 | use DoesntExist1;
  |     ^^^^^^^^^^^^ no `DoesntExist1` in the root

error[E0432]: unresolved import `DoesntExist2`
 --> src/lib.rs:2:5
  |
2 | use DoesntExist2;
  |     ^^^^^^^^^^^^ no `DoesntExist2` in the root. Did you mean to use `DoesntExist1`?
```

7 years agoRollup merge of #39442 - keeperofdakeys:expand-derives, r=jseyfried
Corey Farwell [Sun, 5 Feb 2017 14:14:46 +0000 (09:14 -0500)]
Rollup merge of #39442 - keeperofdakeys:expand-derives, r=jseyfried

Expand derive macros in the MacroExpander

This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.

Fixes https://github.com/rust-lang/rust/issues/39326

r? @jseyfried

7 years agoRollup merge of #39393 - ollie27:stab_impls, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:45 +0000 (09:14 -0500)]
Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichton

Fix a few impl stability attributes

The versions show up in rustdoc.

7 years agoRollup merge of #39312 - mgattozzi:rustdoc-help-fix, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:44 +0000 (09:14 -0500)]
Rollup merge of #39312 - mgattozzi:rustdoc-help-fix, r=alexcrichton

Fix full path being output with `rustdoc -h`

rustdoc would output the full path to the binary when calling it with
the `-h` or `--help` flags. This is undesired behavior. It has been
replaced with a hardcoded string `rustdoc` to fix the issue.

Fixes #39310

7 years agoRollup merge of #39289 - shahn:option_entry, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:42 +0000 (09:14 -0500)]
Rollup merge of #39289 - shahn:option_entry, r=alexcrichton

Provide Entry-like API for Option

This implements #39288.

I am wondering whether to use std::intrinsics::unreachable!() here. Both seems fine to me (the second match optimizes away in release mode).

7 years agoRollup merge of #39193 - pepyakin:emcc-strip-panic-rt, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:41 +0000 (09:14 -0500)]
Rollup merge of #39193 - pepyakin:emcc-strip-panic-rt, r=alexcrichton

Tell emscripten to remove exception handling code when panic=abort

Fixes #36900

7 years agoRollup merge of #39107 - llogiq:branchless_filter_count, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:40 +0000 (09:14 -0500)]
Rollup merge of #39107 - llogiq:branchless_filter_count, r=alexcrichton

branchless .filter(_).count()

I found that the branchless version is only slower if we have little to no branch misses, which usually isn't the case. I notice speedups between -5% (perfect prediction) and 60% (real world data).

7 years agoRollup merge of #39009 - canndrew:default-unit-warnings, r=nikomatsakis
Corey Farwell [Sun, 5 Feb 2017 14:14:39 +0000 (09:14 -0500)]
Rollup merge of #39009 - canndrew:default-unit-warnings, r=nikomatsakis

Add warning for () to ! switch

With feature(never_type) enabled diverging type variables will default to `!` instead of `()`. This can cause breakages where a trait is resolved on such a type.

This PR emits a future-compatibility warning when it sees this happen.

7 years agoRollup merge of #38983 - APTy:udp-peek, r=aturon
Corey Farwell [Sun, 5 Feb 2017 14:14:38 +0000 (09:14 -0500)]
Rollup merge of #38983 - APTy:udp-peek, r=aturon

Add peek APIs to std::net

Adds "peek" APIs to `std::net` sockets, including:
- `UdpSocket.peek()`
- `UdpSocket.peek_from()`
- `TcpStream.peek()`

These methods enable socket reads without side-effects. That is, repeated calls to `peek()` return identical data. This is accomplished by providing the POSIX flag `MSG_PEEK` to the underlying socket read operations.

This also moves the current implementation of `recv_from` out of the platform-independent `sys_common` and into respective `sys/windows` and `sys/unix` implementations. This allows for more platform-dependent implementations where necessary.

Fixes #38980

7 years agoRollup merge of #38959 - Amanieu:atomic128, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:37 +0000 (09:14 -0500)]
Rollup merge of #38959 - Amanieu:atomic128, r=alexcrichton

Add 128-bit atomics

This is currently only supported on AArch64 since that is the only target which unconditionally supports 128-bit atomic operations.

cc #35118

7 years agoRollup merge of #38921 - chris-morgan:windows-unprivileged-symlink-creation, r=alexcr...
Corey Farwell [Sun, 5 Feb 2017 14:14:36 +0000 (09:14 -0500)]
Rollup merge of #38921 - chris-morgan:windows-unprivileged-symlink-creation, r=alexcrichton

Support unprivileged symlink creation in Windows

Symlink creation on Windows has in the past basically required admin; it’s being opened up a bit in the Creators Update, so that at least people who have put their computers into Developer Mode will be able to create symlinks without special privileges. (It’s unclear from what Microsoft has said whether Developer Mode will be required in the final Creators Update release, but sadly I expect it still will be, so this *still* won’t be as helpful as I’d like.)

Because of compatibility concerns, they’ve hidden this new functionality behind a new flag in the CreateSymbolicLink dwFlags: `SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE`. So we add this flag in order to join the party.

Sources:

- https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/ is the official announcement (search for CreateSymbolicLink)

- https://news.ycombinator.com/item?id=13096354 on why the new flag.

7 years agoRollup merge of #38518 - nagisa:exec-doc, r=alexcrichton
Corey Farwell [Sun, 5 Feb 2017 14:14:34 +0000 (09:14 -0500)]
Rollup merge of #38518 - nagisa:exec-doc, r=alexcrichton

Expand documentation of process::exit and exec

Show a conventional way to use process::exit when destructors are considered important and also
mention that the same caveats wrt destructors apply to exec as well.

7 years agoRemove use of ptr::eq
Andrew Cann [Sun, 5 Feb 2017 08:41:32 +0000 (16:41 +0800)]
Remove use of ptr::eq

7 years agoAuto merge of #38161 - durka:rustdoc-crate-attrs, r=alexcrichton
bors [Sun, 5 Feb 2017 05:54:44 +0000 (05:54 +0000)]
Auto merge of #38161 - durka:rustdoc-crate-attrs, r=alexcrichton

rustdoc: fix doctests with non-feature crate attrs

Fixes #38129.

The book says that any top-level crate attributes at the beginning of a doctest are moved outside the generated `fn main`, but it was only checking for `#![feature`, not `#![`.

These attributes previously caused warnings but were then ignored, so in theory this could change the behavior of doctests in the wild.

7 years agocorrect version in which more_struct_aliases was/will be stable
Zack M. Davis [Sun, 5 Feb 2017 05:18:35 +0000 (21:18 -0800)]
correct version in which more_struct_aliases was/will be stable

The stabilizing commit is 5056a437, which is not in 1.14, but is (at
time of writing) on the 1.16 beta branch.

7 years agoUpdate pretty test for derive attributes
Josh Driver [Sun, 5 Feb 2017 01:52:29 +0000 (12:22 +1030)]
Update pretty test for derive attributes

Remove attr-variant-data.rs since it relies on quirks
in legacy custom derive resolution (undefined derives
only print a warning).

Add a new test which uses a defined proc macro derive,
and tests pretty printing of proc macro derive
attributes.

7 years agoAuto merge of #38103 - zackmdavis:lint_errors_resulting_from_lint_groups_or_warnings_...
bors [Sun, 5 Feb 2017 01:22:54 +0000 (01:22 +0000)]
Auto merge of #38103 - zackmdavis:lint_errors_resulting_from_lint_groups_or_warnings_meta-lint_obscure_the_original_lint_name, r=nikomatsakis

note individual lint name in messages set via lint group attribute

![lint_errors_resulting_from_lint_groups_obscure](https://cloud.githubusercontent.com/assets/1076988/20783614/c107d5c8-b749-11e6-85de-eada7f67c986.png)

Resolves #36846.

r? @jonathandturner

-----

***Update*** 16 December (new commits):
![lint_group_makeover_party](https://cloud.githubusercontent.com/assets/1076988/21284540/ff1ae2fc-c3d2-11e6-93be-d0689f5fa7a8.png)

7 years agoProvide Entry-like API for Option
Sebastian Hahn [Wed, 25 Jan 2017 06:13:26 +0000 (07:13 +0100)]
Provide Entry-like API for Option

This implements #39288.

Thanks to @steveklabnik and @oli-obk for their review comments :)

7 years agoFix TryFrom for i128/u128
Oliver Middleton [Sat, 4 Feb 2017 23:10:28 +0000 (23:10 +0000)]
Fix TryFrom for i128/u128

Another case of `as` cast silent truncation being error prone.

This also adds a few missing TryFrom tests to libcoretest.

7 years agoMove derive macro expansion into the MacroExpander
Josh Driver [Wed, 1 Feb 2017 10:33:09 +0000 (21:03 +1030)]
Move derive macro expansion into the MacroExpander

This removes the expand_derives function, and sprinkles
the functionality throughout the Invocation Collector,
Expander and Resolver.

7 years agoRename CustomDerive to ProcMacroDerive for macros 1.1
Josh Driver [Mon, 23 Jan 2017 22:25:08 +0000 (08:55 +1030)]
Rename CustomDerive to ProcMacroDerive for macros 1.1

7 years agoMake builtin derives a SyntaxExtension
Josh Driver [Mon, 23 Jan 2017 15:01:49 +0000 (01:31 +1030)]
Make builtin derives a SyntaxExtension

This allows builtin derives to be registered and
resolved, just like other derive types.

7 years agoAuto merge of #38426 - vadimcn:nobundle, r=alexcrichton
bors [Sat, 4 Feb 2017 21:13:07 +0000 (21:13 +0000)]
Auto merge of #38426 - vadimcn:nobundle, r=alexcrichton

Implement kind="static-nobundle" (RFC 1717)

This implements the "static-nobundle" library kind (last item from #37403).

Rustc handles "static-nobundle" libs very similarly to dylibs, except that on Windows, uses of their symbols do not get marked with "dllimport".  Which is the whole point of this feature.

7 years agolibstd/net: Add `peek` APIs to UdpSocket and TcpStream
Tyler Julian [Wed, 11 Jan 2017 03:11:56 +0000 (19:11 -0800)]
libstd/net: Add `peek` APIs to UdpSocket and TcpStream

These methods enable socket reads without side-effects. That is,
repeated calls to peek() return identical data. This is accomplished
by providing the POSIX flag MSG_PEEK to the underlying socket read
operations.

This also moves the current implementation of recv_from out of the
platform-independent sys_common and into respective sys/windows and
sys/unix implementations. This allows for more platform-dependent
implementations.

7 years agonote wording: lint implied by lint group, not lint group implies lint
Zack M. Davis [Fri, 6 Jan 2017 04:01:22 +0000 (20:01 -0800)]
note wording: lint implied by lint group, not lint group implies lint

7 years agomake lint-group-style test a UI rather than a compile-fail test
Zack M. Davis [Thu, 5 Jan 2017 07:32:09 +0000 (23:32 -0800)]
make lint-group-style test a UI rather than a compile-fail test

As suggested by Niko Matsakis in review
(https://github.com/rust-lang/rust/pull/38103#discussion_r94460982) regarding
the endeavor prompted by #36846.

7 years agonote lint group set on command line triggering individual lint
Zack M. Davis [Fri, 6 Jan 2017 02:55:43 +0000 (18:55 -0800)]
note lint group set on command line triggering individual lint

Previously, the note/message for the source of a lint being the command
line unconditionally named the individual lint, even if the actual
command specified a lint group (e.g., `-D warnings`); here, we take note
of the actual command options so we can be more specific.

This remains in the matter of #36846.

7 years agonote individual lint name set via lint group attribute in notes
Zack M. Davis [Fri, 6 Jan 2017 02:55:36 +0000 (18:55 -0800)]
note individual lint name set via lint group attribute in notes

Warning or error messages set via a lint group attribute
(e.g. `#[deny(warnings)]`) should still make it clear which individual
lint (by name) was triggered, similarly to how we include "on by
default" language for default lints. This—and, while we're here, the
existing "on by default" language—can be tucked into a note rather than
cluttering the main error message. This occasions the slightest of
refactorings (we now have to get the diagnostic-builder with the main
message first, before matching on the lint source).

This is in the matter of #36846.

7 years agoAuto merge of #39424 - nikomatsakis:incr-comp-skip-typeck-3, r=mw
bors [Sat, 4 Feb 2017 18:38:56 +0000 (18:38 +0000)]
Auto merge of #39424 - nikomatsakis:incr-comp-skip-typeck-3, r=mw

rewrite the predecessors code to create a reduced graph

The old code created a flat listing of "HIR -> WorkProduct" edges.
While perfectly general, this could lead to a lot of repetition if the
same HIR nodes affect many work-products. This is set to be a problem
when we start to skip typeck, since we will be adding a lot more
"work-product"-like nodes.

The newer code uses an alternative strategy: it "reduces" the graph
instead. Basically we walk the dep-graph and convert it to a DAG, where
we only keep intermediate nodes if they are used by multiple
work-products.

This DAG does not contain the same set of nodes as the original graph,
but it is guaranteed that (a) every output node is included in the graph
and (b) the set of input nodes that can reach each output node is
unchanged.

(Input nodes are basically HIR nodes and foreign metadata; output nodes
are nodes that have assocaited state which we will persist to disk in
some way. These are assumed to be disjoint sets.)

r? @michaelwoerister

Fixes #39494

7 years agoMinor fix in the *_expensive benchmark
Stjepan Glavina [Sat, 4 Feb 2017 17:04:26 +0000 (18:04 +0100)]
Minor fix in the *_expensive benchmark

Before, the `count` would be copied into the closure and could
potentially be optimized way. This change ensures it's borrowed by
closure and finally consumed by `test::black_box`.

7 years agoAuto merge of #39533 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sat, 4 Feb 2017 16:04:08 +0000 (16:04 +0000)]
Auto merge of #39533 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 3 pull requests

- Successful merges: #39486, #39506, #39517
- Failed merges:

7 years agoSlightly optimize slice::sort
Stjepan Glavina [Sat, 4 Feb 2017 15:26:01 +0000 (16:26 +0100)]
Slightly optimize slice::sort

First, get rid of some bound checks.

Second, instead of comparing by ternary `compare` function, use a binary
function testing whether an element is less than some other element.
This apparently makes it easier for the compiler to reason about the
code.

Benchmark:

```
name                                        before ns/iter        after ns/iter         diff ns/iter   diff %
slice::bench::sort_large_ascending          8,969 (8919 MB/s)     7,410 (10796 MB/s)          -1,559  -17.38%
slice::bench::sort_large_big_ascending      355,640 (3599 MB/s)   359,137 (3564 MB/s)          3,497    0.98%
slice::bench::sort_large_big_descending     427,112 (2996 MB/s)   424,721 (3013 MB/s)         -2,391   -0.56%
slice::bench::sort_large_big_random         2,207,799 (579 MB/s)  2,138,804 (598 MB/s)       -68,995   -3.13%
slice::bench::sort_large_descending         13,694 (5841 MB/s)    13,514 (5919 MB/s)            -180   -1.31%
slice::bench::sort_large_mostly_ascending   239,697 (333 MB/s)    203,542 (393 MB/s)         -36,155  -15.08%
slice::bench::sort_large_mostly_descending  270,102 (296 MB/s)    234,263 (341 MB/s)         -35,839  -13.27%
slice::bench::sort_large_random             513,406 (155 MB/s)    470,084 (170 MB/s)         -43,322   -8.44%
slice::bench::sort_large_random_expensive   23,650,321 (3 MB/s)   23,675,098 (3 MB/s)         24,777    0.10%
slice::bench::sort_medium_ascending         143 (5594 MB/s)       132 (6060 MB/s)                -11   -7.69%
slice::bench::sort_medium_descending        197 (4060 MB/s)       188 (4255 MB/s)                 -9   -4.57%
slice::bench::sort_medium_random            3,358 (238 MB/s)      3,271 (244 MB/s)               -87   -2.59%
slice::bench::sort_small_ascending          32 (2500 MB/s)        32 (2500 MB/s)                   0    0.00%
slice::bench::sort_small_big_ascending      97 (13195 MB/s)       97 (13195 MB/s)                  0    0.00%
slice::bench::sort_small_big_descending     247 (5182 MB/s)       249 (5140 MB/s)                  2    0.81%
slice::bench::sort_small_big_random         502 (2549 MB/s)       498 (2570 MB/s)                 -4   -0.80%
slice::bench::sort_small_descending         55 (1454 MB/s)        61 (1311 MB/s)                   6   10.91%
slice::bench::sort_small_random             358 (223 MB/s)        356 (224 MB/s)                  -2   -0.56%
```

7 years agoRollup merge of #39517 - brson:relnotes-151, r=alexcrichton
Guillaume Gomez [Sat, 4 Feb 2017 13:41:25 +0000 (14:41 +0100)]
Rollup merge of #39517 - brson:relnotes-151, r=alexcrichton

Update relnotes for 1.15.1

I already checked this into stable, but it needs to be on master/beta too.

7 years agoRollup merge of #39506 - GuillaumeGomez:hashmap_docs, r=frewsxcv
Guillaume Gomez [Sat, 4 Feb 2017 13:41:24 +0000 (14:41 +0100)]
Rollup merge of #39506 - GuillaumeGomez:hashmap_docs, r=frewsxcv

Add missing urls in HashMap

r? @frewsxcv

7 years agoRollup merge of #39486 - phungleson:tiny-doc-wording-change, r=alexcrichton
Guillaume Gomez [Sat, 4 Feb 2017 13:41:23 +0000 (14:41 +0100)]
Rollup merge of #39486 - phungleson:tiny-doc-wording-change, r=alexcrichton

Tiny doc wording change

Fix https://github.com/rust-lang/rust/issues/39366

7 years agoAuto merge of #39434 - nikomatsakis:incr-comp-skip-typeck-2, r=eddyb
bors [Sat, 4 Feb 2017 12:38:13 +0000 (12:38 +0000)]
Auto merge of #39434 - nikomatsakis:incr-comp-skip-typeck-2, r=eddyb

Miscellaneous refactors around how lints and typeck interact

This is preparation for making incr. comp. skip typeck. The main gist of is trying to rationalize the outputs from typeck that are not part of tables:

- one bit of output is the `used_trait_imports` set, which becomes something we track for dependencies
- the other big of output are various lints; we used to store these into a table on sess, but this work stores them into the`TypeckTables`, and then makes the lint pass consult that
    - I think it probably makes sense to handle errors similarly, eventually, but that's not necessary now

r? @eddyb

Fixes #39495

7 years agopacify the mercilous tidy, improve cycle unit test
Niko Matsakis [Sat, 4 Feb 2017 11:09:19 +0000 (06:09 -0500)]
pacify the mercilous tidy, improve cycle unit test

7 years agoignore more gdb versions with buggy rust support
Tim Neumann [Sat, 4 Feb 2017 10:44:29 +0000 (11:44 +0100)]
ignore more gdb versions with buggy rust support

7 years agoSupport a debug info API change for LLVM 4.0
Dylan McKay [Sat, 4 Feb 2017 10:22:05 +0000 (23:22 +1300)]
Support a debug info API change for LLVM 4.0

Instead of directly creating a 'DIGlobalVariable', we now have to create
a 'DIGlobalVariableExpression' which itself contains a reference to a
'DIGlobalVariable'.

This is a straightforward change.

In the future, we should rename 'DIGlobalVariable' in the FFI
bindings, assuming we will only refer to 'DIGlobalVariableExpression'
and not 'DIGlobalVariable'.

7 years agoAuto merge of #39440 - F001:SpecializeCow, r=bluss
bors [Sat, 4 Feb 2017 10:04:06 +0000 (10:04 +0000)]
Auto merge of #39440 - F001:SpecializeCow, r=bluss

std: Add ToString trait specialization for Cow<'a, str> and String

There is a specialized version of ToString for str type in std. I think there are other types can also benefit from specialization. `Cow` and `String` are the most obvious one.

r? @bluss

7 years agoREADME path correction
king6cong [Sat, 4 Feb 2017 08:44:23 +0000 (16:44 +0800)]
README path correction

7 years agoUninhabited while-let pattern fix
Andrew Cann [Sat, 4 Feb 2017 08:27:45 +0000 (16:27 +0800)]
Uninhabited while-let pattern fix

7 years agoAuto merge of #39425 - jakllsch:netbsd-a, r=alexcrichton
bors [Sat, 4 Feb 2017 07:29:28 +0000 (07:29 +0000)]
Auto merge of #39425 - jakllsch:netbsd-a, r=alexcrichton

Don't build gcc_personality_v0.c on NetBSD either

7 years agoExpand defaulted unit test
Andrew Cann [Sat, 4 Feb 2017 06:17:58 +0000 (14:17 +0800)]
Expand defaulted unit test

7 years agoFix test
Andrew Cann [Sat, 4 Feb 2017 06:03:28 +0000 (14:03 +0800)]
Fix test

7 years agoAuto merge of #39399 - clarcharr:iter_rfind, r=alexcrichton
bors [Sat, 4 Feb 2017 04:53:53 +0000 (04:53 +0000)]
Auto merge of #39399 - clarcharr:iter_rfind, r=alexcrichton

Add Iterator::rfind.

I found it weird that `Iterator` has `rpostition` but not `rfind`. This adds that method.

7 years agoUnignore stage0/1 i128 tests as well
Simonas Kazlauskas [Sat, 4 Feb 2017 04:12:23 +0000 (06:12 +0200)]
Unignore stage0/1 i128 tests as well

7 years agoMore snap cleanup
Simonas Kazlauskas [Sat, 4 Feb 2017 02:53:09 +0000 (04:53 +0200)]
More snap cleanup

7 years agorun rustfmt for librustc/util/fs.rs
king6cong [Sat, 4 Feb 2017 02:21:26 +0000 (10:21 +0800)]
run rustfmt for librustc/util/fs.rs

7 years agoDon't link "nobundle" libs which had already been included in upstream crate.
Vadim Chugunov [Sat, 4 Feb 2017 02:25:20 +0000 (18:25 -0800)]
Don't link "nobundle" libs which had  already been included in upstream crate.

7 years agogo back to the older model of coherence collect
Niko Matsakis [Sat, 4 Feb 2017 02:13:59 +0000 (21:13 -0500)]
go back to the older model of coherence collect

7 years agoDon't use "unadjusted" ABI on non windows platforms
est31 [Thu, 2 Feb 2017 21:32:20 +0000 (22:32 +0100)]
Don't use "unadjusted" ABI on non windows platforms

We introduced the unadjusted ABI to work around wrong
(buggy) ABI expectations by LLVM on Windows [1].
Therefore, it should be solely used on Windows and not
on other platforms, like right now is the case.

[1]: see this comment for details https://github.com/rust-lang/rust/pull/38482#issuecomment-269074031

7 years agoAuto merge of #36320 - GuillaumeGomez:rustdoc_test_info, r=alexcrichton
bors [Sat, 4 Feb 2017 01:32:21 +0000 (01:32 +0000)]
Auto merge of #36320 - GuillaumeGomez:rustdoc_test_info, r=alexcrichton

Add information in case of markdown block code test failure

r? @steveklabnik

cc @jonathandturner

7 years agoUpdate relnotes for 1.15.1
Brian Anderson [Sat, 4 Feb 2017 01:12:38 +0000 (01:12 +0000)]
Update relnotes for 1.15.1

I already checked this into stable, but it needs to be on master/beta too.

7 years agoUse less syscalls in `FileDesc::set_{nonblocking,cloexec}`
Tobias Bucher [Sat, 4 Feb 2017 00:10:12 +0000 (01:10 +0100)]
Use less syscalls in `FileDesc::set_{nonblocking,cloexec}`

Only set the flags if they differ from what the OS reported, use
`FIONBIO` to atomically set the non-blocking IO flag on Linux.

7 years agoExtract libcore benchmarks to a separate folder
Son [Fri, 3 Feb 2017 23:04:22 +0000 (10:04 +1100)]
Extract libcore benchmarks to a separate folder

7 years agoAuto merge of #39463 - alexcrichton:update-bootstrap, r=alexcrichton
bors [Fri, 3 Feb 2017 22:55:28 +0000 (22:55 +0000)]
Auto merge of #39463 - alexcrichton:update-bootstrap, r=alexcrichton

Bump version, upgrade bootstrap

This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.

7 years agolibbacktrace: Fix uninitialized variable
Vadim Petrochenkov [Fri, 3 Feb 2017 22:18:10 +0000 (01:18 +0300)]
libbacktrace: Fix uninitialized variable

7 years agoAdd missing urls in HashMap
Guillaume Gomez [Fri, 3 Feb 2017 21:38:44 +0000 (22:38 +0100)]
Add missing urls in HashMap

7 years agoBump version, upgrade bootstrap
Alex Crichton [Wed, 1 Feb 2017 23:57:50 +0000 (15:57 -0800)]
Bump version, upgrade bootstrap

This commit updates the version number to 1.17.0 as we're not on that version of
the nightly compiler, and at the same time this updates src/stage0.txt to
bootstrap from freshly minted beta compiler and beta Cargo.

7 years agoAuto merge of #39356 - krdln:format-with-capacity, r=aturon
bors [Fri, 3 Feb 2017 20:09:36 +0000 (20:09 +0000)]
Auto merge of #39356 - krdln:format-with-capacity, r=aturon

Use `String::with_capacity` in `format!`

Add an `Arguments::estimated_capacity` to estimate the length of formatted text and use it in `std::fmt::format` as the initial capacity of the buffer.

The capacity is calculated based on the literal parts of format string, see the details in the implementation.

Some benches:
```rust
empty:       format!("{}", black_box(""))
literal:     format!("Literal")
long:        format!("Hello Hello Hello Hello, {}!", black_box("world"))
long_rev:    format!("{}, hello hello hello hello!", black_box("world"))
long_rev_2:  format!("{}{}, hello hello hello hello!", 1, black_box("world"))
short:       format!("Hello, {}!", black_box("world"))
short_rev:   format!("{}, hello!", black_box("world"))
short_rev_2: format!("{}{}, hello!", 1, black_box("world"))
surround:    format!("aaaaa{}ccccc{}eeeee", black_box("bbbbb"), black_box("eeeee"))
two_spaced:  format!("{} {}", black_box("bbbbb"), black_box("eeeee"))
worst_case:  format!("{} a long piece...", black_box("and even longer argument. not sure why it has to be so long"))
```
```
 empty        25            28                      3   12.00%
 literal      35            29                     -6  -17.14%
 long         80            46                    -34  -42.50%
 long_rev     79            45                    -34  -43.04%
 long_rev_2   111           66                    -45  -40.54%
 short        73            46                    -27  -36.99%
 short_rev    74            76                      2    2.70%
 short_rev_2  107           108                     1    0.93%
 surround     142           65                    -77  -54.23%
 two_spaced   111           115                     4    3.60%
 worst_case   89            101                    12   13.48%
```

7 years agoLet the ICH testing framework check that all #[rustc_dirty] attrs have been actually...
Michael Woerister [Fri, 3 Feb 2017 18:07:15 +0000 (13:07 -0500)]
Let the ICH testing framework check that all #[rustc_dirty] attrs have been actually checked.

7 years agoadd a comment about optimality that somehow got removed
Niko Matsakis [Fri, 3 Feb 2017 17:42:18 +0000 (12:42 -0500)]
add a comment about optimality that somehow got removed

7 years agoMerge remote-tracking branch 'upstream/master' into format-with-capacity
Michał Krasnoborski [Fri, 3 Feb 2017 16:48:07 +0000 (17:48 +0100)]
Merge remote-tracking branch 'upstream/master' into format-with-capacity

7 years agotiny doc wording change
Son [Fri, 3 Feb 2017 13:16:56 +0000 (00:16 +1100)]
tiny doc wording change

7 years agoUpdate to last cargo version
Guillaume Gomez [Fri, 3 Feb 2017 12:55:18 +0000 (13:55 +0100)]
Update to last cargo version

7 years agoAuto merge of #39418 - redox-os:redox_fs_ext, r=brson
bors [Fri, 3 Feb 2017 11:42:32 +0000 (11:42 +0000)]
Auto merge of #39418 - redox-os:redox_fs_ext, r=brson

Add dev and ino to MetadataExt

This adds .dev() and .ino() to MetadataExt on Redox

7 years agos/in_index/input_index/
Niko Matsakis [Fri, 3 Feb 2017 11:09:47 +0000 (06:09 -0500)]
s/in_index/input_index/

7 years agomake dirty process O(dirty)
Niko Matsakis [Fri, 3 Feb 2017 11:08:16 +0000 (06:08 -0500)]
make dirty process O(dirty)

The old algorithm was O(graph)

7 years agoFix test
Andrew Cann [Sun, 29 Jan 2017 15:49:01 +0000 (23:49 +0800)]
Fix test