Commit Graph

45252 Commits

Author SHA1 Message Date
Alex Crichton
b345437c3c rustc: Add a --cap-lints flag to the compiler
This commit is an implementation of [RFC 1193][rfc] which adds the ability to
the compiler to cap the lint level for the entire compilation session. This flag
will ensure that no lints will go above this level, and Cargo will primarily use
this flag passing `--cap-lints allow` to all upstream dependencies.

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

Closes #27259
2015-07-28 18:23:09 -07:00
bors
8d432fbf10 Auto merge of #26846 - P1start:print-maybe-styled-macro, r=pnkfelix
`EmitterWriter::print_maybe_styled` was basically always used with `format!`, so this macro makes some code cleaner. It should also remove some unnecessary allocations (most `print_maybe_styled` invocations allocated a `String` previously, whereas the new macro uses `write_fmt` to write the formatted string directly to the terminal).

This probably could have been part of #26838, but it’s too late now. It’s also rebased on #26838’s branch because otherwise pretty much all of the changes in this PR would conflict with the other PR’s changes.
2015-07-29 00:28:55 +00:00
Alex Crichton
76db37ee4b std: Stabilize a number of small APIs
The following APIs were all marked with a `#[stable]` tag:

* process::Child::id
* error::Error::is
* error::Error::downcast
* error::Error::downcast_ref
* error::Error::downcast_mut
* io::Error::get_ref
* io::Error::get_mut
* io::Error::into_inner
* hash::Hash::hash_slice
* hash::Hasher::write_{i,u}{8,16,32,64,size}
2015-07-28 16:34:01 -07:00
Brian Anderson
6464198508 std: Remove some old #[cfg(test) hacks
Since most lang items are actually defined in core, these hack reexports don't actually
do anything useful.
2015-07-28 16:22:05 -07:00
Alex Crichton
798ce50284 std: Deprecate extra TcpStream/UdpSocket methods
These methods are all covered by [RFC 1158] and are currently all available on
stable Rust via the [`net2` crate][net2] on crates.io. This commit does not
touch the timeout related functions as they're still waiting on `Duration` which
is unstable anyway, so punting in favor of the `net2` crate wouldn't buy much.

[RFC 1158]: https://github.com/rust-lang/rfcs/pull/1158
[net2]: http://crates.io/crates/net2

Specifically, this commit deprecates:

* TcpStream::set_nodelay
* TcpStream::set_keepalive
* UdpSocket::set_broadcast
* UdpSocket::set_multicast_loop
* UdpSocket::join_multicast
* UdpSocket::set_multicast_time_to_live
* UdpSocket::set_time_to_live
2015-07-28 16:08:05 -07:00
Simonas Kazlauskas
cca0ea718d Replace illegal with invalid in most diagnostics 2015-07-29 01:59:31 +03:00
Simonas Kazlauskas
ffcdf0881b Improve typeck diagnostic messages
Mostly by splitting error messages into proper pairs of errors and helps
2015-07-29 01:57:24 +03:00
Simonas Kazlauskas
77e9228b4a Improve invalid recursive types diagnostic 2015-07-29 01:57:24 +03:00
bors
ba324694d6 Auto merge of #27318 - soon:E0391_explanation, r=nrc
Part of #24407
2015-07-28 22:51:53 +00:00
Alexis Beingessner
b539906de1 clarify subtyping 2015-07-28 15:41:58 -07:00
Alexis Beingessner
9123bb02ca fix borrow-splitting 2015-07-28 15:38:39 -07:00
Patrick Walton
3a12b4c4f8 libcollections: Inline some performance-critical string functions; e.g.
`chars()`.

This was showing up in Servo profiles.
2015-07-28 15:18:27 -07:00
Alexis Beingessner
b93438f648 fix incorrect name 2015-07-28 15:16:59 -07:00
Alexis Beingessner
0d37e78977 lots more felix fixes 2015-07-28 15:13:54 -07:00
bors
55ede7ed8e Auto merge of #27234 - oli-obk:move_get_name_get_ident_to_impl, r=eddyb
this has quite some fallout. but also made lots of stuff more readable imo

