Commit Graph

86123 Commits

Author SHA1 Message Date
kennytm
5b572fb840
Rollup merge of #55840 - dlrobertson:fix_stage0_download, r=alexcrichton
Fix TLS errors when downloading stage0

While attempting to test #49878 on Windows I hit the following error when attempting to download stage0.

```
The request was aborted: Could not create SSL/TLS secure channel
```

Instead of using the shell, we can just use `urllib`, which seems to fix the issue.
2018-11-13 19:20:33 +08:00
kennytm
f73df10c39
Rollup merge of #55837 - Centril:spökdata-skall-vara-strukturellt-matchbar, r=eddyb
Make PhantomData #[structural_match]

fixes https://github.com/rust-lang/rust/issues/55028

This makes `PhantomData<T>` structurally matchable, irrespective of whether `T` is, per the discussion on this week's language team meeting (the general consensus was that this was a bug-fix).

All types containing `PhantomData<T>` and which used `#[derive(PartialEq, Eq)]` and were previously not `#[structural_match]` only because of `PhantomData<T>` will now be `#[structural_match]`.

r? @nikomatsakis
2018-11-13 19:20:30 +08:00
kennytm
98bc7d63fb
Rollup merge of #55805 - nnethercote:mv-static_assert, r=Mark-Simulacrum
Move `static_assert!` into librustc_data_structures
2018-11-13 19:20:28 +08:00
kennytm
d811f844a5
Rollup merge of #55804 - QuietMisdreavus:eager-crate-inline, r=pnkfelix
rustdoc: don't inline `pub use some_crate` unless directly asked to

cc https://github.com/rust-lang/rust/issues/52509 (fixes it? i'm not sure about my comment summoning the docs team)

When rustdoc encounters a `pub use` statement for an item from another crate, it will eagerly inline its contents into your crate. This somewhat clashes with the new paths behavior in Rust 2018, in which crates are implicitly linked and re-exported with `pub use` instead of `pub extern crate`. In rust 2015, `pub extern crate` would only create a single line for its re-export in the docs, so i'm making it do the same with `pub use some_crate;`.

The exact new behavior is like this: *If rustdoc sees a `pub use` statement, and the item being imported is the root of another crate, it will only inline it if `#[doc(inline)]` is provided.* I made it only avoid crate roots because otherwise it would stop inlining any module, which may or may not be what people want.
2018-11-13 19:20:25 +08:00
kennytm
a8bcf612d5
Rollup merge of #55754 - spastorino:fix-process-output-docs, r=alexcrichton
Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err

r? @nikomatsakis
2018-11-13 19:20:18 +08:00
kennytm
e9bd1f21ec
Rollup merge of #55711 - kngwyu:btreemap-rangemut-doc, r=Mark-Simulacrum
Format BtreeMap::range_mut example

