Commit Graph

77588 Commits

Author SHA1 Message Date
kennytm
73ea8939ee
Rollup merge of #49931 - csmoe:end_span, r=estebank
Fix incorrect span in `&mut` suggestion

Fixes #49859
2018-04-17 03:34:30 +08:00
Russell Cohen
084d2bc479 Reorder injection of std to get better compilation error 2018-04-16 12:28:30 -07:00
kennytm
6c3e1d7555
Remove underscore_lifetimes and match_default_bindings from active feature list
These are already stabilized in 1.26.
2018-04-17 03:28:25 +08:00
kennytm
e4991b2f48
Rollup merge of #49646 - glandium:uninitialized-box, r=alexcrichton
Use box syntax instead of Box::new in Mutex::remutex on Windows

The Box::new(mem::uninitialized()) pattern actually actively copies
uninitialized bytes from the stack into the box, which is a waste of
time. Using the box syntax instead avoids the useless copy.
2018-04-17 01:50:59 +08:00
kennytm
ccd2c403ac
Rollup merge of #49606 - varkor:pipe-repair, r=alexcrichton
Prevent broken pipes causing ICEs

As the private `std::io::print_to` panics if there is an I/O error, which is used by `println!`, the compiler would ICE if one attempted to use a broken pipe (e.g. `rustc --help | false`). This introduces a new (private) macro `try_println!` which allows us to avoid this.

