Commit Graph

44586 Commits

Author SHA1 Message Date
Felix S. Klock II
91493df752 Work around unary negation to-be-feature-gated warning by
replacing references to `-1` as a `ast::NodeId` with `ast::DUMMY_NODE_ID`,
which seems like a better notation to use (it is currently also `-1`.

(AFAICT the code is not *relying* on the value `-1` anywhere, it
really just needed a dummy value for when the input is `None`.)
2015-07-21 18:12:06 +02:00
bors
2afe47d168 Auto merge of #27160 - brson:revdoc, r=huonw
This reverts commit 00130cff99.

As mentioned in a regression report[1], this caused a notable amount
of breakage. Because there's a plan to mitigate[2] this type of
breakage, I'm reverting this until then.

[1]: https://internals.rust-lang.org/t/new-crater-reports-1-1-stable-vs-beta-2015-07-10-and-nightly-2015-07-10/2358
[2]: https://github.com/rust-lang/rfcs/pull/1193
2015-07-21 11:32:54 +00:00
bors
e33b128e01 Auto merge of #26816 - nrc:zero-codemap, r=@jroesch
See commits for details
2015-07-21 09:59:18 +00:00
Nick Cameron
f47d20aecd Use a span from the correct file for the inner span of a module
This basically only affects modules which are empty (or only contain comments).

Closes #26755
2015-07-21 21:55:19 +12:00
Nick Cameron
bf34187a2f Test 2015-07-21 21:55:19 +12:00
Nick Cameron
0e907fa542 Provide a filemap ctor with line info 2015-07-21 21:55:19 +12:00
Nick Cameron
007246c17f Allow for space between each filemap in the codemap
So if a filemap's last byte is at position n in the codemap, then n+1 will not refer to any filemap, and the next filemap will begin an n+2.

This is useful for empty files, it means that every file (even empty ones) has a byte in the codemap.

Closes #23301, #26504
2015-07-21 21:55:19 +12:00
bors
247a0d1854 Auto merge of #27153 - alexcrichton:flaky-tests, r=brson
This commit ensures that the rustc thread does not leak a panic message whenever
a call to `fatal` happens. This already happens for the main rustc thread as
part of the `rustc_driver::monitor` function, but the compiler also spawns
threads for other operations like `-C codegen-units`, and sometimes errors are
emitted on these threads as well. To ensure that there's a consistent
error-handling experience across threads this unifies these two to never print
the panic message in the case of a normal and expected fatal error.

This should also fix the flaky `asm-src-loc-codegen-units.rs` test as the output
is sometimes garbled if diagnostics are printed while the panic message is also
being printed.
2015-07-21 08:26:19 +00:00
bors
691ce23479 Auto merge of #27150 - retep998:where-are-my-files, r=alexcrichton
cc #24570

r? @alexcrichton
2015-07-21 06:27:15 +00:00
bors
f9f0e44b33 Auto merge of #27144 - semarie:openbsd-archive_format, r=alexcrichton
the "bsd" archive_format don't work under openbsd.
use of "" (system ar) is ok.
use of "gnu" is ok too.

r? @alexcrichton
2015-07-21 04:53:50 +00:00
bors
48a1f1b96f Auto merge of #27139 - pnkfelix:allow-disable-debuginfo, r=dotdash
fix `configure`: allow both `--enable-debug` and `--disable-debuginfo` in one invocation.

This is my very local fix to allow one to be able to (1.) build `rustc` and (2.) run `make check` with internal debug-mode *assertions* turned on in the presence of bugs like  #26447 and #26484 (both of which are solely caused by debuginfo and thus can be sidestepped via `--disable-debuginfo`).

This partially addresses #24416 (namely, it addresses the papercut outlined in the description of that ticket).  But there are other issues mentioned in the comment thread that are not addressed here, so they should be separately addressed before closing that ticket, or separate bugs should be opened for them.
2015-07-21 03:19:43 +00:00
bors
238765e1eb Auto merge of #27103 - wthrowe:doc_format, r=alexcrichton
This fixes a couple of bugs visible on https://doc.rust-lang.org/nightly/std/marker/trait.Sync.html .  For example:
* `impl<T> Sync for *const T` should read `impl<T> !Sync for *const T`
* `impl<T> !Sync for Weak<T>` should read `impl<T> !Sync for Weak<T> where T: ?Sized`

This does change a struct in librustdoc and it seems that almost everything there is marked public, so if librustdoc has stability guarantees that could be a problem.  If it is, I'll find a way to rework the change to avoid modifying public structures.
2015-07-21 01:41:22 +00:00
William Throwe
a3e78f4151 Add test of cross-crate impl formatting 2015-07-20 20:09:36 -04:00
bors
118a5c4c34 Auto merge of #27129 - arthurprs:debug_atomic, r=alexcrichton
I'm being constantly bitten by the lack of this implementation.

I'm unsure if there's a reason to avoid these implementations though.

Since we have a "lossy" implementation for both Mutex and RWLock (RWLock {{ locked }}) I don't think there's a big reason for not having a Debug implementation for the atomic types, even if the user can't specify the ordering.
2015-07-21 00:03:37 +00:00
bors
ed49bad0cc Auto merge of #27056 - Eljay:doc-comments, r=nikomatsakis
Fixes #23812 by stripping the decoration when desugaring macro doc comments into #[doc] attributes, and detects whether the attribute should be inner or outer style and outputs the appropriate token tree.
2015-07-20 21:21:24 +00:00
bors
2fe870a5a7 Auto merge of #26831 - arielb1:lifetime-fixes, r=nikomatsakis
r? @nikomatsakis
2015-07-20 19:46:46 +00:00
bors
47265bbf37 Auto merge of #27064 - alexcrichton:into-raw-os, r=brson
This commit is an implementation of [RFC 1174][rfc] which adds three new traits
to the standard library:

* `IntoRawFd` - implemented on Unix for all I/O types (files, sockets, etc)
* `IntoRawHandle` - implemented on Windows for files, processes, etc
* `IntoRawSocket` - implemented on Windows for networking types

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1174-into-raw-fd-socket-handle-traits.md

Closes #27062
2015-07-20 18:12:40 +00:00
Brian Anderson
9191a78955 Revert "Fix missing_docs lint for const and static."
This reverts commit 00130cff99.

As mentioned in a regression report[1], this caused a notable amount
of breakage.  Because there's a plan to mitigate[2] this type of
breakage, I'm reverting this until then.

[1]: https://internals.rust-lang.org/t/new-crater-reports-1-1-stable-vs-beta-2015-07-10-and-nightly-2015-07-10/2358
[2]: https://github.com/rust-lang/rfcs/pull/1193
2015-07-20 10:44:46 -07:00
Peter Atashian
1e79917bda Improve Debug impl for File on Windows
Adds a path field if a path could be obtained

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-20 13:24:34 -04:00
arthurprs
225ad17520 impl Debug for Atomic types 2015-07-20 14:11:38 -03:00
bors
18557500cb Auto merge of #27026 - nagisa:overflowing-unsigned, r=pnkfelix
This commit fixes the negate_unsigned feature gate to appropriately
account for inferred variables.

This is technically a [breaking-change], but I’d consider it a bug fix.

cc @brson for your relnotes.

Fixes https://github.com/rust-lang/rust/issues/24676
Fixes #26840 
Fixes https://github.com/rust-lang/rust/issues/25206
2015-07-20 16:38:33 +00:00
Alex Crichton
013d47b19b syntax: Suppress panic message on fatal
This commit ensures that the rustc thread does not leak a panic message whenever
a call to `fatal` happens. This already happens for the main rustc thread as
part of the `rustc_driver::monitor` function, but the compiler also spawns
threads for other operations like `-C codegen-units`, and sometimes errors are
emitted on these threads as well. To ensure that there's a consistent
error-handling experience across threads this unifies these two to never print
the panic message in the case of a normal and expected fatal error.

This should also fix the flaky `asm-src-loc-codegen-units.rs` test as the output
is sometimes garbled if diagnostics are printed while the panic message is also
being printed.
2015-07-20 09:23:31 -07:00
Alex Crichton
7e9e3896df std: Add IntoRaw{Fd,Handle,Socket} traits
This commit is an implementation of [RFC 1174][rfc] which adds three new traits
to the standard library:

* `IntoRawFd` - implemented on Unix for all I/O types (files, sockets, etc)
* `IntoRawHandle` - implemented on Windows for files, processes, etc
* `IntoRawSocket` - implemented on Windows for networking types

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1174-into-raw-fd-socket-handle-traits.md

Closes #27062
2015-07-20 09:08:50 -07:00
bors
39d4faf989 Auto merge of #27025 - dotdash:issue-26484, r=pnkfelix
See the commits for details

r? @arielb1
2015-07-20 15:04:15 +00:00
Björn Steinbrink
3d65c7ff84 Create proper debuginfo for closure variables
Variables for closures hold a tuple of captured variables, and not the
function itself.

Fixes #26484
2015-07-20 15:45:11 +02:00
bors
4e51763e64 Auto merge of #26887 - andreastt:blur_help_dialogue, r=steveklabnik
Blurs the document's background when the help dialogue is present,
making the contents of the dialogue stand out more.
2015-07-20 13:30:15 +00:00
Andreas Tolfsen
6b64826469 librustdoc: blur page when help dialogue is present
Blurs the document's background when the help dialogue is present,
making the contents of the dialogue stand out more.
2015-07-20 11:36:47 +01:00
bors
32a12c8dd0 Auto merge of #27118 - apasel422:issue-20825, r=alexcrichton
closes #20825
2015-07-20 10:20:58 +00:00
Simonas Kazlauskas
0ca8e4994e Convert negate_unsigned feature gate to a warning 2015-07-20 12:24:16 +03:00
Felix S. Klock II
ac33f1572b fix configure: allow both --enable-debug and --disable-debuginfo
in one invocation.
2015-07-20 10:07:53 +02:00
bors
6c88aeda58 Auto merge of #27044 - nrc:graphviz-style, r=@pnkfelix
r? @pnkfelix
2015-07-20 07:07:25 +00:00
Sébastien Marie
761e11e1c4 fixes #27124 for openbsd
the "bsd" archive_format don't work under openbsd.
use of "" (system ar) is ok.
use of "gnu" is ok too.
2015-07-20 08:52:11 +02:00
bors
5e3b756f28 Auto merge of #27038 - ktossell:narrow_doc_ip_ranges, r=alexcrichton
Ipv4Addr::is_documentation() matches 513 /24 blocks when it should only match 3.
2015-07-20 04:52:12 +00:00
Nick Cameron
75f8f966f0 graphviz: support style attributes 2015-07-20 15:45:25 +12:00
bors
c70417bd1b Auto merge of #27132 - apasel422:issue-23491, r=arielb1
closes #23491
2015-07-20 03:19:12 +00:00
William Throwe
bbeace6119 Add test of impl formatting 2015-07-19 22:16:35 -04:00
bors
ef04b07239 Auto merge of #27120 - apasel422:associated-item-error, r=arielb1
Previously, these would both be labeled as methods.
2015-07-20 01:46:20 +00:00
bors
be23d44a53 Auto merge of #27065 - marcusklaas:loop-label, r=nrc
This closes https://github.com/rust-lang/rust/issues/27042.

I'd love to know if there's a way to make a regression test for this!
2015-07-20 00:13:22 +00:00
bors
5d304134ff Auto merge of #27133 - apasel422:issue-15919, r=rollup
closes #15919
2015-07-19 21:36:39 +00:00
Ariel Ben-Yehuda
28ce509d3c clean-up find_bound_for_assoc_item 2015-07-20 00:16:37 +03:00
Ariel Ben-Yehuda
8edcff59d9 return erased regions from fulfill_obligation
Fixes #26802.
2015-07-20 00:16:37 +03:00
Ariel Ben-Yehuda
34309cdf12 implement 'a:'static region bounds
Fixes #22863.
2015-07-20 00:16:35 +03:00
Andrew Paseltiner
60734a65de add test for #15919
closes #15919
2015-07-19 17:06:13 -04:00
Andrew Paseltiner
05e2f8665d add test for #23491
closes #23491
2015-07-19 15:46:57 -04:00
Andrew Paseltiner
ce856a55f6 add separate errors for out-of-place associated consts and types
Previously, these would both be labeled as methods.
2015-07-19 15:32:24 -04:00
bors
a41178e858 Auto merge of #27110 - arthurprs:optintstr, r=Gankro
I wrote a reasonably optimized version for both functions. Further optimizations are possible but I tried to keep the code size small (which I think is important), it's a road of diminished gains.

The repository used for testing/benchmarks is https://github.com/arthurprs/rust-optimized-inttostr

Benchmarks are ran for 3 different distributions, bellow are string length histograms for the u32 type

* _h (big numbers skew)
[0, 0, 5, 29, 103, 212, 551, 1138, 1887, 3196, 2879]
* _m (slight small number skew):
[0, 2807, 1334, 1057, 905, 821, 772, 707, 627, 605, 365]
* _l (small numbers skew):
[0, 8004, 567, 351, 248, 212, 170, 126, 136, 112, 74]

Tested processors are
* x64 laptop (i7-2670QM)
* x32 server (Digital Ocean E5-2630L-v2)

### Display

It uses a small look up table (200 bytes) and decode up to 4 characters at a time. I also took special precautions to reduce 64bit arithmetic on 32bit architectures and the gains are huge in these cases.

Overall, on modern 64bit CPUs it's pretty much the same speed as the stdlib implementation for very small numbers (0..99), but pulls ahead as the length of the decimal increases. On slight older CPUs (w/ worse ALUs) or 32bit architectures it's pretty much always faster.

x64 benchmarks
```
test bench::display_h_new_u08     ... bench:      71,041 ns/iter (+/- 2,894)
test bench::display_h_new_u16     ... bench:     378,255 ns/iter (+/- 36,547)
test bench::display_h_new_u32     ... bench:   4,232,483 ns/iter (+/- 509,661)
test bench::display_h_new_u64     ... bench:   5,166,740 ns/iter (+/- 421,124)
test bench::display_h_stdlib_u08  ... bench:      73,536 ns/iter (+/- 5,287)
test bench::display_h_stdlib_u16  ... bench:     451,443 ns/iter (+/- 16,879)
test bench::display_h_stdlib_u32  ... bench:   5,551,070 ns/iter (+/- 518,151)
test bench::display_h_stdlib_u64  ... bench:   8,624,374 ns/iter (+/- 643,701)
test bench::display_l_new_u08     ... bench:      71,547 ns/iter (+/- 504)
test bench::display_l_new_u16     ... bench:     399,727 ns/iter (+/- 28,030)
test bench::display_l_new_u32     ... bench:   4,365,303 ns/iter (+/- 414,414)
test bench::display_l_new_u64     ... bench:   5,302,382 ns/iter (+/- 292,324)
test bench::display_l_stdlib_u08  ... bench:      75,445 ns/iter (+/- 2,487)
test bench::display_l_stdlib_u16  ... bench:     444,313 ns/iter (+/- 16,203)
test bench::display_l_stdlib_u32  ... bench:   5,761,801 ns/iter (+/- 387,186)
test bench::display_l_stdlib_u64  ... bench:   8,790,365 ns/iter (+/- 614,846)
test bench::display_m_new_u08     ... bench:      71,820 ns/iter (+/- 2,956)
test bench::display_m_new_u16     ... bench:     399,649 ns/iter (+/- 20,643)
test bench::display_m_new_u32     ... bench:   4,355,561 ns/iter (+/- 179,189)
test bench::display_m_new_u64     ... bench:   5,070,594 ns/iter (+/- 341,950)
test bench::display_m_stdlib_u08  ... bench:      74,900 ns/iter (+/- 1,909)
test bench::display_m_stdlib_u16  ... bench:     448,788 ns/iter (+/- 20,791)
test bench::display_m_stdlib_u32  ... bench:   5,717,939 ns/iter (+/- 316,824)
test bench::display_m_stdlib_u64  ... bench:   8,787,160 ns/iter (+/- 482,864)
```

x86 benchmarks
```
test bench::display_h_new_u08     ... bench:      94,246 ns/iter (+/- 34,872)
test bench::display_h_new_u16     ... bench:     533,805 ns/iter (+/- 22,499)
test bench::display_h_new_u32     ... bench:   6,127,747 ns/iter (+/- 2,192,789)
test bench::display_h_new_u64     ... bench:  14,994,203 ns/iter (+/- 1,609,345)
test bench::display_h_stdlib_u08  ... bench:     107,233 ns/iter (+/- 8,571)
test bench::display_h_stdlib_u16  ... bench:     631,186 ns/iter (+/- 11,332)
test bench::display_h_stdlib_u32  ... bench:   7,696,344 ns/iter (+/- 957,917)
test bench::display_h_stdlib_u64  ... bench:  45,677,401 ns/iter (+/- 4,991,344)
test bench::display_l_new_u08     ... bench:      95,855 ns/iter (+/- 27,735)
test bench::display_l_new_u16     ... bench:     532,084 ns/iter (+/- 40,479)
test bench::display_l_new_u32     ... bench:   5,973,953 ns/iter (+/- 211,676)
test bench::display_l_new_u64     ... bench:  14,773,064 ns/iter (+/- 1,276,579)
test bench::display_l_stdlib_u08  ... bench:     106,350 ns/iter (+/- 63,963)
test bench::display_l_stdlib_u16  ... bench:     637,746 ns/iter (+/- 101,005)
test bench::display_l_stdlib_u32  ... bench:   7,740,640 ns/iter (+/- 848,478)
test bench::display_l_stdlib_u64  ... bench:  44,846,932 ns/iter (+/- 4,514,694)
test bench::display_m_new_u08     ... bench:      94,549 ns/iter (+/- 13,029)
test bench::display_m_new_u16     ... bench:     546,030 ns/iter (+/- 35,804)
test bench::display_m_new_u32     ... bench:   5,983,924 ns/iter (+/- 1,180,559)
test bench::display_m_new_u64     ... bench:  14,817,873 ns/iter (+/- 2,271,464)
test bench::display_m_stdlib_u08  ... bench:     107,806 ns/iter (+/- 8,805)
test bench::display_m_stdlib_u16  ... bench:     630,714 ns/iter (+/- 6,586)
test bench::display_m_stdlib_u32  ... bench:   7,784,210 ns/iter (+/- 358,601)
test bench::display_m_stdlib_u64  ... bench:  46,223,927 ns/iter (+/- 6,553,176)
```

### from_str_radix (FromStr)

All valid digits are ascii so I modified the function to use the underlining bytes instead and simplified the match to avoid wasting cycles.

x64 benchmarks
```
test bench::from_str_h_new_u08    ... bench:      28,153 ns/iter (+/- 624)
test bench::from_str_h_new_u16    ... bench:     223,513 ns/iter (+/- 11,554)
test bench::from_str_h_new_u32    ... bench:   3,098,935 ns/iter (+/- 231,022)
test bench::from_str_h_new_u64    ... bench:   5,009,900 ns/iter (+/- 341,961)
test bench::from_str_h_stdlib_u08 ... bench:      34,033 ns/iter (+/- 2,068)
test bench::from_str_h_stdlib_u16 ... bench:     248,785 ns/iter (+/- 14,208)
test bench::from_str_h_stdlib_u32 ... bench:   4,150,536 ns/iter (+/- 266,070)
test bench::from_str_h_stdlib_u64 ... bench:   6,817,997 ns/iter (+/- 449,838)
test bench::from_str_l_new_u08    ... bench:      27,552 ns/iter (+/- 1,500)
test bench::from_str_l_new_u16    ... bench:     234,360 ns/iter (+/- 13,144)
test bench::from_str_l_new_u32    ... bench:   3,140,261 ns/iter (+/- 248,175)
test bench::from_str_l_new_u64    ... bench:   5,176,583 ns/iter (+/- 350,416)
test bench::from_str_l_stdlib_u08 ... bench:      35,060 ns/iter (+/- 2,154)
test bench::from_str_l_stdlib_u16 ... bench:     252,135 ns/iter (+/- 23,461)
test bench::from_str_l_stdlib_u32 ... bench:   4,154,599 ns/iter (+/- 369,606)
test bench::from_str_l_stdlib_u64 ... bench:   6,892,767 ns/iter (+/- 213,030)
test bench::from_str_m_new_u08    ... bench:      28,252 ns/iter (+/- 1,384)
test bench::from_str_m_new_u16    ... bench:     231,051 ns/iter (+/- 16,540)
test bench::from_str_m_new_u32    ... bench:   3,166,504 ns/iter (+/- 134,418)
test bench::from_str_m_new_u64    ... bench:   5,103,195 ns/iter (+/- 218,912)
test bench::from_str_m_stdlib_u08 ... bench:      35,012 ns/iter (+/- 2,735)
test bench::from_str_m_stdlib_u16 ... bench:     250,967 ns/iter (+/- 14,708)
test bench::from_str_m_stdlib_u32 ... bench:   4,101,845 ns/iter (+/- 205,802)
test bench::from_str_m_stdlib_u64 ... bench:   6,823,001 ns/iter (+/- 267,215)
```

x86 benchmarks
```
test bench::from_str_h_new_u08    ... bench:      23,682 ns/iter (+/- 3,590)
test bench::from_str_h_new_u16    ... bench:     190,916 ns/iter (+/- 29,688)
test bench::from_str_h_new_u32    ... bench:   2,649,952 ns/iter (+/- 308,576)
test bench::from_str_h_new_u64    ... bench:  23,458,434 ns/iter (+/- 2,327,427)
test bench::from_str_h_stdlib_u08 ... bench:      45,551 ns/iter (+/- 6,968)
test bench::from_str_h_stdlib_u16 ... bench:     313,739 ns/iter (+/- 17,175)
test bench::from_str_h_stdlib_u32 ... bench:   4,615,669 ns/iter (+/- 470,766)
test bench::from_str_h_stdlib_u64 ... bench:  30,589,482 ns/iter (+/- 2,278,996)
test bench::from_str_l_new_u08    ... bench:      23,763 ns/iter (+/- 5,545)
test bench::from_str_l_new_u16    ... bench:     185,472 ns/iter (+/- 33,097)
test bench::from_str_l_new_u32    ... bench:   2,691,307 ns/iter (+/- 473,886)
test bench::from_str_l_new_u64    ... bench:  22,952,593 ns/iter (+/- 1,963,742)
test bench::from_str_l_stdlib_u08 ... bench:      45,285 ns/iter (+/- 16,337)
test bench::from_str_l_stdlib_u16 ... bench:     313,624 ns/iter (+/- 6,643)
test bench::from_str_l_stdlib_u32 ... bench:   4,595,679 ns/iter (+/- 1,876,361)
test bench::from_str_l_stdlib_u64 ... bench:  30,434,683 ns/iter (+/- 1,901,996)
test bench::from_str_m_new_u08    ... bench:      23,812 ns/iter (+/- 1,505)
test bench::from_str_m_new_u16    ... bench:     185,553 ns/iter (+/- 19,788)
test bench::from_str_m_new_u32    ... bench:   2,614,920 ns/iter (+/- 66,230)
test bench::from_str_m_new_u64    ... bench:  23,241,778 ns/iter (+/- 3,474,077)
test bench::from_str_m_stdlib_u08 ... bench:      45,634 ns/iter (+/- 1,436)
test bench::from_str_m_stdlib_u16 ... bench:     316,479 ns/iter (+/- 21,212)
test bench::from_str_m_stdlib_u32 ... bench:   4,609,147 ns/iter (+/- 487,068)
test bench::from_str_m_stdlib_u64 ... bench:  30,165,173 ns/iter (+/- 1,601,830)
```
2015-07-19 19:04:15 +00:00
bors
58fb9b5c2d Auto merge of #27100 - tshepang:better-names, r=Gankro 2015-07-19 16:33:43 +00:00
bors
cb87ea80a6 Auto merge of #27111 - AlisdairO:diagnostics253, r=Manishearth
As per topic :-).

Part of #24407.
r? @Manishearth
2015-07-19 14:06:22 +00:00
arthurprs
c073f81920 optimize from_str_radix 2015-07-19 09:54:44 -03:00
bors
3b8acb7386 Auto merge of #27101 - steveklabnik:doc_no_mutability_root, r=Gankro
And some other outdated language. @echochamber came asking about these docs
on IRC today, and they're a bit weird. I've updated them to be less ambiguous
and use contemporary terminology.
2015-07-19 12:31:35 +00:00