Commit Graph

44553 Commits

Author SHA1 Message Date
Alisdair Owens
3ae7b72970 Fix wording nit for E0253 2015-07-20 18:14:12 +01: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
bors
6c88aeda58 Auto merge of #27044 - nrc:graphviz-style, r=@pnkfelix
r? @pnkfelix
2015-07-20 07:07:25 +00: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
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
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
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
bors
6b10efcc8b Auto merge of #27121 - apasel422:issue-21332, r=Gankro
closes #21332
2015-07-19 07:26:24 +00:00
Tshepang Lekhonkhobe
ef2f4cd40a doc: use 'index' and 'value' in place of 'i' and 't' 2015-07-19 08:33:03 +02:00
bors
86fa65bcc5 Auto merge of #27122 - nham:tweak-cow-docs, r=Gankro
It seems slightly more consistent to say 'Clones' here instead of 'Copies'. The docs for the `ToOwned` trait talk about cloning and not copying.
2015-07-19 04:56:33 +00:00
Nick Hamann
f257a1501f 'Copies' => 'Clones' in Cow method docs.
It seems slightly more consistent to say 'Clones' here instead of 'Copies'.
The docs for the `ToOwned` trait talk about cloning and not copying.
2015-07-18 22:54:55 -05:00
Andrew Paseltiner
7d984ef6df split "has incompatible type for trait" errors into multiple lines
closes #21332
2015-07-18 21:14:36 -04:00
Ken Tossell
d45c22b29f Fix documentation IP ranges: e.g., 192.0.2.* instead of 192.*.2.*.
Add Ipv4Addr tests to verify doc address checking.
2015-07-19 00:28:59 +00:00
arthurprs
ebf9e1aaf6 optimize integer formatting 2015-07-18 20:06:40 -03:00
bors
9d460c5517 Auto merge of #27117 - apasel422:issue-14821, r=Gankro
closes #14821
2015-07-18 22:41:29 +00:00
Andrew Paseltiner
adf753e529 add tests for #20825
closes #20825
2015-07-18 18:03:30 -04:00
Andrew Paseltiner
5f280db9fa add test for #14821
closes #14821
2015-07-18 17:40:15 -04:00
Alisdair Owens
44f29fbdbc oops, forgot to fix method name 2015-07-18 20:46:47 +01:00
Alisdair Owens
91f0301aa5 Fix to 80 char width, change to single space after period 2015-07-18 20:34:12 +01:00
Alisdair Owens
56b450b291 fix up crate/trait discrepancy, clarify language 2015-07-18 20:26:08 +01:00
Alisdair Owens
f78333e052 Add details on PhantomData 2015-07-18 18:42:00 +01:00
Alisdair Owens
6c74779a5c Add diagnostics for E0253 2015-07-18 17:25:29 +01:00
Björn Steinbrink
9175a16bd8 Generate proper debug info for function pointers
Instead of generating pointer debug info, we're currently generating
subroutine debug info.
2015-07-18 17:31:48 +02:00
bors
a27fed7cbd Auto merge of #27096 - apasel422:issue-26217, r=nikomatsakis
closes #26217

r? @nikomatsakis
2015-07-18 11:02:58 +00:00
Björn Steinbrink
47128b8c7e Create correct debuginfo for closure function signatures
Internally, the arguments passed to the closure are represented by a
tuple, but the actual function takes them as individual arguments, so we
have to untuple the arguments before creating the debuginfo.
2015-07-18 12:44:13 +02:00
Björn Steinbrink
1373c4fcf2 Properly create debug info for functions
We're currently using the actual function type as the return type when
creating the debug info for a function, so we're actually creating
debug info for a function that takes the same parameters, and returns
the actual function type, which is completely wrong.
2015-07-18 12:43:37 +02:00
Marcus Klaas
12963606d0 Include label in the span of loops 2015-07-18 11:53:55 +02:00
bors
e0e1859819 Auto merge of #27088 - tamird:fix-ios-build, r=alexcrichton
Fixes #26939.
2015-07-18 08:25:10 +00:00
bors
3f50dca386 Auto merge of #27085 - Ryman:gh17546, r=alexcrichton
This also changes how variant values are printed in errors, they are no
longer printed in their parent scope. As far as I can tell, this is
leftover from pre-namespacing of enums.

Closes #17546.
2015-07-18 06:02:50 +00:00
bors
81b6b91e83 Auto merge of #27074 - steveklabnik:gh27014, r=alexcrichton
Fixes #27014 

r? @alexcrichton 

I'm not 100% sure there's not a better way to do this, but it works.

Also, I wasn't sure how, where, or if to write a test for this.
2015-07-18 03:42:01 +00:00
bors
e58601ab08 Auto merge of #26955 - Gankro:raw-vec, r=bluss,alexcrichton
Per the top level comment:

A low-level utility for more ergonomically allocating, reallocating, and deallocating a
a buffer of memory on the heap without having to worry about all the corner cases
involved. This type is excellent for building your own data structures like Vec and VecDeque.
In particular:

* Produces heap::EMPTY on zero-sized types
* Produces heap::EMPTY on zero-length allocations
* Catches all overflows in capacity computations (promotes them to "capacity overflow" panics)
* Guards against 32-bit systems allocating more than isize::MAX bytes
* Guards against overflowing your length
* Aborts on OOM
* Avoids freeing heap::EMPTY
* Contains a ptr::Unique and thus endows the user with all related benefits

This type does not in anyway inspect the memory that it manages. When dropped it *will*
free its memory, but it *won't* try to Drop its contents. It is up to the user of RawVec
to handle the actual things *stored* inside of a RawVec.

Note that a RawVec always forces its capacity to be usize::MAX for zero-sized types.
This enables you to use capacity growing logic catch the overflows in your length
that might occur with zero-sized types.

However this means that you need to be careful when roundtripping this type
with a `Box<[T]>`: `cap()` won't yield the len. However `with_capacity`,
`shrink_to_fit`, and `from_box` will actually set RawVec's private capacity
field. This allows zero-sized types to not be special-cased by consumers of
this type.

Edit: 
fixes #18726 and fixes #23842
2015-07-17 23:58:52 +00:00
Steve Klabnik
72dbbeef50 Remove confusing 'mutability root' term
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-17 18:50:42 -04:00
bors
5df259b9da Auto merge of #27098 - Manishearth:rollup, r=Manishearth
- Successful merges: #26777, #27067, #27071, #27081, #27091, #27094, #27095
- Failed merges:
2015-07-17 22:27:37 +00:00
Manish Goregaokar
8638dc7f9a nit 2015-07-18 03:06:35 +05:30