As a side note, it seems this macro might be useful publicly (and actually there seems to be [a crate specifically for this purpose](https://crates.io/crates/try_print/)), though that can probably be left for a future discussion.

One slight alternative approach would be to simply early exit without an error (i.e. exit code `0`), which [this comment](https://github.com/rust-lang/rust/issues/34376#issuecomment-377822526) suggests is the usual approach. I've opted not to take that approach initially, because I think it's more helpful to know when there is a broken pipe.

Fixes #34376.
2018-04-17 01:50:58 +08:00
kennytm
bf60295211
Rollup merge of #49555 - nox:inline-into-boxed, r=alexcrichton
Inline most of the code paths for conversions with boxed slices

This helps with the specific problem described in #49541, obviously without making any large change to how inlining works in the general case.

Everything involved in the conversions is made `#[inline]`, except for the `<Vec<T>>::into_boxed_slice` entry point which is made `#[inline(always)]` after checking that duplicating the function mentioned in the issue prevented its inlining if I only annotate it with
`#[inline]`.

For the record, that function was:

```rust
pub fn foo() -> Box<[u8]> {
    vec![0].into_boxed_slice()
}
```

To help the inliner's job, we also hoist a `self.capacity() != self.len` check in `<Vec<T>>::shrink_to_fit` and mark it as `#[inline]` too.
2018-04-17 01:50:56 +08:00
steveklabnik
00c860e8a9 write docs for targets 2018-04-16 12:57:16 -04:00
steveklabnik
b204968239 fill out contributing 2018-04-16 12:57:09 -04:00
steveklabnik
cd3f6cf3fe fill out command line arguments 2018-04-16 12:57:01 -04:00
bors
49317cd511 Auto merge of #49130 - smmalis37:range, r=alexcrichton
Move Range*::contains to a single default impl on RangeBounds

Per the ongoing discussion in #32311.

This is my first PR to Rust (woo!), so I don't know if this requires an amendment to the original range_contains RFC, or not, or if we can just do a psuedo-RFC here. While this may no longer follow the explicit decision made in that RFC, I believe this better follows its spirit by adding the new contains method to all Ranges. It also allows users to be generic over all ranges and use this method without writing it themselves (my personal desired use case).

This also somewhat answers the unanswered question about Wrapping ranges in the above issue by instead just punting it to the question of what those types should return for start() & end(), or if they should implement RangeArgument at all. Those types could also implement their own contains method without implementing this trait, in which case the question remains the same.

This does add a new contains method to types that already implemented RangeArgument but not contains. These types are RangeFull, (Bound<T>, Bound<T>), (Bound<&'a T>, Bound<&'a T>). No tests have been added for these types yet. No inherent method has been added either.

r? @alexcrichton
2018-04-16 16:07:10 +00:00
Alex Crichton
598d836fff Stabilize x86/x86_64 SIMD
This commit stabilizes the SIMD in Rust for the x86/x86_64 platforms. Notably
this commit is stabilizing:

* The `std::arch::{x86, x86_64}` modules and the intrinsics contained inside.
* The `is_x86_feature_detected!` macro in the standard library
* The `#[target_feature(enable = "...")]` attribute
* The `#[cfg(target_feature = "...")]` matcher

Stabilization of the module and intrinsics were primarily done in
rust-lang-nursery/stdsimd#414 and the two attribute stabilizations are done in
this commit. The standard library is also tweaked a bit with the new way that
stdsimd is integrated.

Note that other architectures like `std::arch::arm` are not stabilized as part
of this commit, they will likely stabilize in the future after they've been
implemented and fleshed out. Similarly the `std::simd` module is also not being
stabilized in this commit, only `std::arch`. Finally, nothing related to `__m64`
is stabilized in this commit either (MMX), only SSE and up types and intrinsics
are stabilized.

Closes #29717
Closes #44839
Closes #48556
2018-04-16 07:25:10 -07:00
bors
1ef1563518 Auto merge of #48945 - clarcharr:iter_exhaust, r=Kimundi
Replace manual iterator exhaust with for_each(drop)

This originally added a dedicated method, `Iterator::exhaust`, and has since been replaced with `for_each(drop)`, which is more idiomatic.

<del>This is just shorthand for `for _ in &mut self {}` or `while let Some(_) = self.next() {}`. This states the intent a lot more clearly than the identical code: run the iterator to completion.

<del>At least personally, my eyes tend to gloss over `for _ in &mut self {}` without fully paying attention to what it does; having a `Drop` implementation akin to:

<del>`for _ in &mut self {}; unsafe { free(self.ptr); }`</del>

<del>Is not as clear as:

<del>`self.exhaust(); unsafe { free(self.ptr); }`

<del>Additionally, I've seen debate over whether `while let Some(_) = self.next() {}` or `for _ in &mut self {}` is more clear, whereas `self.exhaust()` is clearer than both.
2018-04-16 13:21:56 +00:00
bors
d6a2dd9912 Auto merge of #49433 - varkor:metadata-skip-mir-opt, r=michaelwoerister
Skip MIR encoding for cargo check

Resolves #48662.

r? @michaelwoerister
2018-04-16 10:30:57 +00:00
kennytm
5fe8c59f12
Stabilize core::hint::unreachable_unchecked.
Closes #43751.
2018-04-16 18:29:40 +08:00
bors
532764cb79 Auto merge of #49963 - llogiq:stabilize-13226, r=kennytm
stabilize fetch_nand

This closes #13226 and makes `Atomic*.fetch_nand` stable.
2018-04-16 07:44:25 +00:00
Corey Farwell
afa22d63d7 Remove unnecessary indentation in rustdoc book codeblock. 2018-04-16 16:25:57 +09:00
bors
3e70dfd655 Auto merge of #49956 - QuietMisdreavus:rustdoc-codegen, r=GuillaumeGomez
rustdoc: port the -C option from rustc

Blocked on https://github.com/rust-lang/rust/pull/49864. The included test won't work without those changes, so this PR includes those commits as well.

When documenting items that require certain target features, it helps to be able to force those target features into existence. Rather than include a flag just to parse those features, i instead decided to port the `-C` flag from rustc in its entirety. It takes the same parameters, because it runs through the same parsing function. This has the added benefit of being able to control the codegen of doctests as well.

One concern i have with the flag is that i set it to stable here. My rationale is that it is a direct port of functionality on rustc that is currently stable, used only in mechanisms that it is originally used for. If needed, i can set it back to be unstable.
2018-04-16 05:00:14 +00:00
bors
748c549185 Auto merge of #49847 - sinkuu:save_analysis_implicit_extern, r=petrochenkov
Fix save-analysis generation with extern_in_paths/extern_absolute_paths

Fixes #48742.
2018-04-16 02:34:32 +00:00
John Kåre Alsaker
fe63637350 Use locks for Session.lint_store and Session.buffered_lints 2018-04-16 02:23:55 +02:00
bors
d6ba1b9b02 Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkov
Update `?` repetition disambiguation.

**Do not merge** (yet)

This is a test implementation of some ideas from discussion in https://github.com/rust-lang/rust/issues/48075 . This PR
- disallows `?` repetition from taking a separator, since the separator is never used.
- disallows the use of `?` as a separator. This allows patterns like `$(a)?+` to match `+` and `a+` rather than `a?a?a`. This is a _breaking change_, but maybe that's ok? Perhaps a crater run is the right approach?

cc @durka @alexreg @nikomatsakis
2018-04-16 00:06:10 +00:00
Fabian Zaiser
b7c4a57465 Rebase and fix conflicts. 2018-04-15 23:49:41 +02:00
Fabian Zaiser
de475582c4 Stop duplicating where clauses from impl's. 2018-04-15 23:32:58 +02:00
Fabian Zaiser
ecd41976fc Rebase and update code. 2018-04-15 23:32:58 +02:00
Fabian Zaiser
27393b1210 Improve function name. 2018-04-15 23:32:57 +02:00
Fabian Zaiser
5a73fd5e1f Implement Chalk lowering rule Normalize-From-Impl 2018-04-15 23:32:57 +02:00
bors
8de5353f75 Auto merge of #49947 - oli-obk:turing_complete_const_eval, r=nagisa
Don't abort const eval due to long running evals, just warn

one check-box of #49930

r? @nagisa (https://github.com/rust-lang/rfcs/pull/2344#issuecomment-368246665)
2018-04-15 21:18:37 +00:00
James Sanderson
4ae9488ce8 Provide better names for builtin deriving-generated attributes 2018-04-15 20:51:10 +01:00
John Kåre Alsaker
2741690902 Tweaks to intern_ty 2018-04-15 20:53:36 +02:00
John Kåre Alsaker
bfd14bd907 Make use of thread-safe arenas 2018-04-15 20:53:19 +02:00
John Kåre Alsaker
19d44f2d24 Make arenas thread safe 2018-04-15 20:53:03 +02:00
John Kåre Alsaker
ead5cf11b8 Add misc timings 2018-04-15 20:53:03 +02:00
John Kåre Alsaker
e3e4420906 Make layout_depth thread-safe 2018-04-15 20:53:03 +02:00
Zack M. Davis
e77110e1f6 don't see issue #0
The unstable-feature attribute requires an issue (neglecting it is
E0547), which gets used in the error messages. Unfortunately, there are
some cases where "0" is apparently used a placeholder where no issue
exists, directing the user to see the (nonexistent) issue #0. (It would
have been better to either let `issue` be optional—compare to how issue
is an `Option<u32>` in the feature-gate declarations in
libsyntax/feature-gate.rs—or actually require that an issue be created.)
Rather than endeavoring to change how `#[unstable]` works at this time
(given competing contributor and reviewer priorities), this simple patch
proposes the less-ambitious solution of just not adding the "(see
issue)" note when the number is zero.

Resolves #49983.
2018-04-15 11:12:33 -07:00
Oliver Schneider
a406af885d
Only warn on erroneous promoted constants 2018-04-15 15:08:37 +02:00
Shotaro Yamada
c3dc014378 Check generated save-analysis, instead of bug!()ing
Injected crates don't have extern info. Let's skip them.
2018-04-15 21:41:28 +09:00
bors
7360d6dd67 Auto merge of #49833 - oli-obk:incremental_miri_regression, r=michaelwoerister
Don't recurse into allocations, use a global table instead

r? @michaelwoerister

fixes #49663
2018-04-15 12:32:13 +00:00
Anthony Ramine
a7c4b5c97a Properly handle ranges of signed enums using both extremums (fixes #49973) 2018-04-15 13:38:00 +02:00
Oliver Schneider
907df8c0f7
Add a tracking issue for making the warning a lint 2018-04-15 13:28:15 +02:00
Niko Matsakis
96dba9358c s/use_mir/use_mir_borrowck/ 2018-04-15 07:13:44 -04:00
Niko Matsakis
45d281d7fa remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
Niko Matsakis
818ae6fece don't expose the borrows field 2018-04-15 07:06:30 -04:00
Niko Matsakis
033c4f2e3c just use an iterator 2018-04-15 07:06:30 -04:00
Niko Matsakis
df233f0f2c stop using borrows for anything but iterating over live data 2018-04-15 07:06:30 -04:00
Niko Matsakis
d4005a2bc9 thread borrow-set around more 2018-04-15 07:06:30 -04:00
Niko Matsakis
a849da626d remove ReserveOrActivateIndex 2018-04-15 07:06:29 -04:00
Niko Matsakis
d32e5aac3d use the activations_at_location map to check activations
Not gen bits
2018-04-15 07:06:29 -04:00
Niko Matsakis
e1f82aa590 determine whether a borrow is active based solely on the location 2018-04-15 07:06:29 -04:00
Niko Matsakis
f93d5d30bd add useful debug 2018-04-15 07:06:29 -04:00
Niko Matsakis
8e783da222 encapsulate ReserveOrActivateIndex into the borrows dataflow 2018-04-15 07:06:29 -04:00
Niko Matsakis
5f7b74f832 construct the BorrowSet outside of borrows 2018-04-15 07:06:29 -04:00