Commit Graph

61149 Commits

Author SHA1 Message Date
Guillaume Gomez
0cc2448e05 Replace PlaceBack Debug implementation with derive 2017-02-05 09:46:15 +01:00
Andrew Cann
0dbb1e4fee Remove use of ptr::eq 2017-02-05 16:41:32 +08:00
bors
696f5c1fc6 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.
2017-02-05 05:54:44 +00:00
Zack M. Davis
5e06aeeef0 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.
2017-02-04 21:30:16 -08:00
Josh Driver
a201348775 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.
2017-02-05 12:22:29 +10:30
bors
d7777ae682 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)
2017-02-05 01:22:54 +00:00
Sebastian Hahn
8e02ad0ada Provide Entry-like API for Option
This implements #39288.

Thanks to @steveklabnik and @oli-obk for their review comments :)
2017-02-05 00:48:44 +01:00
Oliver Middleton
a2de6e2285 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.
2017-02-04 23:10:28 +00:00
Josh Driver
fbdd038866 Move derive macro expansion into the MacroExpander
This removes the expand_derives function, and sprinkles
the functionality throughout the Invocation Collector,
Expander and Resolver.
2017-02-05 09:31:02 +10:30
Josh Driver
0a7380d7fc Rename CustomDerive to ProcMacroDerive for macros 1.1 2017-02-05 09:31:02 +10:30
Josh Driver
0477daf9f0 Make builtin derives a SyntaxExtension
This allows builtin derives to be registered and
resolved, just like other derive types.
2017-02-05 09:31:01 +10:30
bors
ea7a6486a2 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.
2017-02-04 21:13:07 +00:00
Tyler Julian
a40be0857c 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.
2017-02-04 12:00:19 -08:00
Zack M. Davis
72af42e897 note wording: lint implied by lint group, not lint group implies lint 2017-02-04 10:51:11 -08:00
Zack M. Davis
778958f256 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.
2017-02-04 10:51:11 -08:00
Zack M. Davis
93014467f8 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.
2017-02-04 10:51:11 -08:00
Zack M. Davis
65b0554143 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.
2017-02-04 10:44:22 -08:00
bors
eb5cb9545c 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
2017-02-04 18:38:56 +00:00
Stjepan Glavina
fa457bff26 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`.
2017-02-04 18:04:26 +01:00
bors
8967085617 Auto merge of #39533 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 3 pull requests

- Successful merges: #39486, #39506, #39517
- Failed merges:
2017-02-04 16:04:08 +00:00
Stjepan Glavina
a884a6c60d 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%
```
2017-02-04 16:44:43 +01:00
Guillaume Gomez
e204987bdb 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.
2017-02-04 14:41:25 +01:00
Guillaume Gomez
2ce93c1cd2 Rollup merge of #39506 - GuillaumeGomez:hashmap_docs, r=frewsxcv
Add missing urls in HashMap

r? @frewsxcv
2017-02-04 14:41:24 +01:00
Guillaume Gomez
d81b440e92 Rollup merge of #39486 - phungleson:tiny-doc-wording-change, r=alexcrichton
Tiny doc wording change

Fix https://github.com/rust-lang/rust/issues/39366
2017-02-04 14:41:23 +01:00
bors
e4eea73306 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
2017-02-04 12:38:13 +00:00
Niko Matsakis
b3096e25c0 pacify the mercilous tidy, improve cycle unit test 2017-02-04 06:09:19 -05:00
Tim Neumann
112a5a00e8 ignore more gdb versions with buggy rust support 2017-02-04 11:44:29 +01:00
Dylan McKay
768c6c081e 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'.
2017-02-04 23:22:05 +13:00
bors
8568fdc499 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
2017-02-04 10:04:06 +00:00
king6cong
b4ef361a8c README path correction 2017-02-04 16:44:23 +08:00
Andrew Cann
a1f42cd893 Uninhabited while-let pattern fix 2017-02-04 16:27:45 +08:00
bors
7df5c0f17b Auto merge of #39425 - jakllsch:netbsd-a, r=alexcrichton
Don't build gcc_personality_v0.c on NetBSD either
2017-02-04 07:29:28 +00:00
Andrew Cann
42f3ac5ea6 Expand defaulted unit test 2017-02-04 14:17:58 +08:00
Andrew Cann
7444d07154 Fix test 2017-02-04 14:03:28 +08:00
bors
1b5c7ac833 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.
2017-02-04 04:53:53 +00:00
Simonas Kazlauskas
206ee20258 Unignore stage0/1 i128 tests as well 2017-02-04 06:12:23 +02:00
Simonas Kazlauskas
87ace0d720 More snap cleanup 2017-02-04 04:53:09 +02:00
king6cong
5a21f42cb7 run rustfmt for librustc/util/fs.rs 2017-02-04 10:37:09 +08:00
Vadim Chugunov
7504897e6b Don't link "nobundle" libs which had already been included in upstream crate. 2017-02-03 18:25:45 -08:00
Niko Matsakis
2fc15868a2 go back to the older model of coherence collect 2017-02-03 21:13:59 -05:00
est31
3c161393b7 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
2017-02-04 02:42:38 +01:00
bors
c781fc4a6a Auto merge of #36320 - GuillaumeGomez:rustdoc_test_info, r=alexcrichton
Add information in case of markdown block code test failure

r? @steveklabnik

cc @jonathandturner
2017-02-04 01:32:21 +00:00
Brian Anderson
d650cf5c38 Update relnotes for 1.15.1
I already checked this into stable, but it needs to be on master/beta too.
2017-02-04 01:12:39 +00:00
Tobias Bucher
efeb42be28 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.
2017-02-04 01:10:12 +01:00
Son
34f444de5d Extract libcore benchmarks to a separate folder 2017-02-04 10:04:22 +11:00
bors
0648517faf 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.
2017-02-03 22:55:28 +00:00
Vadim Petrochenkov
d14b268b9d libbacktrace: Fix uninitialized variable 2017-02-04 01:18:10 +03:00
Guillaume Gomez
2a8ee8c804 Add missing urls in HashMap 2017-02-03 22:38:44 +01:00
Alex Crichton
626e754473 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.
2017-02-03 13:25:46 -08:00
bors
86d9ed6c82 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%
```
2017-02-03 20:09:36 +00:00