[breaking-change] for plugin authors
2015-07-28 21:14:28 +00:00
Alexis Beingessner
5789106737 many many pnkfelix fixes 2015-07-28 13:20:36 -07:00
Ulrik Sverdrup
73d4330ff8 Use raw pointers to avoid aliasing violation in split_at_mut
Fixes #27357
2015-07-28 22:04:25 +02:00
bors
ba9224f354 Auto merge of #26934 - reem:boxed-slice-clone, r=Gankro
Closes #25097
2015-07-28 19:36:26 +00:00
Dave Huseby
d088b67187 Fixes #25155 and fixes #27359 by fixing the stat defines for both freebsd 10.1 x86_64 and i686 2015-07-28 11:10:23 -07:00
Felix S. Klock II
5a156190cb Fix more bugs in the alignment calculation refs to DSTs. 2015-07-28 20:08:29 +02:00
Felix S. Klock II
cea0dc4f6d Part of #27023: Put drop flag at end of a type's representation.
This is trickier than it sounds (because the DST code was written
assuming that one could divide the sized and unsized portions of a
type strictly into a sized prefix and unsized suffix, when it reality
it is more like a sized prefix and sized suffix that surround the
single unsized field).

I chose to put in a pretty hack-ish approach to this because
drop-flags are scheduled to go away anyway, so its not really worth
the effort to to make an infrastructure that sounds as general as the
previous paragraph indicates.

Also, I have written notes of other fixes that need to be made to
really finish fixing #27023, namely more work needs to be done to
account for alignment when computing the size of a value.
2015-07-28 20:08:29 +02:00
Felix S. Klock II
39ec9f850b trans: Add Type::to_string method to improve options for debug output. 2015-07-28 20:08:29 +02:00
bors
aa6efd959e Auto merge of #27173 - mark-buer:split-android-ndks, r=alexcrichton
Allows a multi-Android-target Rust compiler to be built.
Without these (or similar) changes, only a single-Android-target Rust compiler is possible.
Please see https://internals.rust-lang.org/t/dual-target-android-rust-compiler/2382/3 for additional context.
2015-07-28 17:58:18 +00:00
krumelmonster
9699119c57 more precise for inclusive range 2015-07-28 19:22:20 +02:00
Ariel Ben-Yehuda
757b0c176f prohibit the lhs of an @-pattern being a constant
as this breaks code that worked under some conditions, this is a
[breaking-change]

Fixes #27033
Fixes #27077
2015-07-28 19:51:08 +03:00
Ariel Ben-Yehuda
bd01175234 clarify the parenthetical notation stability error message
This also calls the right API, which e.g. prevents a suggestion
for #![feature(unboxed_closures)] on stable.

Fixes #26970
2015-07-28 19:21:24 +03:00
Oliver Schneider
00a5e66f81 remove get_ident and get_name, make as_str sound 2015-07-28 18:07:20 +02:00
bors
661a5ad38e Auto merge of #26173 - pnkfelix:fsk-trans-nzmove-take3, r=nikomatsakis
Add dropflag hints (stack-local booleans) for unfragmented paths in trans.  Part of #5016.

Added code to maintain these hints at runtime, and to conditionalize drop-filling and calls to destructors.

In this early stage of my incremental implementation strategy, we are using hints, so we are always free to leave out a flag for a path -- then we just pass `None` as the dropflag hint in the corresponding schedule cleanup call. But, once a path has a hint, we must at least maintain it: i.e. if the hint exists, we must ensure it is never set to "moved" if the data in question might actually have been initialized. It remains sound to conservatively set the hint to "initialized" as long as the true drop-flag embedded in the value itself is up-to-date.

I hope the commit series has been broken up to be readable; most of the commits in the series should build (though I did not always check this).

----

Oh, I think this technically qualifies as a:
[breaking-change]
because it removes drop-filling in some cases where one could previously observe it. That should only affect `unsafe` code; no safe code should be able to inspect whether the drop-fill was present or not. For an example of code that needed to change to account for this, see commit a81c24ae0216ab47df59acd724f8a33124fb6d97 (a unit test of the `move_val_init` intrinsic).  I have not encountered actual code that needed to be updated to account for the change, since this should only be skipping the drop-filling on *moved* values, not on dropped one, and so even types that use `unsafe_no_drop_flag` should be unchanged by this particular PR. (Their time will come later.)
2015-07-28 15:15:00 +00:00
Simonas Kazlauskas
91397a6aa3 Replace occurences of illegal in user facing docs 2015-07-28 17:55:44 +03:00
Guillaume Gomez
cf55db2ad1 Improve E0119 error explanation 2015-07-28 16:37:11 +02:00
Felix S. Klock II
b4dd765e68 comments and code-cleanup in response to reviews. 2015-07-28 16:15:56 +02:00
Felix S. Klock II
22796c8bad build fragmented map earlier to make its dependencies clearer. 2015-07-28 16:15:56 +02:00
Felix S. Klock II
494ce37ffe Reduced the Lvalue constructors to a kernel of three constructors.
Updated all call sites that used the other contructors to uniformly
call `Lvalue::new_with_hint`, passing along the appropriate kind
of hint for each context.

