Commit Graph

51008 Commits

Author SHA1 Message Date
Alex Burka
f27a3a304f fix underflow in DoubleEndedIterator::next_back 2016-02-27 02:01:41 -05:00
Alex Burka
1ec3005e45 fix fallout from libsyntax enumpocalypse 2016-02-27 02:01:41 -05:00
Alex Burka
7eb7c56bd4 add indexing with RangeInclusive in libcore and libcollections 2016-02-27 02:01:41 -05:00
Alex Burka
b1b4f50678 add StepBy for RangeInclusive 2016-02-27 02:01:41 -05:00
Alex Burka
24cc90262b note work still to be done
In particular, uses of inclusive ranges within the standard library are
still waiting. Slices and collections can be sliced with `usize` and
`Range*<usize>`, but not yet `Range*Inclusive<usize>`.

Also, we need to figure out what to do about `RangeArgument`. Currently
it has `start()` and `end()` methods which are pretty much identical to
`Range::start` and `Range::end`. For the same reason as Range itself,
these methods can't express a range such as `0...255u8` without
overflow. The easiest choice, it seems to me, is either changing the
meaning of `end()` to be inclusive, or adding a new method, say
`last()`, that is inclusive and specifying that `end()` returns `None`
in cases where it would overflow. Changing the semantics would be a
breaking change, but `RangeArgument` is unstable so maybe we should do
it anyway.
2016-02-27 02:01:41 -05:00
Alex Burka
15a8a296b7 document inclusive range syntax 2016-02-27 02:01:41 -05:00
Alex Burka
e10614a777 adjust range tests
Since the desugaring removed special handling for ranges, the error
message changed and so I had to adjust `range-1`.

Turns out there was a bug where borrowck was too restrictive in some
rare cases of constructing ranges from literals. The `range-2` test
enshrined this bug -- now it's adjusted to test a case that's actually
wrong.
2016-02-27 02:01:41 -05:00
Alex Burka
69719df611 test inclusive ranges
Mostly copy the tests from half-open ranges, adding some more for
DoubleEndedIterator and ExactSizeIterator.

Also thoroughly (I think) test that the feature gates are working.
2016-02-27 02:01:41 -05:00
Alex Burka
37a4cb3212 feature-gate inclusive range syntax 2016-02-27 02:01:41 -05:00
Alex Burka
bd3197c748 remove range lang items
The range desugaring does not use the lang items. Hence I did not add
lang items for inclusive ranges. This cleanup commit removes the old
unused ones as well.

Whether the desugaring _should_ use lang items is another question:
see #30809. But if we decide on a strategy there we can add back these
lang items, and new ones for inclusive ranges.

For stage0 we need to keep the attributes as the lang items still exist
even if they are never used.

