]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #27827 - w00ns:for-loop-expn-issue-27639, r=alexcrichton
bors [Sat, 15 Aug 2015 14:50:13 +0000 (14:50 +0000)]
Auto merge of #27827 - w00ns:for-loop-expn-issue-27639, r=alexcrichton

Fixes #27639

8 years agoIterator::all() - document short-circuiting property parallel to any()
Georg Brandl [Sat, 15 Aug 2015 09:49:33 +0000 (11:49 +0200)]
Iterator::all() - document short-circuiting property parallel to any()

8 years agoAuto merge of #27846 - AlisdairO:diagnostics248, r=Manishearth
bors [Sat, 15 Aug 2015 09:26:48 +0000 (09:26 +0000)]
Auto merge of #27846 - AlisdairO:diagnostics248, r=Manishearth

As title :-)
Part of #24407.

r? @Manishearth

8 years agoImprove 'unknown instrinsic' error message
Dylan McKay [Sat, 15 Aug 2015 09:06:06 +0000 (21:06 +1200)]
Improve 'unknown instrinsic' error message

If you had previously tried to get the ValueRef associated with an
intrinsic that hadn't been described in
`trans::context::declare_intrinsic()`, the compile would panic with
an empty message.

Now we print out details about the error in the panic message.

8 years agoAdd extended diagnostics for E0248
Alisdair Owens [Fri, 14 Aug 2015 20:33:40 +0000 (21:33 +0100)]
Add extended diagnostics for E0248

8 years agoastencode: convert code to use TyDecoder directly
Niko Matsakis [Fri, 14 Aug 2015 09:58:10 +0000 (05:58 -0400)]
astencode: convert code to use TyDecoder directly

8 years agos/PState/TyDecoder/
Niko Matsakis [Fri, 14 Aug 2015 09:37:49 +0000 (05:37 -0400)]
s/PState/TyDecoder/

8 years agotydecode: tighten privacy
Niko Matsakis [Fri, 14 Aug 2015 09:14:54 +0000 (05:14 -0400)]
tydecode: tighten privacy

8 years agoconvert tydecode to use an impl, eliminating a lot of boilerplate
Niko Matsakis [Fri, 14 Aug 2015 09:11:54 +0000 (05:11 -0400)]
convert tydecode to use an impl, eliminating a lot of boilerplate

8 years agoFix issue with for loop expansion
w00ns [Fri, 14 Aug 2015 05:23:29 +0000 (07:23 +0200)]
Fix issue with for loop expansion

8 years agoReduce rustc::trans's dependence on pointer width
Dylan McKay [Sat, 15 Aug 2015 06:43:39 +0000 (18:43 +1200)]
Reduce rustc::trans's dependence on pointer width

8 years agoReduce libcore/liballoc's dependence on pointer sizes
Dylan McKay [Sat, 15 Aug 2015 05:17:17 +0000 (17:17 +1200)]
Reduce libcore/liballoc's dependence on pointer sizes

8 years agoAuto merge of #27841 - jonas-schievink:still-repeating-span, r=alexcrichton
bors [Sat, 15 Aug 2015 06:16:41 +0000 (06:16 +0000)]
Auto merge of #27841 - jonas-schievink:still-repeating-span, r=alexcrichton

Current behaviour demo: http://is.gd/l3FEgo
(The span is printed at the start of the source code)

This patch moves the span to the use of `$i` in the macro rhs (as the code comment already claims)

8 years agoAuto merge of #27825 - withoutboats:default_array, r=alexcrichton
bors [Sat, 15 Aug 2015 04:19:14 +0000 (04:19 +0000)]
Auto merge of #27825 - withoutboats:default_array, r=alexcrichton

Implemented Default for arrays up to length 32 where T: Default using an additional macro.

8 years agoAuto merge of #27839 - gkoz:netbsd_ar, r=brson
bors [Sat, 15 Aug 2015 01:45:15 +0000 (01:45 +0000)]
Auto merge of #27839 - gkoz:netbsd_ar, r=brson

NetBSD didn't get its fix for #27124 and still suffers from that issue.

8 years agoconvert tydecode to use a closure for def-id conversion and
Niko Matsakis [Fri, 14 Aug 2015 08:56:07 +0000 (04:56 -0400)]
convert tydecode to use a closure for def-id conversion and
to store the closure in the PSState struct

8 years agomove InlinedItem into librustc, where it belongs
Niko Matsakis [Thu, 13 Aug 2015 14:57:34 +0000 (10:57 -0400)]
move InlinedItem into librustc, where it belongs

8 years agoAuto merge of #27400 - alexcrichton:less-jemalloc, r=brson
bors [Fri, 14 Aug 2015 22:52:11 +0000 (22:52 +0000)]
Auto merge of #27400 - alexcrichton:less-jemalloc, r=brson

This commit is an implementation of [RFC 1183][rfc] which allows swapping out
the default allocator on nightly Rust. No new stable surface area should be
added as a part of this commit.