Placated tidy in a few other places in datum.rs.
2015-07-28 16:15:51 +02:00
Felix S. Klock II
ff14eaf054 Revise intrinsic-move-val test to not require knowledge of whether filling drop is in use. 2015-07-28 16:15:05 +02:00
Felix S. Klock II
e25427a2b2 During my own review, I convinced myself this was indeed a bug.
Testing indicates bug would have been caught, albeit later than one
might hope, during `sync::mpsc::tests::smoke_shared_port_gone2` test.
2015-07-28 16:15:05 +02:00
Felix S. Klock II
dce1c61e97 Add dropflag hints (stack-local booleans) for unfragmented paths in trans.
Added code to maintain these hints at runtime, and to conditionalize
drop-filling and calls to destructors.

In this early stage, we are using hints, so we are always free to
leave out a flag for a path -- then we just pass `None` as the
dropflag hint in the corresponding schedule cleanup call. But, once a
path has a hint, we must at least maintain it: i.e. if the hint
exists, we must ensure it is never set to "moved" if the data in
question might actually have been initialized. It remains sound to
conservatively set the hint to "initialized" as long as the true
drop-flag embedded in the value itself is up-to-date.

----

Here are some high-level details I want to point out:

 * We maintain the hint in Lvalue::post_store, marking the lvalue as
   moved. (But also continue drop-filling if necessary.)

 * We update the hint on ExprAssign.

 * We pass along the hint in once closures that capture-by-move.

 * You only call `drop_ty` for state that does not have an associated hint.
   If you have a hint, you must call `drop_ty_core` instead.
   (Originally I passed the hint into `drop_ty` as well, to make the
   connection to a hint more apparent, but the vast majority of
   current calls to `drop_ty` are in contexts where no hint is
   available, so it just seemed like noise in the resulting diff.)
2015-07-28 16:14:58 +02:00
Felix S. Klock II
d3d552b71b rustc and rustc::borrowck: pass fragment info down into trans. 2015-07-28 16:12:32 +02:00
Felix S. Klock II
a0f3f2ac53 Extend trans::datum::Lvalue so that it carrys an optional dropflag hint.
Instrumented calls sites that construct Lvalues to ease tracking down
cases that we might need to change whether or not they carry a hint.

Note that this commit does not do anything to actually *construct*
the `lldropflag_hints` map, nor does it change anything about codegen
itself. Those parts are in follow-on commits.
2015-07-28 16:12:32 +02:00
Felix S. Klock II
20aa27b7bc debugflag to turn off nonzeroing move hint optimization.
(already thumbs-upped pre-rebase by nikomatsakis)
2015-07-28 16:12:32 +02:00
Felix S. Klock II
9ef61f1ee0 Prep for dropflag hints: refactor trans:_match to pass around MatchInput rather than ValueRef.
(already thumbs-upped pre-rebase by nikomatsakis)

The refactoring here is trivial because `trans::datum::Lvalue`
currently carries no payload. However, future commits will start
adding a payload to `Lvalue`, and thus will force us either

 1. to thread the payload through the `_match` code (a long term goal), or

 2. to ensure the payload has some reasonable default value.
2015-07-28 16:12:27 +02:00
Felix S. Klock II
3eb7dd7f74 Prep for dropflag-hints: Clarify trans bindings MoveByRef and MoveIntoCopy. 2015-07-28 15:52:34 +02:00
bors
ec49d01c88 Auto merge of #27330 - alexcrichton:reenable-lto-syntax-extension, r=huonw
The functionality this was testing was removed somewhere along the line, and
this commit restores what it was testing.

Closes #20586
2015-07-28 12:53:28 +00:00
bors
4c371bb6de Auto merge of #27319 - diaphore:pr_debug_osstr_escape, r=alexcrichton
I had to modify some tests : since `wtf8buf_show` and `wtf8_show` were doing the exact same thing, I repurposed `wtf8_show` to `wtf8buf_show_str` which ensures `Wtf8Buf` `Debug`-formats the same as `str`.