Before:
![image](https://user-images.githubusercontent.com/16046705/48049184-36517780-e1e1-11e8-8da2-a3ae858d5a76.png)
After:
![image](https://user-images.githubusercontent.com/16046705/48049210-45382a00-e1e1-11e8-87b3-84ae60ef798e.png)
2018-11-13 19:20:13 +08:00
bors
485397e49a Auto merge of #55589 - oli-obk:min_length_💣, r=pnkfelix
Add `VariantIdx` type and use instead of `usize`
2018-11-13 07:04:14 +00:00
KWierso
533d26f875
Fix their/there grammar nit 2018-11-12 18:21:52 -08:00
bors
c4371c854f Auto merge of #55052 - newpavlov:patch-2, r=alexcrichton
Use read_unaligned instead of read in transmute_copy

Closes: #55044

This change could result in performance regression on non-x86 platforms. (but it also can fix some of UB which lurks in existing programs) An alternative would be to update `transmute_copy` documentation with alignment requirements.
2018-11-13 01:08:13 +00:00
Nicholas Nethercote
2bd4d5b1a0 Move two static_assert!s to better spots.
And make them x86_64-only so they can use `==` instead of `<=`.
2018-11-13 11:30:43 +11:00
Nicholas Nethercote
fb3dd9f64e Add a static assertion about the size of ast::Expr. 2018-11-13 06:37:16 +11:00
Nicholas Nethercote
49f482f537 Move a static_assert! to a better spot.
And make it x86_64-only so it can use `==` instead of `<=`.
2018-11-13 06:36:35 +11:00
Nicholas Nethercote
ab8a947fa0 Move static_assert! into librustc_data_structures.
This means it can be used by more crates.
2018-11-13 06:21:57 +11:00
bors
65204a97d4 Auto merge of #55278 - Centril:constification-1, r=alexcrichton
Minor standard library constification

This PR makes some bits of the standard library into `const fn`s.
I've tried to be as aggressive as I possibly could in the constification.
The list is rather small due to how restrictive `const fn` is at the moment.

r? @oli-obk cc @rust-lang/libs

Stable public APIs affected:
+ [x] `Cell::as_ptr`
+ [x] `UnsafeCell::get`
+ [x] `char::is_ascii`
+ [x] `iter::empty`
+ [x] `ManuallyDrop::{new, into_inner}`
+ [x] `RangeInclusive::{start, end}`
+ [x] `NonNull::as_ptr`
+ [x] `{[T], str}::as_ptr`
+ [x] `Duration::{as_secs, subsec_millis, subsec_micros, subsec_nanos}`
+ [x] `CStr::as_ptr`
+ [x] `Ipv4Addr::is_unspecified`
+ [x] `Ipv6Addr::new`
+ [x] `Ipv6Addr::octets`

Unstable public APIs affected:
+ [x] `Duration::{as_millis, as_micros, as_nanos, as_float_secs}`
+ [x] `Wrapping::{count_ones, count_zeros, trailing_zeros, rotate_left, rotate_right, swap_bytes, reverse_bits, from_be, from_le, to_be, to_le, leading_zeros, is_positive, is_negative, leading_zeros}`
+ [x] `core::convert::identity`

--------------------------

## Removed from list in first pass:

Stable public APIs affected:
+ [ ] `BTree{Map, Set}::{len, is_empty}`
+ [ ] `VecDeque::is_empty`
+ [ ] `String::{is_empty, len}`
+ [ ] `FromUtf8Error::utf8_error`
+ [ ] `Vec<T>::{is_empty, len}`
+ [ ] `Layout::size`
+ [ ] `DecodeUtf16Error::unpaired_surrogate`
+ [ ] `core::fmt::{fill, width, precision, sign_plus, sign_minus, alternate, sign_aware_zero_pad}`
+ [ ] `panic::Location::{file, line, column}`
+ [ ] `{ChunksExact, RChunksExact}::remainder`
+ [ ] `Utf8Error::valid_up_to`
+ [ ] `VacantEntry::key`
+ [ ] `NulError::nul_position`
+ [ ] `IntoStringError::utf8_error`
+ [ ] `IntoInnerError::error`
+ [ ] `io::Chain::get_ref`
+ [ ] `io::Take::{limit, get_ref}`
+ [ ] `SocketAddrV6::{flowinfo, scope_id}`
+ [ ] `PrefixComponent::{kind, as_os_str}`
+ [ ] `Path::{ancestors, display}`
+ [ ] `WaitTimeoutResult::timed_out`
+ [ ] `Receiver::{iter, try_iter}`
+ [ ] `thread::JoinHandle::thread`
+ [ ] `SystemTimeError::duration`

Unstable public APIs affected:
+ [ ] `core::fmt::Arguments::new_v1`
+ [ ] `core::fmt::Arguments::new_v1_formatted`
+ [ ] `Pin::{get_ref, into_ref}`
+ [ ] `Utf8Lossy::chunks`
+ [ ] `LocalWaker::as_waker`
+ [ ] `panic::PanicInfo::{internal_constructor, message, location}`
+ [ ] `panic::Location::{internal_constructor }`

## Removed from list in 2nd pass:

Stable public APIs affected:
+ [ ] `LinkedList::{new, iter, is_empty, len}`
+ [ ] `mem::forget`
+ [ ] `Cursor::{new, get_ref, position}`
+ [ ] `io::{empty, repeat, sink}`
+ [ ] `PoisonError::new`
+ [ ] `thread::Builder::new`
+ [ ] `process::Stdio::{piped, inherit, null}`

Unstable public APIs affected:
+ [ ] `io::Initializer::{zeroing, should_initialize}`
2018-11-12 18:54:11 +00:00
Stjepan Glavina
56d3a824e4 Update docs 2018-11-12 18:36:49 +01:00
Stjepan Glavina
4d2934e803 Add forget_unsized only 2018-11-12 17:19:59 +01:00
Oliver Scherer
d46a2078b4 Deduplicate field and variant visitor methods 2018-11-12 14:24:45 +01:00
Oliver Scherer
b174b0b955 miri-engine value visitor update to VariantIdx 2018-11-12 14:24:45 +01:00
Oliver Scherer
4a9ed3f25a Use type safe VariantIdx instead of usize everywhere 2018-11-12 14:24:45 +01:00
Oliver Scherer
740fb0cbaa Use IndexVec instead of usize in librustc 2018-11-12 12:33:16 +01:00
Oliver Scherer
19ae2b940c Shrink some internal enums 2018-11-12 12:33:16 +01:00
Oliver Scherer
6fc8779b1e Merge an assert + cast into a try_into call 2018-11-12 12:33:16 +01:00
Simon Sapin
4da9f1069f
Document optimizations enabled by FusedIterator
When reading this I wondered what “some significant optimizations” referred to. As far as I can tell, the specialization of `.fuse()` is the only case where `FusedIterator` has any impact at all. Is this accurate @Stebalien?
2018-11-12 12:22:33 +01:00
Oliver Scherer
22039597e1 Fix fallout it rustc_driver tests 2018-11-12 10:29:53 +01:00
Oliver Scherer
3e5dfdd6f6 Typo nit 2018-11-12 10:29:53 +01:00
Oliver Scherer
e5fd34c1ae Fix fulldeps test with NodeId 2018-11-12 10:29:53 +01:00
Oliver Scherer
4c9ee59584 Reintroduce the original debug formatting for NodeIds 2018-11-12 10:29:53 +01:00
Oliver Scherer
4bf7c33b79 Fix rustdoc 2018-11-12 10:29:53 +01:00
Oliver Scherer
a1d89266e5 Turn HirLocalId into a newtype_index 2018-11-12 10:29:53 +01:00
Oliver Scherer
39a0969e64 Make NodeId a newtype_index to enable niche optimizations 2018-11-12 10:29:53 +01:00
Ralf Jung
3c88cfef67 remove unused import 2018-11-12 09:11:29 +01:00
bors
0195812aea Auto merge of #55604 - nnethercote:avoid-associated_items-Box, r=nnethercote
Avoid the Box in `TyCtxt::associated_items`.

This reduces instruction counts on `packed_simd` by 2%.

r? @nikomatsakis
2018-11-12 08:03:58 +00:00
Ralf Jung
075983c70b global allocators: add a few comments 2018-11-12 09:01:57 +01:00
Ralf Jung
ace20b9646 for uniformity, also move memory_deallocated to AllocationExtra 2018-11-12 08:39:13 +01:00
Niko Matsakis
e927a244ea Avoid the Box in TyCtxt::associated_items.
This reduces instruction counts on packed_simd by 2%.
2018-11-12 16:23:35 +11:00
Nicholas Nethercote
c6862992d9 Change Lit::short_name to Lit::literal_name.
This avoids a moderately hot allocation in `parse_lit_token`.
2018-11-12 15:16:03 +11:00
bors
d1d79ae3ad Auto merge of #55701 - tromey:ice-fix, r=matthewjasper
Fix emission of niche-filling discriminant values

Bug #55606 points out a regression introduced by #54004; namely that
an assertion can erroneously fire when a niche-filling discriminant
value is emitted.

This fixes the bug by removing the assertion, and furthermore by
arranging for the discriminant value to be masked according to the
size of the niche.  This makes handling the discriminant a bit simpler
for debuggers.

The test case is from Jonathan Turner.

Closes #55606
2018-11-12 04:12:26 +00:00
Dan Robertson
c211238180
Fix TLS errors when downloading stage0 2018-11-12 02:35:44 +00:00
Hugo van der Wijst
4fdae853f7 Reference count crate_inherent_implss return value.
The repeated cloning of the result in `inherent_impls` queries has quite
an impact on crates with many inherent trait implementations.
2018-11-11 17:55:39 -08:00
bors
d8f4c9ffac Auto merge of #55525 - nnethercote:MatcherPos-stack-SmallVec, r=nnethercote
Make `MatcherPos::stack` a `SmallVec`.

This avoids some allocations.

This seems like a trivial change, but the compiler rejects it:
```
   Compiling syntax v0.0.0 (/home/njn/moz/rust1/src/libsyntax)
error[E0597]: `initial` does not live long enough=========>           ] 89/110: syntax
   --> libsyntax/ext/tt/macro_parser.rs:647:57
    |
647 |     let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)];
    |                                                         ^^^^^^^^^^^^ borrowed value does not live long enough
...
762 | }
    | -
    | |
    | `initial` dropped here while still borrowed
    | borrow later used here, when `initial` is dropped

error: aborting due to previous error
```
This is either a compiler bug, or there's some subtle thing I don't understand. The lifetimes sure seem straightforward: `initial` is declared, and then `cur_items` is declared immediately afterward, and it uses a reference to `initial`. The error message makes it sound like the compiler is dropping the variables in the wrong order.

r? @nikomatsakis, any idea what the problem is?
2018-11-12 01:20:33 +00:00
Niko Matsakis
68e76dca09 Make MatcherPos::stack a SmallVec.
This avoids some allocations.
2018-11-12 11:37:18 +11:00
bors
775eab5883 Auto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichton
Remove support for building against LLVM 4

With emscripten removed in #55626, we no longer need to support building against LLVM 4.
2018-11-11 22:38:54 +00:00
Igor Matuszewski
04cc0d651e save-analysis: Don't panic for macro-generated use globs
Follow-up to
c2bb7cadf2.
2018-11-11 21:42:20 +01:00
bors
ca79ecd694 Auto merge of #55660 - alexcrichton:cleanup-alloc-system, r=dtolnay,SimonSapin
Remove the `alloc_system` crate

In what's hopefully one of the final nails in the coffin of the "old allocator story of yore" this PR deletes the `alloc_system` crate and all traces of it from the compiler. The compiler no longer needs to inject allocator crates anywhere and the `alloc_system` crate has no real reason to exist outside the standard library.

The unstable `alloc_system` crate is folded directly into the standard library where its stable interface, the `System` type, remains the same. All unstable traces of `alloc_system` are removed, however.
2018-11-11 19:51:56 +00:00
Denis Vasilik
6f3add34ca Minor style guide corrections. 2018-11-11 20:11:25 +01:00
Alex Crichton
cc7590341a std: Delete the alloc_system crate
This commit deletes the `alloc_system` crate from the standard
distribution. This unstable crate is no longer needed in the modern
stable global allocator world, but rather its functionality is folded
directly into the standard library. The standard library was already the
only stable location to access this crate, and as a result this should
not affect any stable code.
2018-11-11 09:22:28 -08:00
Alex Crichton
d3939322e3 rustc: Clean up allocator injection logic
This commit cleans up allocator injection logic found in the compiler
around selecting the global allocator. It turns out that now that
jemalloc is gone the compiler never actually injects anything! This
means that basically everything around loading crates here and there can
be easily pruned.

This also removes the `exe_allocation_crate` option from custom target
specs as it's no longer used by the compiler anywhere.
2018-11-11 09:22:28 -08:00
bors
5a2ca1a6f1 Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelix
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field

Fixes #55651, #55652.

This PR makes two changes:

First, it updates the dataflow builder to add an init for the place
containing a union if there is an assignment into the field of
that union.

Second, it stops a "use of uninitialized" error occuring when there is an
assignment into the field of an uninitialized union that was previously
initialized. Making this assignment would re-initialize the union, as
tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
The check for previous initialization ensures that we do not start
supporting partial initialization yet (cc #21232, #54499, #54986).

This PR also fixes #55652 which was marked as requiring investigation
as the changes in this PR add an error that was previously missing
(and mentioned in the review comments) and confirms that the error
that was present is correct and a result of earlier partial
initialization changes in NLL.

r? @pnkfelix (due to earlier work with partial initialization)
cc @nikomatsakis
2018-11-11 17:05:36 +00:00
Denis Vasilik
dc0fd65af2 Whitespace cleanup according to Rust's style guidelines. 2018-11-11 16:58:00 +01:00
Denis Vasilik
f0bfbd3e72 Added comments for trait implementations. 2018-11-11 15:44:15 +01:00