[rfc]: https://github.com/rust-lang/rfcs/pull/1183

Two new attributes have been added to the compiler:

* `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to
  indicate that it requires an allocator crate to be in scope.
* `#![allocator]` - this is a indicator that the crate is an allocator which can
  satisfy the `needs_allocator` attribute above.

The ABI of the allocator crate is defined to be a set of symbols that implement
the standard Rust allocation/deallocation functions. The symbols are not
currently checked for exhaustiveness or typechecked. There are also a number of
restrictions on these crates:

* An allocator crate cannot transitively depend on a crate that is flagged as
  needing an allocator (e.g. allocator crates can't depend on liballoc).
* There can only be one explicitly linked allocator in a final image.
* If no allocator is explicitly requested one will be injected on behalf of the
  compiler. Binaries and Rust dylibs will use jemalloc by default where
  available and staticlibs/other dylibs will use the system allocator by
  default.

Two allocators are provided by the distribution by default, `alloc_system` and
`alloc_jemalloc` which operate as advertised.

Closes #27389

8 years agoFix span of invalid metavariable repetition
Jonas Schievink [Fri, 14 Aug 2015 21:26:19 +0000 (23:26 +0200)]
Fix span of invalid metavariable repetition

8 years agorustc: Allow changing the default allocator
Alex Crichton [Thu, 25 Jun 2015 17:07:01 +0000 (10:07 -0700)]
rustc: Allow changing the default allocator

This commit is an implementation of [RFC 1183][rfc] which allows swapping out
the default allocator on nightly Rust. No new stable surface area should be
added as a part of this commit.

[rfc]: https://github.com/rust-lang/rfcs/pull/1183

Two new attributes have been added to the compiler:

* `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to
  indicate that it requires an allocator crate to be in scope.
* `#![allocator]` - this is a indicator that the crate is an allocator which can
  satisfy the `needs_allocator` attribute above.

The ABI of the allocator crate is defined to be a set of symbols that implement
the standard Rust allocation/deallocation functions. The symbols are not
currently checked for exhaustiveness or typechecked. There are also a number of
restrictions on these crates:

* An allocator crate cannot transitively depend on a crate that is flagged as
  needing an allocator (e.g. allocator crates can't depend on liballoc).
* There can only be one explicitly linked allocator in a final image.
* If no allocator is explicitly requested one will be injected on behalf of the
  compiler. Binaries and Rust dylibs will use jemalloc by default where
  available and staticlibs/other dylibs will use the system allocator by
  default.

Two allocators are provided by the distribution by default, `alloc_system` and
`alloc_jemalloc` which operate as advertised.

Closes #27389

8 years agofixes #27124 for netbsd
Gleb Kozyrev [Fri, 14 Aug 2015 19:20:09 +0000 (22:20 +0300)]
fixes #27124 for netbsd

NetBSD didn't get its fix for #27124 and still suffers from that issue.

8 years agoAuto merge of #27838 - AlisdairO:diagnostics221, r=Manishearth
bors [Fri, 14 Aug 2015 19:21:59 +0000 (19:21 +0000)]
Auto merge of #27838 - AlisdairO:diagnostics221, r=Manishearth

As title :-)
Part of #24407.

r? @Manishearth

8 years agoadd diagnostics for E0221
Alisdair Owens [Fri, 14 Aug 2015 19:21:24 +0000 (20:21 +0100)]
add diagnostics for E0221

8 years agoImplemented Default for arrays up to [T; 32].
Without Boats [Fri, 14 Aug 2015 17:11:19 +0000 (10:11 -0700)]
Implemented Default for arrays up to [T; 32].

8 years agoAuto merge of #27641 - nikomatsakis:soundness-rfc-1214, r=nrc
bors [Fri, 14 Aug 2015 15:26:09 +0000 (15:26 +0000)]
Auto merge of #27641 - nikomatsakis:soundness-rfc-1214, r=nrc

This PR implements the majority of RFC 1214. In particular, it implements:

- the new outlives relation
- comprehensive WF checking

For the most part, new code receives warnings, not errors, though 3 regressions were found via a crater run.

There are some deviations from RFC 1214. Most notably:

- we still consider implied bounds from fn ret; this intersects other soundness issues that I intend to address in detail in a follow-up RFC. Fixing this without breaking a lot of code probably requires rewriting compare-method somewhat (which is probably a good thing).
- object types do not check trait bounds for fear of encountering `Self`; this was left as an unresolved question in RFC 1214, but ultimately feels inconsistent.

Both of those two issues are highlighted in the tracking issue, https://github.com/rust-lang/rust/issues/27579. #27579 also includes a testing matrix with new tests that I wrote -- these probably duplicate some existing tests, I tried to check but wasn't quite sure what to look for. I tried to be thorough in testing the WF relation, at least, but would welcome suggestions for missing tests.

r? @nrc (or perhaps someone else?)

8 years agobe more robust to bogus items in struct patterns/constructors
Ariel Ben-Yehuda [Fri, 14 Aug 2015 13:14:09 +0000 (16:14 +0300)]
be more robust to bogus items in struct patterns/constructors

Fixes #27815

8 years agoCorrect nits from @nrc
Niko Matsakis [Fri, 14 Aug 2015 13:26:19 +0000 (09:26 -0400)]
Correct nits from @nrc

8 years agoAuto merge of #27822 - arielb1:inline-round-take-2, r=Gankro
bors [Fri, 14 Aug 2015 07:11:07 +0000 (07:11 +0000)]
Auto merge of #27822 - arielb1:inline-round-take-2, r=Gankro

This speeds up rustc on #25916 from 1.36±0.022s to 1.326±0.025s

Tests pass locally (even on 32-bit :-)

r? @Gankro

8 years agoAuto merge of #27821 - dhuseby:manual_snapshots_1af31d4, r=alexcrichton
bors [Fri, 14 Aug 2015 05:40:44 +0000 (05:40 +0000)]
Auto merge of #27821 - dhuseby:manual_snapshots_1af31d4, r=alexcrichton

@alexcrichton please upload these snapshots when landing this patch:

https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-08-11-1af31d4-bitrig-x86_64-739e0635cd5a1b3635f1457aae3ef6390ea9a7a8.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-08-11-1af31d4-freebsd-i386-3cd4a44fb97b3135be3d1b760bea604a381e85dc.tar.bz2
https://github.com/dhuseby/rust-manual-snapshots/raw/master/rust-stage0-2015-08-11-1af31d4-freebsd-x86_64-de1f36592bac0eeb90c049a8421246652c511b9e.tar.bz2

8 years agoAuto merge of #27816 - steveklabnik:for_chrisbot, r=alexcrichton
bors [Fri, 14 Aug 2015 04:09:57 +0000 (04:09 +0000)]
Auto merge of #27816 - steveklabnik:for_chrisbot, r=alexcrichton

reported by @chris-code here: https://github.com/rust-lang/rust/issues/24486#issuecomment-130812460

8 years agoAuto merge of #27786 - alexcrichton:start-testing-msvc, r=brson
bors [Fri, 14 Aug 2015 02:38:29 +0000 (02:38 +0000)]
Auto merge of #27786 - alexcrichton:start-testing-msvc, r=brson

* An apparent bug in VS 2013's implementation of the `exp2` function is worked
  around in one of flt2dec's tests.

Turns out this was the only fix necessary!

8 years agoAuto merge of #27696 - bluss:into-boxed-str, r=alexcrichton
bors [Fri, 14 Aug 2015 01:06:37 +0000 (01:06 +0000)]
Auto merge of #27696 - bluss:into-boxed-str, r=alexcrichton

Rename String::into_boxed_slice -> into_boxed_str

This is the name that was decided in rust-lang/rfcs#1152, and it's
better if we say “boxed str” for `Box<str>`.

The old name `String::into_boxed_slice` is deprecated.

8 years agoAuto merge of #27684 - alexcrichton:remove-deprecated, r=aturon
bors [Thu, 13 Aug 2015 23:32:30 +0000 (23:32 +0000)]
Auto merge of #27684 - alexcrichton:remove-deprecated, r=aturon

This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.

8 years agoFixes #27805 - adds missing snapshots for Bitrig and FreeBSD
Dave Huseby [Thu, 13 Aug 2015 20:45:04 +0000 (13:45 -0700)]
Fixes #27805 - adds missing snapshots for Bitrig and FreeBSD

8 years agoAuto merge of #27758 - nathankleyn:diagnostics-386, r=Manishearth
bors [Thu, 13 Aug 2015 20:37:18 +0000 (20:37 +0000)]
Auto merge of #27758 - nathankleyn:diagnostics-386, r=Manishearth

This adds detailed diagnostics for E0386, 'cannot assign to data in an
immutable container'.

This is part of rust-lang/rust#24407.

r? @Manishearth

8 years agoFix broken link to Wilson
Steve Klabnik [Thu, 13 Aug 2015 19:42:14 +0000 (15:42 -0400)]
Fix broken link to Wilson

reported by @chris-code here: https://github.com/rust-lang/rust/issues/24486#issuecomment-130812460

8 years agoMark round_up_to_next as inline
arielb1 [Thu, 13 Aug 2015 19:23:26 +0000 (22:23 +0300)]
Mark round_up_to_next as inline

This speeds up rustc on #25916 from 1.36±0.022s to 1.326±0.025s

Tests pass locally (even on 32-bit :-)

8 years agoAuto merge of #27625 - wthrowe:find, r=alexcrichton
bors [Thu, 13 Aug 2015 16:09:22 +0000 (16:09 +0000)]
Auto merge of #27625 - wthrowe:find, r=alexcrichton

New enough find on Linux doesn't support "-perm +..." and suggests
using "-perm /..." instead, but that doesn't work on Windows.
Hopefully all platforms are happy with this expanded version.

I don't have access to a Windows development system to test this, so someone needs to verify that this actually works there before merging.

Closes #19981.

8 years agoGet `make check` working on MSVC
Alex Crichton [Wed, 12 Aug 2015 23:33:57 +0000 (16:33 -0700)]
Get `make check` working on MSVC

* An apparent bug in VS 2013's implementation of the `exp2` function is worked
  around in one of flt2dec's tests.

8 years agoAuto merge of #27307 - rkruppe:dec2flt, r=pnkfelix
bors [Thu, 13 Aug 2015 13:29:38 +0000 (13:29 +0000)]
Auto merge of #27307 - rkruppe:dec2flt, r=pnkfelix

Completely rewrite the conversion of decimal strings to `f64` and `f32`. The code is intended to be absolutely positively completely 100% accurate (when it doesn't give up). To the best of my knowledge, it achieves that goal. Any input that is not rejected is converted to the floating point number that is closest to the true value of the input. This includes overflow, subnormal numbers, and underflow to zero. In other words, the rounding error is less than or equal to 0.5 units in the last place. Half-way cases (exactly 0.5 ULP error) are handled with half-to-even rounding, also known as banker's rounding.

This code implements the algorithms from the paper [How to Read Floating Point Numbers Accurately][paper] by William D. Clinger, with extensions to handle underflow, overflow and subnormals, as well as some algorithmic optimizations.

# Correctness

With such a large amount of tricky code, many bugs are to be expected. Indeed tracking down the obscure causes of various rounding errors accounts for the bulk of the development time. Extensive tests (taking in the order of hours to run through to completion) are included in `src/etc/test-float-parse`: Though exhaustively testing all possible inputs is impossible, I've had good success with generating millions of instances from various "classes" of inputs. These tests take far too long to be run by @bors so contributors who touch this code need the discipline to run them. There are `#[test]`s, but they don't even cover every stupid mistake I made in course of writing this.

Another aspect is *integer* overflow. Extreme (or malicious) inputs could cause overflow both in the machine-sized integers used for bookkeeping throughout the algorithms (e.g., the decimal exponent) as well as the arbitrary-precision arithmetic. There is input validation to reject all such cases I know of, and I am quite sure nobody will *accidentally* cause this code to go out of range. Still, no guarantees.

# Limitations

Noticed the weasel words "(when it doesn't give up)" at the beginning? Some otherwise well-formed decimal strings are rejected because spelling out the value of the input requires too many digits, i.e., `digits * 10^abs(exp)` can't be stored in a bignum. This only applies if the value is not "obviously" zero or infinite, i.e., if you take a near-infinity or near-zero value and add many pointless fractional digits. At least with the algorithm used here, computing the precise value would require computing the full value as a fraction, which would overflow. The precise limit is `number_of_digits + abs(exp) > 375` but could be raised almost arbitrarily. In the future, another algorithm might lift this restriction entirely.

This should not be an issue for any realistic inputs. Still, the code does reject inputs that would result in a finite float when evaluated with unlimited precision. Some of these inputs are even regressions that the old code (mostly) handled, such as `0.333...333` with 400+ `3`s. Thus this might qualify as [breaking-change].

# Performance

Benchmarks results are... tolerable. Short numbers that hit the fast paths (`f64` multiplication or shortcuts to zero/inf) have performance in the same order of magnitude as the old code tens of nanoseconds. Numbers that are delegated to Algorithm Bellerophon (using floats with 64 bit significand, implemented in software) are slower, but not drastically so (couple hundred nanoseconds).

Numbers that need the AlgorithmM fallback (for `f64`, roughly everything below 1e-305 and above 1e305) take far, far longer, hundreds of microseconds. Note that my implementation is not quite as naive as the expository version in the paper (it needs one to four division instead of ~1000), but division is fundamentally pretty expensive and my implementation of it is extremely simple and slow.

All benchmarks run on a mediocre laptop with a i5-4200U CPU under light load.

# Binary size

Unfortunately the implementation needs to duplicate almost all code: Once for `f32` and once for `f64`. Before you ask, no, this cannot be avoided, at least not completely (but see the Future Work section). There's also a precomputed table of powers of ten, weighing in at about six kilobytes.

Running a stage1 `rustc` over a stand-alone program that simply parses pi to `f32` and `f64` and outputs both results reveals that the overhead vs. the old parsing code is about 44 KiB normally and about 28 KiB with LTO. It's presumably half of that + 3 KiB when only one of the two code paths is exercised.

| rustc options                 | old       | new       | delta         |
|---------------------------    |---------  |---------  |-----------    |
| [nothing]                     | 2588375   | 2633828   | 44.39 KiB     |
| -O                            | 2585211   | 2630688   | 44.41 KiB     |
| -O -C lto                     | 1026353   | 1054981   | 27.96 KiB     |
| -O -C lto -C link-args=-s     | 414208    | 442368    | 27.5 KiB      |

# Future Work

## Directory layout

The `dec2flt` code uses some types embedded deeply in the `flt2dec` module hierarchy, even though nothing about them it formatting-specific. They should be moved to a more conversion-direction-agnostic location at some point.

## Performance

It could be much better, especially for large inputs. Some low-hanging fruit has been picked but much more work could be done. Some specific ideas are jotted down in `FIXME`s all over the code.

## Binary size

One could try to compress the table further, though I am skeptical. Another avenue would be reducing the code duplication from basically everything being generic over `T: RawFloat`. Perhaps one can reduce the magnitude of the duplication by pushing the parts that don't need to know the target type into separate functions, but this is finicky and probably makes some code read less naturally.

## Other bases

This PR leaves `f{32,64}::from_str_radix` alone. It only replaces `FromStr` (and thus `.parse()`). I am convinced that `from_str_radix` should not exist, and have proposed its [deprecation and speedy removal][deprecate-radix]. Whatever the outcome of that discussion, it is independent from, and out of scope for, this PR.

Fixes #24557
Fixes #14353

r? @pnkfelix

cc @lifthrasiir @huonw

[paper]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.4152
[deprecate-radix]: https://internals.rust-lang.org/t/deprecate-f-32-64-from-str-radix/2405

8 years agoRename String::into_boxed_slice -> into_boxed_str
Ulrik Sverdrup [Thu, 13 Aug 2015 12:02:00 +0000 (14:02 +0200)]
Rename String::into_boxed_slice -> into_boxed_str

This is the name that was decided in rust-lang/rfcs#1152, and it's
better if we say “boxed str” for `Box<str>`.

The old name `String::into_boxed_slice` is deprecated.

8 years agoImprove interior mutability example for E0386.
Nathan Kleyn [Thu, 13 Aug 2015 09:17:18 +0000 (10:17 +0100)]
Improve interior mutability example for E0386.

8 years agoAdd details about types with interior mutability to E0386.
Nathan Kleyn [Thu, 13 Aug 2015 08:25:56 +0000 (09:25 +0100)]
Add details about types with interior mutability to E0386.

Types with interior mutability like `Cell` and `RefCell` can be used to
skirt the restriction on mutating mutable values inside an immutable
container.

8 years agoAdd detailed diagnostics for E0386.
Nathan Kleyn [Wed, 12 Aug 2015 19:46:38 +0000 (20:46 +0100)]
Add detailed diagnostics for E0386.

This adds detailed diagnostics for E0386, 'cannot assign to data in an
immutable container'.

8 years agoastconv.rs: extended ast_ty_to_ty debugging
Niko Matsakis [Thu, 13 Aug 2015 09:10:47 +0000 (05:10 -0400)]
astconv.rs: extended ast_ty_to_ty debugging

8 years agoAuto merge of #27803 - Manishearth:rollup, r=Manishearth
bors [Thu, 13 Aug 2015 08:47:22 +0000 (08:47 +0000)]
Auto merge of #27803 - Manishearth:rollup, r=Manishearth

- Successful merges: #27699, #27757
- Failed merges:

8 years agoRollup merge of #27757 - AlisdairO:diagnostics366, r=Manishearth
Manish Goregaokar [Thu, 13 Aug 2015 08:47:06 +0000 (14:17 +0530)]
Rollup merge of #27757 - AlisdairO:diagnostics366, r=Manishearth

As title :-)
Part of #24407.

r? @Manishearth

8 years agoRollup merge of #27699 - nathankleyn:diagnostics-383, r=Manishearth
Manish Goregaokar [Thu, 13 Aug 2015 08:47:06 +0000 (14:17 +0530)]
Rollup merge of #27699 - nathankleyn:diagnostics-383, r=Manishearth

This adds detailed diagnostics for `E0383`, 'partial reinitialization of
uninitialized structure'.

This is part of rust-lang/rust#24407.

r? @Manishearth

8 years agoImprove code examples for E0383 long diagnostic.
Nathan Kleyn [Thu, 13 Aug 2015 08:11:06 +0000 (09:11 +0100)]
Improve code examples for E0383 long diagnostic.

8 years agoAdd detailed diagnostics for E0383.
Nathan Kleyn [Wed, 12 Aug 2015 17:07:56 +0000 (18:07 +0100)]
Add detailed diagnostics for E0383.

This adds detailed diagnostics for E0383, 'partial reinitialization of
uninitialized structure'.

This is part of rust-lang/rust#24407.

8 years agoAuto merge of #27762 - alexcrichton:fix-libc, r=aturon
bors [Thu, 13 Aug 2015 07:07:34 +0000 (07:07 +0000)]
Auto merge of #27762 - alexcrichton:fix-libc, r=aturon

The corrected signature of `ioctl` broke some crates on crates.io, and it's not
currently worth the major version bump of libc, so for now keep the old
signature around for crates.io builds only with a comment to remove it at a
future date.

This should allow libc on crates.io to update to the master version in-tree.
I've verified that this was the only breakage of substance between the version
libc is currently built with and today's master branch.

8 years agoAuto merge of #27693 - nagisa:remutex-docs, r=alexcrichton
bors [Thu, 13 Aug 2015 05:30:13 +0000 (05:30 +0000)]
Auto merge of #27693 - nagisa:remutex-docs, r=alexcrichton

Initial version of PR had an DerefMut implementation, which was later removed
because it may cause mutable reference aliasing.

Suggest how to implement mutability with reentrant mutex and remove the claim we
implement DerefMut.

8 years agoAuto merge of #27789 - chriskrycho:remove_pandoc_references, r=steveklabnik
bors [Thu, 13 Aug 2015 03:52:10 +0000 (03:52 +0000)]
Auto merge of #27789 - chriskrycho:remove_pandoc_references, r=steveklabnik

Per @steveklabnik's comment [here](https://github.com/rust-lang/cargo/issues/739#issuecomment-130085860), the Pandoc components of the Makefile are no longer used, and as such the corresponding components of the documentation are out of date.

  - I've removed the Pandoc (and therefore also LaTeX) elements of the makefile and confirmed that the build proceeds correctly.
  - I updated the documentation to reference `rustdoc` and  of Pandoc.

r? @steveklabnik

8 years agodoc/readme: replace references to Pandoc with rustdoc.
Chris Krycho [Wed, 12 Aug 2015 00:12:31 +0000 (20:12 -0400)]
doc/readme: replace references to Pandoc with rustdoc.

8 years agoAuto merge of #27763 - wthrowe:debug-docs, r=alexcrichton
bors [Thu, 13 Aug 2015 02:10:28 +0000 (02:10 +0000)]
Auto merge of #27763 - wthrowe:debug-docs, r=alexcrichton

When --cfg ndebug changed to -C debug-assertions the documentation was
updated to reflect the new name, but not that the meaning was
reversed.

8 years agoexpr_use_visitor: Remove FIXME that is no longer needed (and in fact
Niko Matsakis [Thu, 13 Aug 2015 00:59:01 +0000 (20:59 -0400)]
expr_use_visitor: Remove FIXME that is no longer needed (and in fact
causes errors, post rebase). Issue #27592 is still alive and well,
whatever it is.

8 years agoadd regression test for #27592. Fixes #27592.
Niko Matsakis [Thu, 13 Aug 2015 00:58:47 +0000 (20:58 -0400)]
add regression test for #27592. Fixes #27592.

8 years agoAuto merge of #27652 - alex-ozdemir:iter, r=bluss
bors [Thu, 13 Aug 2015 00:26:29 +0000 (00:26 +0000)]
Auto merge of #27652 - alex-ozdemir:iter, r=bluss

Provides a custom implementation of Iterator methods `count`, `nth`, and `last` for the structures `slice::{Windows,Chunks,ChunksMut}` in the core module.

These implementations run in constant time as opposed to the default implementations which run in linear time.

Addresses Issue #24214

r? @aturon

8 years agoCorrect debug! documentation
William Throwe [Mon, 10 Aug 2015 23:56:26 +0000 (19:56 -0400)]
Correct debug! documentation

When --cfg ndebug changed to -C debug-assertions the documentation was
updated to reflect the new name, but not that the meaning was
reversed.

8 years agoWhitelist .pp files in tidy-binaries
William Throwe [Wed, 12 Aug 2015 23:08:22 +0000 (19:08 -0400)]
Whitelist .pp files in tidy-binaries

Pretty-printed files sometimes start with #![some_feature], which
looks like a shebang line and confuses Windows builds into thinking
they are executables.

8 years agoAuto merge of #27698 - arielb1:foreign-type-import, r=alexcrichton
bors [Wed, 12 Aug 2015 22:42:12 +0000 (22:42 +0000)]
Auto merge of #27698 - arielb1:foreign-type-import, r=alexcrichton

Fixes #22968
Probably fixes #27602 (the issue needs a reproduction)

r? @alexcrichton

8 years agolibc: Fix backcompat with crates.io version
Alex Crichton [Wed, 12 Aug 2015 22:32:36 +0000 (15:32 -0700)]
libc: Fix backcompat with crates.io version

The corrected signature of `ioctl` broke some crates on crates.io, and it's not
currently worth the major version bump of libc, so for now keep the old
signature around for crates.io builds only with a comment to remove it at a
future date.

This should allow libc on crates.io to update to the master version in-tree.
I've verified that this was the only breakage of substance between the version
libc is currently built with and today's master branch.

8 years agoregionck.rs: experimentally adopt a more conservative strategy for
Niko Matsakis [Wed, 12 Aug 2015 21:55:50 +0000 (17:55 -0400)]
regionck.rs: experimentally adopt a more conservative strategy for
projection outlives relations that prefers not to add extract edges to
region graph

8 years agoty.rs: document/cleanup required_region_bounds a bit
Niko Matsakis [Wed, 12 Aug 2015 19:03:19 +0000 (15:03 -0400)]
ty.rs: document/cleanup required_region_bounds a bit

8 years agoregionck.rs: add a delayed_span_bug call to validate an asserrtion
Niko Matsakis [Wed, 12 Aug 2015 14:19:02 +0000 (10:19 -0400)]
regionck.rs: add a delayed_span_bug call to validate an asserrtion

8 years agooutlives.rs: correct typo
Niko Matsakis [Tue, 11 Aug 2015 18:34:27 +0000 (14:34 -0400)]
outlives.rs: correct typo

8 years agotraits/error_reporting.rs: always note obligation cause
Niko Matsakis [Tue, 11 Aug 2015 18:32:01 +0000 (14:32 -0400)]
traits/error_reporting.rs: always note obligation cause

8 years agoUpdate test error messages based on changes to wfcheck; also, break
Niko Matsakis [Tue, 11 Aug 2015 18:20:27 +0000 (14:20 -0400)]
Update test error messages based on changes to wfcheck; also, break
apart the tests that tested many things at once.

8 years agocheck/wf.rs: change to use correct span and older WF algorithm;
Niko Matsakis [Tue, 11 Aug 2015 17:43:29 +0000 (13:43 -0400)]
check/wf.rs: change to use correct span and older WF algorithm;
at the time I reinstituted the old code, I hadn't given up yet and
brought back the implicator.

8 years agooutlives.rs: remove use of ty.walk and replace with recursive of
Niko Matsakis [Tue, 11 Aug 2015 15:33:55 +0000 (11:33 -0400)]
outlives.rs: remove use of ty.walk and replace with recursive of
ty.walk_shallow, add add'l comments.

8 years agooutlives: convert outlives to use an exhaustive match, for better
Niko Matsakis [Tue, 11 Aug 2015 15:17:15 +0000 (11:17 -0400)]
outlives: convert outlives to use an exhaustive match, for better
reliability.

8 years agotraits: consider whether origin is RFC1214 when caching, ensuring
Niko Matsakis [Tue, 11 Aug 2015 14:48:34 +0000 (10:48 -0400)]
traits: consider whether origin is RFC1214 when caching, ensuring
that the test rfc1214-warn-and-error.rs reports an error

8 years agoregionck.rs: correct misuse of ty.regions() rather than regions()
Niko Matsakis [Tue, 11 Aug 2015 13:54:06 +0000 (09:54 -0400)]
regionck.rs: correct misuse of ty.regions() rather than regions()
and add a test that was (incorrectly) failing to compile with
existing code

8 years agoregionck.rs: remove dead fn type_strictly_outlives
Niko Matsakis [Tue, 11 Aug 2015 13:25:36 +0000 (09:25 -0400)]
regionck.rs: remove dead fn type_strictly_outlives

8 years agomiddle/outlives.rs: s/temp/subcomponents/
Niko Matsakis [Tue, 11 Aug 2015 13:08:11 +0000 (09:08 -0400)]
middle/outlives.rs: s/temp/subcomponents/

8 years agomiddle/outlives.rs: fix typo
Niko Matsakis [Tue, 11 Aug 2015 13:06:22 +0000 (09:06 -0400)]
middle/outlives.rs: fix typo

8 years agoinfer/mod.rs: add doc comment to RFC1214 variant
Niko Matsakis [Tue, 11 Aug 2015 13:05:50 +0000 (09:05 -0400)]
infer/mod.rs: add doc comment to RFC1214 variant

8 years agowip 082a011e2bd5c8254e6c1b2fdc97a6fcb2927a7f rm binary
Niko Matsakis [Tue, 11 Aug 2015 13:01:13 +0000 (09:01 -0400)]
wip 082a011e2bd5c8254e6c1b2fdc97a6fcb2927a7f rm binary

8 years agoFallout in tests -- explain an interesting test failure having to
Niko Matsakis [Fri, 7 Aug 2015 17:47:54 +0000 (13:47 -0400)]
Fallout in tests -- explain an interesting test failure having to
do with dropck and the new outlives rules

8 years agoFallout in tests --- misc error message changes, WF fixes
Niko Matsakis [Fri, 7 Aug 2015 17:23:11 +0000 (13:23 -0400)]
Fallout in tests --- misc error message changes, WF fixes

8 years agoFallout in tests -- break test into a run-pass and compile-fail component
Niko Matsakis [Fri, 7 Aug 2015 17:32:49 +0000 (13:32 -0400)]
Fallout in tests -- break test into a run-pass and compile-fail component

8 years agoFallout in tests -- break this test into three tests, since we later saw
Niko Matsakis [Fri, 7 Aug 2015 17:32:14 +0000 (13:32 -0400)]
Fallout in tests -- break this test into three tests, since we later saw
staging differences in terms of when errors were reported

8 years agoFallout in tests -- break the object safety part into a separate file because error
Niko Matsakis [Fri, 7 Aug 2015 14:59:28 +0000 (10:59 -0400)]
Fallout in tests -- break the object safety part into a separate file because error
will be in future reported by wfcheck, which runs in a later stage than
coherence

8 years agoFallout in tests -- we now report an error if you even reference a type
Niko Matsakis [Fri, 7 Aug 2015 14:58:00 +0000 (10:58 -0400)]
Fallout in tests -- we now report an error if you even reference a type
`&Foo` where `Foo` is a trait that is not object-safe

8 years agoAdd FIXME for apparent stage0 regression
Niko Matsakis [Fri, 7 Aug 2015 14:48:13 +0000 (10:48 -0400)]
Add FIXME for apparent stage0 regression

8 years agoFallout in libs -- misc missing bounds uncovered by WF checks.
Niko Matsakis [Fri, 7 Aug 2015 13:27:27 +0000 (09:27 -0400)]
Fallout in libs -- misc missing bounds uncovered by WF checks.

8 years agoNew tests --- projection outlives relation
Niko Matsakis [Fri, 7 Aug 2015 17:25:23 +0000 (13:25 -0400)]
New tests --- projection outlives relation

8 years agoGeneralize the outlives rule for projections to handle the new cases;
Niko Matsakis [Fri, 7 Aug 2015 14:33:18 +0000 (10:33 -0400)]
Generalize the outlives rule for projections to handle the new cases;
also, generalize VerifyBounds to include OR conditions.

8 years agoIntroduce a "origin/cause" for new requirements (or bugfixes...) introduced by RFC...
Niko Matsakis [Fri, 7 Aug 2015 14:28:51 +0000 (10:28 -0400)]
Introduce a "origin/cause" for new requirements (or bugfixes...) introduced by RFC 1214,
and issue a warning (and explanatory note) when we encounter such a
thing.

8 years agoNew tests --- check that wf relation is being checked in various positions
Niko Matsakis [Fri, 7 Aug 2015 17:31:42 +0000 (13:31 -0400)]
New tests --- check that wf relation is being checked in various positions

8 years agoNew WF condition requires checking that argument types are WF
Niko Matsakis [Fri, 7 Aug 2015 13:43:40 +0000 (09:43 -0400)]
New WF condition requires checking that argument types are WF
on every call. This ensures that implies bounds are reasonable
(the older code only checked that the values provided had WF types, but
we also must know that the formal types of the arguments are WF.)

8 years agoImplement a new wfcheck to replace the old wf; this new code only issues
Niko Matsakis [Fri, 7 Aug 2015 13:39:54 +0000 (09:39 -0400)]
Implement a new wfcheck to replace the old wf; this new code only issues
warnings. It also checks more conditions than the old code.  Keep the
old wf code around unchanged so that we can continue to issue errors for
the cases where we used to report errors.

As part of this, remove the where-clauses-must-reference-parameter rule,
which is easily circumvented.

8 years agoExtend ParameterEnvironment to remember the free_id, and to be usable
Niko Matsakis [Fri, 7 Aug 2015 14:37:17 +0000 (10:37 -0400)]
Extend ParameterEnvironment to remember the free_id, and to be usable
on more kind of items

8 years agoAdd two new kinds of predicates, WellFormed and ObjectSafe.
Niko Matsakis [Fri, 7 Aug 2015 13:30:19 +0000 (09:30 -0400)]
Add two new kinds of predicates, WellFormed and ObjectSafe.

8 years agoDefine the `wf` and `outlives` relation separately, unlike the existing
Niko Matsakis [Thu, 6 Aug 2015 18:27:21 +0000 (14:27 -0400)]
Define the `wf` and `outlives` relation separately, unlike the existing
`implicator`. These definitions are also in accordance with RFC 1214 (or
more so), and hence somewhat different from the implicator. This commit
also modifies the implicator to remove the older rules for projections,
which can easily trigger infinite loops.

8 years agoDon't report a hard error if there are inference failures until
Niko Matsakis [Fri, 7 Aug 2015 13:41:05 +0000 (09:41 -0400)]
Don't report a hard error if there are inference failures until
after we check casts, because sometimes casts can influence inference,
unfortunately. We do re-run `select_all_trait_obligations` during
regionck anyhow.

8 years agoRemove all unstable deprecated functionality
Alex Crichton [Wed, 12 Aug 2015 00:27:05 +0000 (17:27 -0700)]
Remove all unstable deprecated functionality

This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.

8 years agoAuto merge of #27691 - jonas-schievink:for-macro, r=alexcrichton
bors [Wed, 12 Aug 2015 20:58:31 +0000 (20:58 +0000)]
Auto merge of #27691 - jonas-schievink:for-macro, r=alexcrichton

Closes #27004

8 years agoAdd long diagnostics for E0366 and E0367
Alisdair Owens [Wed, 12 Aug 2015 19:50:49 +0000 (20:50 +0100)]
Add long diagnostics for E0366 and E0367

8 years agoAuto merge of #27690 - vadimcn:no-windres, r=alexcrichton
bors [Wed, 12 Aug 2015 19:13:52 +0000 (19:13 +0000)]
Auto merge of #27690 - vadimcn:no-windres, r=alexcrichton

Fix #26803