This is surprisingly not a breaking change. Unused #[lang] attributes do
not even trigger a lint (see #30881).
2016-02-27 02:01:41 -05:00
Alex Burka
d792183fde fallout from removing hir::ExprRange
A whole bunch of stuff gets folded into struct handling! Plus, removes
an ugly hack from trans and accidentally fixes a bug with constructing
ranges from references (see later commits with tests).
2016-02-27 02:01:41 -05:00
Alex Burka
a331278451 HIR: add inclusive ranges, desugar all ranges (remove ExprRange) 2016-02-27 02:01:41 -05:00
Alex Burka
5daf13cae3 libsyntax: parse inclusive ranges 2016-02-27 02:01:41 -05:00
Alex Burka
c5d58de665 core: add inclusive ranges to core::ops
Since it removes the old iter::{range_inclusive, RangeInclusive} which
were unstable and deprecated, this is a [breaking-change] on nightly.
2016-02-27 02:01:41 -05:00
bors
80dee36438 Auto merge of #31926 - llogiq:more_post, r=eddyb
These `_post` methods are quite helpful to control lint behavior without storing e.g. block node ids. So here are a few more I believe will be helpful.

r? @Manishearth
2016-02-27 06:58:28 +00:00
mitaa
0b3bc9b5e2 Correct plain-summary-line
For plaintext we don't actually need to render the Markdown before
shortening the string. (and this may have led to wrong output)
2016-02-27 06:42:30 +01:00
mitaa
2352c1c539 Clearly separate code blocks from other blocks
For summary descriptions we need the first paragraph (adjacent lines
until a blank line) - but the rendered markdown of a code block did not
leave a blank line in the html and was thus included in the summary line.
2016-02-27 06:42:21 +01:00
Manish Goregaokar
7f59c21dff Rollup merge of #31930 - miqid:doc, r=steveklabnik
Hello.

I've added links for items inside of some stable methods for consistency with existing ones that already have them. Also includes minor formatting fixes.

r? @steveklabnik
2016-02-27 10:52:02 +05:30
Manish Goregaokar
543c6a37c0 Rollup merge of #31929 - dotdash:less_rallocx, r=alexcrichton
When foldings Substs, we map over VecPerParamSpace instances using
EnumeratedItems which does not provide an accurate size_hint()
in its Iterator implementation. This leads to quite a large number or
reallocations. Providing a suitable size_hint() implementation reduces
the time spent in item-bodies checking quite a bit.

```
crate  | before | after | ~change
-------|-------------------------
core   |  7.28s | 5.44s |   -25%
std    |  2.07s | 1.88s |  -9.2%
syntax |  8.86s | 8.30s |  -6.3%
```
2016-02-27 10:52:02 +05:30
Manish Goregaokar
2d1843ad9d Rollup merge of #31926 - llogiq:more_post, r=eddyb
These `_post` methods are quite helpful to control lint behavior without storing e.g. block node ids. So here are a few more I believe will be helpful.

r? @Manishearth
2016-02-27 10:52:01 +05:30
Manish Goregaokar
b42b80a70b Rollup merge of #31922 - Amanieu:relnotes17, r=brson 2016-02-27 10:52:01 +05:30
Manish Goregaokar
9c01031c72 Rollup merge of #31918 - GuillaumeGomez:patch-3, r=steveklabnik
r? @steveklabnik

Fixes #29334
2016-02-27 10:52:01 +05:30
Manish Goregaokar
35b30424df Rollup merge of #31909 - benaryorg:patch-2, r=Manishearth
`continue` expression's description mentioned `break` instead of `continue`
2016-02-27 10:52:00 +05:30
Luke Jones
edd5f3328b Refinement of paragraph referenced by [this
issue](https://github.com/rust-lang/rust/issues/31927)
2016-02-27 14:41:38 +13:00
bors
f1e191c0b9 Auto merge of #31914 - bluss:copy-from-slice-everywhere, r=alexcrichton
Use .copy_from_slice() where applicable

.copy_from_slice() does the same job of .clone_from_slice(), but the
former is explicitly for Copy elements and calls `memcpy` directly, and
thus is it efficient without optimization too.
2016-02-27 01:15:23 +00:00
Michael Huynh
d41d3a5b98 Improve formatting of the primitive str documentation
Adds extra documentation links for library types and methods to be
consistent with similar items already linked. Also includes minor
formatting fixes.
2016-02-27 08:25:31 +08:00
Björn Steinbrink
31fef237b6 Avoid excessive reallocations during item-bodies checking
When foldings Substs, we map over VecPerParamSpace instances using
EnumeratedItems which does not provide an accurate size_hint()
in its Iterator implementation. This leads to quite a large number or
reallocations. Providing a suitable size_hint() implementation reduces
the time spent in item-bodies checking quite a bit.

```
crate  | before | after | ~change
-------|-------------------------
core   |  7.28s | 5.44s |   -25%
std    |  2.07s | 1.88s |  -9.2%
syntax |  8.86s | 8.30s |  -6.3%
```
2016-02-27 00:59:43 +01:00
llogiq
d315dc6542 more check_*_post methods for LintPasses 2016-02-27 00:21:20 +01:00
bors
98a8a71236 Auto merge of #31876 - ollie27:win_fill_bytes, r=brson
CryptGenRandom takes a DWORD (u32) for the length so it only supports
writing u32::MAX bytes at a time.

Casting the length from a usize caused truncation meaning the whole
buffer was not always filled.

cc #31841

This is the same as rust-lang-nursery/rand#99. I think it's a good idea to keep the implementations in sync.

r? @alexcrichton
2016-02-26 22:21:59 +00:00
Amanieu d'Antras
77c1e11249 Fix typo in release notes 2016-02-26 21:24:19 +00:00
bors
64b4b6d6c6 Auto merge of #31903 - mitaa:rdoc-ghostly-impls, r=alexcrichton
fixes #29584

r? @alexcrichton
2016-02-26 19:25:16 +00:00
Vadim Petrochenkov
fa427266ee Some drive-by improvements to SanePrivacyVisitor
Check that variant fields are not marked public by syntax extensions
2016-02-26 22:06:39 +03:00
Vadim Petrochenkov
df4821698e Permit pub items in blocks 2016-02-26 21:20:56 +03:00
bors
1aa6ac38b2 Auto merge of #31858 - alexcrichton:fix-networking-cast, r=brson
Similar to #31825 where the read/write limits were capped for files, this
implements similar limits when reading/writing networking types. On Unix this
shouldn't affect anything because the write size is already a `usize`, but on
Windows this will cap the read/write amounts to `i32::max_value`.

cc #31841
2016-02-26 15:42:44 +00:00
mitaa
eae9f4636c Don't inline impls from doc(hidden) modules 2016-02-26 15:56:46 +01:00
Ulrik Sverdrup
2d6496dd84 Use .copy_from_slice() where applicable
.copy_from_slice() does the same job of .clone_from_slice(), but the
former is explicitly for Copy elements and calls `memcpy` directly, and
thus is it efficient without optimization too.
2016-02-26 14:51:38 +01:00
bors
f59fd46425 Auto merge of #31846 - alexcrichton:better-disable-jemallc, r=brson
The `--disable-jemalloc` configure option has a failure mode where it will
create a distribution that is not compatible with other compilers. For example
the nightly for Linux will assume that it will link to jemalloc by default as
an allocator for executable crates. If, however, a standard library is used
which was built via `./configure --disable-jemalloc` then this will fail
because the jemalloc crate wasn't built.

While this seems somewhat reasonable as a niche situation, the same mechanism is
used for disabling jemalloc for platforms that just don't support it. For
example if the rumprun target is compiled then the sibiling Linux target *also*
doesn't have jemalloc. This is currently a problem for our cross-build nightlies
which build many targets. If rumprun is also built, it will disable jemalloc for
all targets, which isn't desired.

This commit moves the platform-specific disabling of jemalloc as hardcoded logic
into the makefiles that is scoped per-platform. This way when configuring
multiple targets **without the `--disable-jemalloc` option specified** all
targets will get jemalloc as they should.
2016-02-26 13:38:46 +00:00
Simonas Kazlauskas
d1a12392b2 Nits and cleanups 2016-02-26 14:15:38 +02:00
bors
ee8b257d2e Auto merge of #31911 - Manishearth:rollup, r=Manishearth
- Successful merges: #31878, #31880, #31883, #31893, #31894, #31896, #31901, #31904
- Failed merges: #31897
2016-02-26 11:36:35 +00:00
Manish Goregaokar
3c9a26853c fixup #31878 2016-02-26 17:05:46 +05:30
Manish Goregaokar
acea6fc1cb Rollup merge of #31904 - bluss:writer-formatter-error, r=alexcrichton
Make sure formatter errors are emitted by the default Write::write_fmt

Previously, if an error was returned from the formatter that did not
originate in an underlying writer error, Write::write_fmt would return
successfully even if the formatting did not complete (was interrupted by
an `fmt::Error` return).

Now we choose to emit an io::Error with kind Other for formatter errors.

Since this may reveal error returns from `write!()` and similar that
previously passed silently, it's a kind of a [breaking-change].

Fixes #31879
2016-02-26 17:03:42 +05:30
Manish Goregaokar
263e7228ca Rollup merge of #31901 - bluss:suggest-use, r=sanxiyn
suggest: Put the `use` in suggested code inside the quotes

Change import a trait suggestion from:

       help: candidate #1: use `std::io::Write`

to

       help: candidate #1: `use std::io::Write`

so that the code can be copied directly.

Fixes #31864
2016-02-26 17:03:42 +05:30
Manish Goregaokar
f74855ed39 Rollup merge of #31896 - tshepang:idiom, r=steveklabnik 2016-02-26 17:03:41 +05:30
Manish Goregaokar
64af0ff74a Rollup merge of #31894 - tshepang:more-clear, r=steveklabnik 2016-02-26 17:03:41 +05:30
Manish Goregaokar
8d28d47995 Rollup merge of #31893 - tshepang:comma, r=steveklabnik 2016-02-26 17:03:41 +05:30
Manish Goregaokar
903798dce0 Rollup merge of #31883 - birkenfeld:doc-null-escape, r=bluss
It appears in the examples, but is not covered by any of the cases
in the prose description.
2016-02-26 17:03:40 +05:30
Manish Goregaokar
a52c7dc27b Rollup merge of #31880 - Manishearth:debug, r=alexcrichton
Right this information isn't documented anywhere, sticking it into `make tips`
2016-02-26 17:03:40 +05:30
Manish Goregaokar
cefbe505bd Rollup merge of #31878 - frewsxcv:path-cleanup, r=alexcrichton
None
2016-02-26 17:03:39 +05:30
bors
09130044ce Auto merge of #31834 - ubsan:copy_from_slice, r=alexcrichton
implements rust-lang/rfcs#1419

r? alexcrichton
2016-02-26 09:16:03 +00:00
Katze
7a549598bb
documentation fix
`continue` expression's description mentioned `break` instead of `continue`

Signed-off-by: benaryorg <binary@benary.org>
2016-02-26 09:58:01 +01:00