`write_str_escaped` might also be shared amongst other `fmt` but I just left it there within `Wtf8::fmt` for review.
2015-07-28 10:28:45 +00:00
Björn Steinbrink
218eccfa4e Fix de-deduplication for closure debuginfo
Closure variables represent the closure environment, not the closure
function, so the identifier used to ensure that the debuginfo is unique
for each kind of closure needs to be based on the closure upvars and not
the function signature.
2015-07-28 10:58:22 +02:00
bors
5b72fa42d4 Auto merge of #27309 - eddyb:snapshot-infdef, r=alexcrichton
FreeBSD i386 snapshot is missing, failed tests (possibly spurious).
r? @alexcrichton
2015-07-28 08:51:21 +00:00
Jonathan Reem
e24423091f Implement Clone for Box<[T]> where T: Clone
Closes #25097
2015-07-28 01:43:17 -07:00
Pascal Hertleif
8c6ec5d72c IO Docs: Fix Link in Cursor description
The first paragraph of the docs of the Cursor struct contains a Markdown
link. In listings, this won't get rendered. (Rustdoc seems to split off the
first paragraph and after that convert Markdown to HTML.)
2015-07-28 09:39:15 +02:00
Mark Buer
33a7e67904 Splits Android NDK path configuration. 2015-07-28 19:21:04 +12:00
bors
79d5fefa25 Auto merge of #27275 - nrc:save-use, r=brson
r? @brson
2015-07-28 07:14:55 +00:00
bors
ff6c6ce917 Auto merge of #27280 - bluss:siphash-perf, r=alexcrichton
Improve siphash performance for longer data

Use `ptr::copy_nonoverlapping` (aka memcpy) to load an u64 from the
byte stream. This is correct for any alignment, and the compiler will
use the appropriate instruction to load the data.

Also contains small tweaks that should benefit hashing short data too,
both the commit that removes a variable and the autovectorization of
the hash state initialization (in SipHash::reset).

Benchmarks show that hashing longer data benefits for the improved word loading.

Before (using benchmarks from the first commit in the PR):

The before benchmark is a bit noisy.

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 0) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          49 ns/iter (+/- 2) = 142 MB/s
test hash::sip::bench_bytes_8                              ... bench:          42 ns/iter (+/- 4) = 190 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          57 ns/iter (+/- 14) = 280 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          85 ns/iter (+/- 74) = 376 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         278 ns/iter (+/- 33) = 460 MB/s
test hash::sip::bench_long_str                             ... bench:         825 ns/iter (+/- 103)
test hash::sip::bench_str_of_8_bytes                       ... bench:         151 ns/iter (+/- 66)
test hash::sip::bench_str_over_8_bytes                     ... bench:          59 ns/iter (+/- 3)
test hash::sip::bench_str_under_8_bytes                    ... bench:          47 ns/iter (+/- 56)
test hash::sip::bench_u32                                  ... bench:          39 ns/iter (+/- 93) = 205 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          40 ns/iter (+/- 88) = 200 MB/s
test hash::sip::bench_u64                                  ... bench:          54 ns/iter (+/- 96) = 148 MB/s
```

After:

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 3) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          48 ns/iter (+/- 0) = 145 MB/s
test hash::sip::bench_bytes_8                              ... bench:          35 ns/iter (+/- 1) = 228 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          45 ns/iter (+/- 1) = 355 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          60 ns/iter (+/- 0) = 533 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         161 ns/iter (+/- 5) = 795 MB/s
test hash::sip::bench_long_str                             ... bench:         514 ns/iter (+/- 5)
test hash::sip::bench_str_of_8_bytes                       ... bench:          44 ns/iter (+/- 0)
test hash::sip::bench_str_over_8_bytes                     ... bench:          51 ns/iter (+/- 0)
test hash::sip::bench_str_under_8_bytes                    ... bench:          52 ns/iter (+/- 6)
test hash::sip::bench_u32                                  ... bench:          40 ns/iter (+/- 2) = 200 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          39 ns/iter (+/- 1) = 205 MB/s
test hash::sip::bench_u64                                  ... bench:          36 ns/iter (+/- 1) = 222 MB/s
```
2015-07-28 05:38:53 +00:00