Commit Graph

44894 Commits

Author SHA1 Message Date
Brian Anderson
8497c428e5 std: Create separate docs for the primitives
Having the primitive and module docs derived from the same source
causes problems, primarily that they can't contain hyperlinks
cross-referencing each other.

This crates dedicated private modules in `std` to document the
primitive types, then for all primitives that have a corresponding
module, puts hyperlinks in moth the primitive docs and the module docs
cross-linking each other.

This should help clear up confusion when readers find themselves on
the wrong page.
2015-07-20 13:18:06 -07:00
Brian Anderson
44dd247cd5 doc: Clean up primitive short descriptions
This makes the primitive descriptions on the front page read properly
as descriptions of types and not of the associated modules.
2015-07-20 13:17:41 -07:00
bors
2fe870a5a7 Auto merge of #26831 - arielb1:lifetime-fixes, r=nikomatsakis
r? @nikomatsakis
2015-07-20 19:46:46 +00:00
Steve Klabnik
7e7ec6b5cd Document structures in std::io::utils
These provide various special readers, so point their docs to their
constructor functions in a manner consistent with everything else.
2015-07-20 15:45:48 -04: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
Alisdair Owens
686d326439 Add diagnostics for E0172, fix inline error message for E0139 2015-07-20 18:49:05 +01: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
Steve Klabnik
27fc0f21c4 Document iterators in std::io
Make them all consistent and link up the documentation.
2015-07-20 13:16:57 -04:00
Alisdair Owens
3ae7b72970 Fix wording nit for E0253 2015-07-20 18:14:12 +01:00
arthurprs
225ad17520 impl Debug for Atomic types 2015-07-20 14:11:38 -03:00
Andrew Paseltiner
a7e5c6302b add test for #10436
closes #10436
2015-07-20 12:59:33 -04:00
Alex Crichton
7cb157e74d Register new snapshots
These new snapshots contain the knowledge of how to build the new triples of
32-bit MSVC and 32-bit FreeBSD, both of which should soon start having
nightlies/auto builders!

This does not currently register bitrig/freebsd snapshots but I believe those
will be retroactively added in the near future.
2015-07-20 09:51:29 -07: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
Paolo Falabella
31a62d3b4b s/has gained/has not gained/g
I'm pretty sure this was a typo
2015-07-20 17:29:34 +02: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
Andrew Paseltiner
4c73dbddcf add test for #19404
closes #19404
2015-07-20 08:39:51 -04:00
Andrew Paseltiner
9bb6545124 add test for #14229
closes #14229
2015-07-20 08:31:54 -04: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
Björn Steinbrink
871ccfb5a9 Add a test for #26468
The fix for #26468 was made upstream and landed with the LLVM update in #27076.

Closes #26468
2015-07-20 10:33:44 +02: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
b684826cab add test for #20162
closes #20162
2015-07-19 15:39:26 -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
bors
266428845d Auto merge of #27099 - AlisdairO:diagnostics3, r=Manishearth
Per the title.  I've linked to the reference at http://doc.rust-lang.org/reference.html#type-parameters-1, but I'm not sure that's such a good link - but there doesn't seem to be a great deal of explanation elsewhere in the reference either...
2015-07-19 09:01:20 +00:00
Alisdair Owens
4ea02b72b7 replace word function with method 2015-07-19 09:59:43 +01:00