]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agostd: Synchronize access to global env during `exec`
Alex Crichton [Tue, 13 Nov 2018 22:57:10 +0000 (14:57 -0800)]
std: Synchronize access to global env during `exec`

This commit, after reverting #55359, applies a different fix for #46775
while also fixing #55775. The basic idea was to go back to pre-#55359
libstd, and then fix #46775 in a way that doesn't expose #55775.

The issue described in #46775 boils down to two problems:

* First, the global environment is reset during `exec` but, but if the
  `exec` call fails then the global environment was a dangling pointer
  into free'd memory as the block of memory was deallocated when
  `Command` is dropped. This is fixed in this commit by installing a
  `Drop` stack object which ensures that the `environ` pointer is
  preserved on a failing `exec`.

* Second, the global environment was accessed in an unsynchronized
  fashion during `exec`. This was fixed by ensuring that the
  Rust-specific environment lock is acquired for these system-level
  operations.

Thanks to Alex Gaynor for pioneering the solution here!

Closes #55775

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
5 years agoRevert "Fixes #46775 -- don't mutate the process's environment in Command::exec"
Alex Crichton [Tue, 13 Nov 2018 22:50:50 +0000 (14:50 -0800)]
Revert "Fixes #46775 -- don't mutate the process's environment in Command::exec"

This reverts commit 36fe3b605a7a7143a14565272140ba1b43c1b041.

5 years agoAuto merge of #55934 - alexcrichton:appveyor-gce, r=Mark-Simulacrum
bors [Wed, 14 Nov 2018 11:54:14 +0000 (11:54 +0000)]
Auto merge of #55934 - alexcrichton:appveyor-gce, r=Mark-Simulacrum

Switch AppVeyor builds to the GCE cloud

[Recommended by AppVeyor][1] this isn't done by default for all builds
due to the high startup overhead (3-4 minutes for a VM), but that's
paltry compared to our overall build times so should be more than
applicable!

[1]: https://help.appveyor.com/discussions/questions/29832-did-recent-changes-apply-to-possibly-slow-down-builds#comment_46494058

5 years agoAuto merge of #52153 - csmoe:projeq_normal, r=scalexm
bors [Wed, 14 Nov 2018 02:46:24 +0000 (02:46 +0000)]
Auto merge of #52153 - csmoe:projeq_normal, r=scalexm

chalk lowering rule: ProjectionEq-Normalize

cc #49177
r? @scalexm

5 years agoAuto merge of #55912 - kennytm:rollup, r=kennytm
bors [Tue, 13 Nov 2018 22:17:46 +0000 (22:17 +0000)]
Auto merge of #55912 - kennytm:rollup, r=kennytm

Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)

5 years agoSwitch AppVeyor builds to the GCE cloud
Alex Crichton [Tue, 13 Nov 2018 21:38:04 +0000 (13:38 -0800)]
Switch AppVeyor builds to the GCE cloud

[Recommended by AppVeyor][1] this isn't done by default for all builds
due to the high startup overhead (3-4 minutes for a VM), but that's
paltry compared to our overall build times so should be more than
applicable!

[1]: https://help.appveyor.com/discussions/questions/29832-did-recent-changes-apply-to-possibly-slow-down-builds#comment_46494058

5 years agoImplement `ProjectionEq-Normalize`
csmoe [Sun, 8 Jul 2018 14:28:24 +0000 (22:28 +0800)]
Implement `ProjectionEq-Normalize`

5 years agoAuto merge of #55356 - Aaron1011:fix/rustdoc-negative-auto, r=nikomatsakis
bors [Tue, 13 Nov 2018 19:16:18 +0000 (19:16 +0000)]
Auto merge of #55356 - Aaron1011:fix/rustdoc-negative-auto, r=nikomatsakis

Check for negative impls when finding auto traits

Fixes #55321

When AutoTraitFinder begins examining a type, it checks for an explicit
negative impl. However, it wasn't checking for negative impls found when
calling 'select' on predicates found from nested obligations.

This commit makes AutoTraitFinder check for negative impls whenever it
makes a call to 'select'. If a negative impl is found, it immediately
bails out.

Normal users of SelectioContext don't need to worry about this, since
they stop as soon as an Unimplemented error is encountered. However, we
add predicates to our ParamEnv when we encounter this error, so we need
to handle negative impls specially (so that we don't try adding them to
our ParamEnv).

5 years agoAuto merge of #55649 - scalexm:chalk-bound-ty, r=nikomatsakis
bors [Tue, 13 Nov 2018 12:22:30 +0000 (12:22 +0000)]
Auto merge of #55649 - scalexm:chalk-bound-ty, r=nikomatsakis

Use bound types in `librustc_traits`

r? @nikomatsakis
see the tests which now move the higher-ranked binders to the left in implied bound rules!

5 years agoFix ui tests
scalexm [Sat, 3 Nov 2018 18:34:28 +0000 (19:34 +0100)]
Fix ui tests

5 years agoInstantiate all bound vars existentially
scalexm [Thu, 1 Nov 2018 14:30:37 +0000 (15:30 +0100)]
Instantiate all bound vars existentially

5 years agoUse a dummy outlives requirement for `where Type:,` (see #53696)
scalexm [Thu, 1 Nov 2018 14:09:02 +0000 (15:09 +0100)]
Use a dummy outlives requirement for `where Type:,` (see #53696)
A `WF(Type)` predicate was used previously, which did not play
well with implied bounds in chalk.

5 years agoReorder code in `rustc::traits::structural_impls`
scalexm [Thu, 1 Nov 2018 13:39:03 +0000 (14:39 +0100)]
Reorder code in `rustc::traits::structural_impls`

5 years agoBypass ppaux for `Outlives` predicates
scalexm [Thu, 1 Nov 2018 13:32:32 +0000 (14:32 +0100)]
Bypass ppaux for `Outlives` predicates

5 years agoProvide program clauses for builtin types
scalexm [Wed, 31 Oct 2018 21:07:54 +0000 (22:07 +0100)]
Provide program clauses for builtin types

5 years agoAdjust documentation
scalexm [Wed, 31 Oct 2018 18:03:23 +0000 (19:03 +0100)]
Adjust documentation

5 years agoPretty print quantified goals and clauses
scalexm [Wed, 31 Oct 2018 17:55:40 +0000 (18:55 +0100)]
Pretty print quantified goals and clauses

5 years agoReplace type params with bound vars in `rustc_traits::lowering`
scalexm [Wed, 31 Oct 2018 14:16:46 +0000 (15:16 +0100)]
Replace type params with bound vars in `rustc_traits::lowering`

5 years agoRollup merge of #55722 - RalfJung:impl-stable-hash, r=varkor
kennytm [Tue, 13 Nov 2018 11:22:53 +0000 (19:22 +0800)]
Rollup merge of #55722 - RalfJung:impl-stable-hash, r=varkor

impl_stable_hash_for: support enums and tuple structs with generic parameters

Port a bunch of implementations over to the macro, now that that is possible.

5 years agoRollup merge of #55136 - GuillaumeGomez:short-doc, r=QuietMisdreavus
kennytm [Tue, 13 Nov 2018 07:09:40 +0000 (15:09 +0800)]
Rollup merge of #55136 - GuillaumeGomez:short-doc, r=QuietMisdreavus

Remove short doc where it starts with a codeblock

Fixes #54975.

5 years agoRollup merge of #55908 - KWierso:patch-1, r=wesleywiser
kennytm [Tue, 13 Nov 2018 05:03:26 +0000 (13:03 +0800)]
Rollup merge of #55908 - KWierso:patch-1, r=wesleywiser

Fix their/there grammar nit

5 years agoRollup merge of #55905 - nnethercote:short_name-to-literal_name, r=Mark-Simulacrum
kennytm [Tue, 13 Nov 2018 05:03:25 +0000 (13:03 +0800)]
Rollup merge of #55905 - nnethercote:short_name-to-literal_name, r=Mark-Simulacrum

Change `Lit::short_name` to `Lit::literal_name`.

This avoids a moderately hot allocation in `parse_lit_token`.

r? @Mark-Simulacrum

5 years agoRollup merge of #55896 - rust-lang:opt-fuse, r=shepmaster
kennytm [Tue, 13 Nov 2018 05:03:24 +0000 (13:03 +0800)]
Rollup merge of #55896 - rust-lang:opt-fuse, r=shepmaster

Document optimizations enabled by FusedIterator

When reading this I wondered what “some significant optimizations” referred to. As far as I can tell from reading code, the specialization of `.fuse()` is the only case where `FusedIterator` has any impact at all. Is this accurate @Stebalien?

5 years agoRollup merge of #55889 - RalfJung:global-alloc, r=alexcrichton
kennytm [Tue, 13 Nov 2018 05:03:22 +0000 (13:03 +0800)]
Rollup merge of #55889 - RalfJung:global-alloc, r=alexcrichton

global allocators: add a few comments

These comments answer some questions that came up when I tried to understand how the control flow works for the global allocator, `Global` and `System`.

r? @alexcrichton

5 years agoRollup merge of #55888 - RalfJung:alloc-extra, r=oli-obk
kennytm [Tue, 13 Nov 2018 05:03:21 +0000 (13:03 +0800)]
Rollup merge of #55888 - RalfJung:alloc-extra, r=oli-obk

miri: for uniformity, also move memory_deallocated to AllocationExtra

r? @oli-obk

5 years agoRollup merge of #55882 - hugwijst:rc_return_crate_inherent_impls, r=Mark-Simulacrum
kennytm [Tue, 13 Nov 2018 05:03:20 +0000 (13:03 +0800)]
Rollup merge of #55882 - hugwijst:rc_return_crate_inherent_impls, r=Mark-Simulacrum

Reference count `crate_inherent_impls`s return value.

The repeated cloning of the result in `inherent_impls` queries has quite
an impact on crates with many inherent trait implementations.

For instance on https://github.com/jmesmon/stm32f429, `cargo check` went from 75 seconds to 38 seconds on my machine.

5 years agoRollup merge of #55879 - Xanewok:dont-panic-with-globs, r=nrc
kennytm [Tue, 13 Nov 2018 05:03:18 +0000 (13:03 +0800)]
Rollup merge of #55879 - Xanewok:dont-panic-with-globs, r=nrc

save-analysis: Don't panic for macro-generated use globs

Follow-up to https://github.com/rust-lang/rust/commit/c2bb7cadf24e82b80f403c09e800fe5fad504caf - as before, ignore the use globs in macro expansions.

Fixes https://github.com/rust-lang-nursery/rls/issues/1117.
Closes #55480.

r? @nrc

5 years agoRollup merge of #55874 - denisvasilik:docs, r=alexcrichton
kennytm [Tue, 13 Nov 2018 05:03:17 +0000 (13:03 +0800)]
Rollup merge of #55874 - denisvasilik:docs, r=alexcrichton

string: Add documentation for `From` impls

Hi this is part of #51430. I'm a first time contributor, so I started with a small task adding a bit of documentation for From impls.

5 years agoRollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiser
kennytm [Tue, 13 Nov 2018 05:03:16 +0000 (13:03 +0800)]
Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiser

Fix typos.

5 years agoRollup merge of #55863 - dwijnand:patch-1, r=bluss
kennytm [Tue, 13 Nov 2018 05:03:15 +0000 (13:03 +0800)]
Rollup merge of #55863 - dwijnand:patch-1, r=bluss

Fix a typo in std::panic

5 years agoRollup merge of #55858 - GuillaumeGomez:fixes-rustdoc-codeblocks, r=QuietMisdreavus
kennytm [Tue, 13 Nov 2018 05:03:14 +0000 (13:03 +0800)]
Rollup merge of #55858 - GuillaumeGomez:fixes-rustdoc-codeblocks, r=QuietMisdreavus

Small fixes on code blocks in rustdoc

It currently has a little margin issue with the `i` and there were js errors.

r? @QuietMisdreavus

5 years agoRollup merge of #55843 - Axary:master, r=sfackler
kennytm [Tue, 13 Nov 2018 05:03:12 +0000 (13:03 +0800)]
Rollup merge of #55843 - Axary:master, r=sfackler

add FromIterator<A> to Box<[A]>

5 years agoRollup merge of #55840 - dlrobertson:fix_stage0_download, r=alexcrichton
kennytm [Tue, 13 Nov 2018 05:03:11 +0000 (13:03 +0800)]
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.

5 years agoRollup merge of #55837 - Centril:spökdata-skall-vara-strukturellt-matchbar, r=eddyb
kennytm [Tue, 13 Nov 2018 05:03:10 +0000 (13:03 +0800)]
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

5 years agoRollup merge of #55805 - nnethercote:mv-static_assert, r=Mark-Simulacrum
kennytm [Tue, 13 Nov 2018 05:03:09 +0000 (13:03 +0800)]
Rollup merge of #55805 - nnethercote:mv-static_assert, r=Mark-Simulacrum

Move `static_assert!` into librustc_data_structures

5 years agoRollup merge of #55804 - QuietMisdreavus:eager-crate-inline, r=pnkfelix
kennytm [Tue, 13 Nov 2018 05:03:08 +0000 (13:03 +0800)]
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.

5 years agoRollup merge of #55754 - spastorino:fix-process-output-docs, r=alexcrichton
kennytm [Tue, 13 Nov 2018 05:03:05 +0000 (13:03 +0800)]
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

5 years agoRollup merge of #55711 - kngwyu:btreemap-rangemut-doc, r=Mark-Simulacrum
kennytm [Tue, 13 Nov 2018 05:03:04 +0000 (13:03 +0800)]
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)

5 years agoAuto merge of #55589 - oli-obk:min_length_💣, r=pnkfelix
bors [Tue, 13 Nov 2018 07:04:14 +0000 (07:04 +0000)]
Auto merge of #55589 - oli-obk:min_length_💣, r=pnkfelix

Add `VariantIdx` type and use instead of `usize`

5 years agoFix their/there grammar nit
KWierso [Tue, 13 Nov 2018 02:21:52 +0000 (18:21 -0800)]
Fix their/there grammar nit

5 years agoAuto merge of #55052 - newpavlov:patch-2, r=alexcrichton
bors [Tue, 13 Nov 2018 01:08:13 +0000 (01:08 +0000)]
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.

5 years agoMove two `static_assert!`s to better spots.
Nicholas Nethercote [Mon, 12 Nov 2018 19:34:11 +0000 (06:34 +1100)]
Move two `static_assert!`s to better spots.

And make them x86_64-only so they can use `==` instead of `<=`.

5 years agoAdd a static assertion about the size of `ast::Expr`.
Nicholas Nethercote [Thu, 8 Nov 2018 23:10:46 +0000 (10:10 +1100)]
Add a static assertion about the size of `ast::Expr`.

5 years agoMove a `static_assert!` to a better spot.
Nicholas Nethercote [Thu, 8 Nov 2018 23:19:51 +0000 (10:19 +1100)]
Move a `static_assert!` to a better spot.

And make it x86_64-only so it can use `==` instead of `<=`.

5 years agoMove `static_assert!` into librustc_data_structures.
Nicholas Nethercote [Thu, 8 Nov 2018 22:57:02 +0000 (09:57 +1100)]
Move `static_assert!` into librustc_data_structures.

This means it can be used by more crates.

5 years agoAuto merge of #55278 - Centril:constification-1, r=alexcrichton
bors [Mon, 12 Nov 2018 18:54:11 +0000 (18:54 +0000)]
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}`

5 years agoDeduplicate field and variant visitor methods
Oliver Scherer [Thu, 8 Nov 2018 16:06:27 +0000 (17:06 +0100)]
Deduplicate field and variant visitor methods

5 years agomiri-engine value visitor update to VariantIdx
Oliver Scherer [Wed, 7 Nov 2018 15:45:07 +0000 (16:45 +0100)]
miri-engine value visitor update to VariantIdx

5 years agoUse type safe `VariantIdx` instead of `usize` everywhere
Oliver Scherer [Thu, 1 Nov 2018 18:03:38 +0000 (19:03 +0100)]
Use type safe `VariantIdx` instead of `usize` everywhere

5 years agoUse IndexVec instead of `usize` in librustc
Oliver Scherer [Thu, 1 Nov 2018 15:01:24 +0000 (16:01 +0100)]
Use IndexVec instead of `usize` in librustc

5 years agoShrink some internal enums
Oliver Scherer [Thu, 1 Nov 2018 12:30:04 +0000 (13:30 +0100)]
Shrink some internal enums

5 years agoMerge an assert + cast into a `try_into` call
Oliver Scherer [Wed, 31 Oct 2018 10:06:38 +0000 (11:06 +0100)]
Merge an assert + cast into a `try_into` call

5 years agoDocument optimizations enabled by FusedIterator
Simon Sapin [Mon, 12 Nov 2018 11:22:33 +0000 (12:22 +0100)]
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?

5 years agoremove unused import
Ralf Jung [Mon, 12 Nov 2018 08:11:29 +0000 (09:11 +0100)]
remove unused import

5 years agoAuto merge of #55604 - nnethercote:avoid-associated_items-Box, r=nnethercote
bors [Mon, 12 Nov 2018 08:03:58 +0000 (08:03 +0000)]
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

5 years agoglobal allocators: add a few comments
Ralf Jung [Mon, 12 Nov 2018 08:00:39 +0000 (09:00 +0100)]
global allocators: add a few comments

5 years agofor uniformity, also move memory_deallocated to AllocationExtra
Ralf Jung [Mon, 12 Nov 2018 07:39:13 +0000 (08:39 +0100)]
for uniformity, also move memory_deallocated to AllocationExtra

5 years agoAvoid the Box in `TyCtxt::associated_items`.
Niko Matsakis [Mon, 5 Nov 2018 05:18:23 +0000 (16:18 +1100)]
Avoid the Box in `TyCtxt::associated_items`.

This reduces instruction counts on packed_simd by 2%.

5 years agoChange `Lit::short_name` to `Lit::literal_name`.
Nicholas Nethercote [Mon, 12 Nov 2018 03:38:44 +0000 (14:38 +1100)]
Change `Lit::short_name` to `Lit::literal_name`.

This avoids a moderately hot allocation in `parse_lit_token`.

5 years agoAuto merge of #55701 - tromey:ice-fix, r=matthewjasper
bors [Mon, 12 Nov 2018 04:12:26 +0000 (04:12 +0000)]
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

5 years agoFix TLS errors when downloading stage0
Dan Robertson [Mon, 12 Nov 2018 10:32:21 +0000 (02:32 -0800)]
Fix TLS errors when downloading stage0

5 years agoReference count `crate_inherent_impls`s return value.
Hugo van der Wijst [Mon, 12 Nov 2018 00:25:00 +0000 (16:25 -0800)]
Reference count `crate_inherent_impls`s return value.

The repeated cloning of the result in `inherent_impls` queries has quite
an impact on crates with many inherent trait implementations.

5 years agoAuto merge of #55525 - nnethercote:MatcherPos-stack-SmallVec, r=nnethercote
bors [Mon, 12 Nov 2018 01:20:33 +0000 (01:20 +0000)]
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?

5 years agoMake `MatcherPos::stack` a `SmallVec`.
Niko Matsakis [Sun, 11 Nov 2018 22:18:57 +0000 (09:18 +1100)]
Make `MatcherPos::stack` a `SmallVec`.

This avoids some allocations.

5 years agoAuto merge of #55698 - nikic:remove-llvm-4-support, r=alexcrichton
bors [Sun, 11 Nov 2018 22:38:54 +0000 (22:38 +0000)]
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.

5 years agosave-analysis: Don't panic for macro-generated use globs
Igor Matuszewski [Sun, 11 Nov 2018 20:05:09 +0000 (21:05 +0100)]
save-analysis: Don't panic for macro-generated use globs

Follow-up to
https://github.com/rust-lang/rust/commit/c2bb7cadf24e82b80f403c09e800fe5fad504caf.

5 years agoAuto merge of #55660 - alexcrichton:cleanup-alloc-system, r=dtolnay,SimonSapin
bors [Sun, 11 Nov 2018 19:51:56 +0000 (19:51 +0000)]
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.

5 years agoMinor style guide corrections.
Denis Vasilik [Sun, 11 Nov 2018 19:11:25 +0000 (20:11 +0100)]
Minor style guide corrections.

5 years agostd: Delete the `alloc_system` crate
Alex Crichton [Sat, 3 Nov 2018 18:15:48 +0000 (11:15 -0700)]
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.

5 years agorustc: Clean up allocator injection logic
Alex Crichton [Sat, 3 Nov 2018 17:51:31 +0000 (10:51 -0700)]
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.

5 years agoAuto merge of #55657 - davidtwco:issue-55651, r=pnkfelix
bors [Sun, 11 Nov 2018 17:05:36 +0000 (17:05 +0000)]
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

5 years agoWhitespace cleanup according to Rust's style guidelines.
Denis Vasilik [Sun, 11 Nov 2018 15:58:00 +0000 (16:58 +0100)]
Whitespace cleanup according to Rust's style guidelines.

5 years agoAdded comments for trait implementations.
Denis Vasilik [Sun, 11 Nov 2018 14:08:28 +0000 (15:08 +0100)]
Added comments for trait implementations.

5 years agoAdded comment for From trait implementation: boxed string slice to String
Denis Vasilik [Sat, 10 Nov 2018 09:23:11 +0000 (10:23 +0100)]
Added comment for From trait implementation: boxed string slice to String

5 years agoAuto merge of #55674 - oli-obk:miri_engine_refactoring, r=RalfJung
bors [Sun, 11 Nov 2018 14:24:39 +0000 (14:24 +0000)]
Auto merge of #55674 - oli-obk:miri_engine_refactoring, r=RalfJung

Miri engine refactoring

r? @RalfJung

split out the "just moves stuff around" part of https://github.com/rust-lang/rust/pull/55293

5 years agoFix typos.
Bruce Mitchener [Sun, 11 Nov 2018 13:52:36 +0000 (20:52 +0700)]
Fix typos.

5 years agochange attribute to stable
Axary [Sun, 11 Nov 2018 09:45:16 +0000 (10:45 +0100)]
change attribute to stable

5 years agoMerge branch 'master' of https://github.com/rust-lang/rust
Axary [Sun, 11 Nov 2018 09:41:49 +0000 (10:41 +0100)]
Merge branch 'master' of https://github.com/rust-lang/rust

5 years agoFix a typo in std::panic
Dale Wijnand [Sun, 11 Nov 2018 07:36:10 +0000 (07:36 +0000)]
Fix a typo in std::panic

5 years agoAuto merge of #55859 - pietroalbini:rollup, r=kennytm
bors [Sun, 11 Nov 2018 06:26:21 +0000 (06:26 +0000)]
Auto merge of #55859 - pietroalbini:rollup, r=kennytm

Rollup of 17 pull requests

Successful merges:

 - #55630 (resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition)
 - #55687 (Take supertraits into account when calculating associated types)
 - #55745 (Convert `outlives_components`' return value to a `SmallVec` outparam.)
 - #55764 (Fix Rc/Arc allocation layout)
 - #55792 (Prevent ICE in const-prop array oob check)
 - #55799 (Removed unneeded instance of `// revisions` from a lint test)
 - #55800 (Fix ICE in `return_type_impl_trait`)
 - #55801 (NLL: Update box insensitivity test)
 - #55802 (Don't inline virtual calls (take 2))
 - #55816 (Use `SmallVec` to avoid allocations in `from_decimal_string`.)
 - #55819 (Typecheck patterns of all match arms first, so we get types for bindings)
 - #55822 (ICE with #![feature(nll)] and elided lifetimes)
 - #55828 (Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`)
 - #55839 (Fix docstring spelling mistakes)
 - #55844 (Fix documentation typos.)
 - #55845 (Set BINARYEN_TRAP_MODE=clamp)
 - #55856 (rustdoc: refactor: move all static-file include!s into a single module)

5 years agoRollup merge of #55856 - QuietMisdreavus:static-discharge, r=GuillaumeGomez
kennytm [Sun, 11 Nov 2018 04:34:23 +0000 (12:34 +0800)]
Rollup merge of #55856 - QuietMisdreavus:static-discharge, r=GuillaumeGomez

rustdoc: refactor: move all static-file include!s into a single module

This is a smaller refactor that creates a new module `rustdoc::html::static_files`, which contains a bunch of `static` variables with all the files in `html/static` that we use. The idea behind moving them all here was to remove the duplicate `include_bytes!()` that are used by the theme-checker code. It also continues to centralize more operations in rustdoc.

5 years agoRollup merge of #55845 - nikic:emscripten-clamp-mode, r=alexcrichton
kennytm [Sun, 11 Nov 2018 04:33:50 +0000 (12:33 +0800)]
Rollup merge of #55845 - nikic:emscripten-clamp-mode, r=alexcrichton

Set BINARYEN_TRAP_MODE=clamp

This fixes the wasm32-unknown-emscripten test failure mentioned in https://github.com/rust-lang/rust/pull/55626#issuecomment-437084774, by making binaryen operate in clamp rather than trap mode.

The issue is that the current `-Zsaturating-float-casts` implementation uses `fpto[us]i` unconditionally (and selects afterwards), which does not work with trapping implementations of fpto[su]i, which emscripten uses by default.

I've left a FIXME to drop this flag once we have a better solution for saturating casts on the LLVM side.
;

5 years agoRollup merge of #55630 - petrochenkov:noprelude, r=Centril
kennytm [Sun, 11 Nov 2018 04:32:01 +0000 (12:32 +0800)]
Rollup merge of #55630 - petrochenkov:noprelude, r=Centril

resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` on 2018 edition

This is a tiny thing.
For historical reasons macro prelude (macros from `#[macro_use] extern crate ...`, including `extern crate std`) is still available in modules with `#[no_implicit_prelude]`.
This PR provides proper isolation and removes those names from scope.

`#[no_implicit_prelude]` modules still have built-in types (`u8`), built-in attributes (`#[inline]`) and built-in macros (`env!("PATH")`) in scope. We can introduce some `#[no_implicit_prelude_at_all]` to remove those as well, but that's a separate issue.

The change is done only on 2018 edition for backward compatibility.
I'm pretty sure this can be done on 2015 as well because `#[no_implicit_prelude]` is rarely used, but I don't want to go through the crater/deprecation process right now, maybe later.

cc https://github.com/rust-lang/rust/issues/53977
r? @ghost

5 years agoAuto merge of #54993 - TimNN:pda-tdl, r=eddyb
bors [Sun, 11 Nov 2018 03:44:16 +0000 (03:44 +0000)]
Auto merge of #54993 - TimNN:pda-tdl, r=eddyb

Support for the program data address space option of LLVM's Target Datalayout

This was introduced recently (specifically, for AVR, cc @dylanmckay).

(I came up with this when attempting to run [avr-rust](https://github.com/avr-rust/rust) rebased on the latest [rust-lang](https://github.com/rust-lang/rust) commits. If this requires a different design, some additional discussions, or is not something to pursue right now, I'd be happy to close this PR).

Note that this somewhat overlaps with @DiamondLovesYou's #51576, I think, although the implementation here is significantly simpler: Since the address space applies to _all_ program data, we can just check the pointee's type whenever we create an LLVM pointer type. If it is a function we use the program data address space; if not we use the default address space.

cc @eddyb, who has been reviewing #51576

Ref: https://llvm.org/docs/LangRef.html#data-layout

5 years agoRollup merge of #55844 - waywardmonkeys:typo-fixes, r=varkor
Pietro Albini [Sat, 10 Nov 2018 23:21:25 +0000 (00:21 +0100)]
Rollup merge of #55844 - waywardmonkeys:typo-fixes, r=varkor

Fix documentation typos.

5 years agoRollup merge of #55839 - dralley:docstring-spelling, r=TimNN
Pietro Albini [Sat, 10 Nov 2018 23:21:24 +0000 (00:21 +0100)]
Rollup merge of #55839 - dralley:docstring-spelling, r=TimNN

Fix docstring spelling mistakes

5 years agoRollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb
Pietro Albini [Sat, 10 Nov 2018 23:21:23 +0000 (00:21 +0100)]
Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb

Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`

cc @pnkfelix

fixes #55806

5 years agoRollup merge of #55822 - davidtwco:issue-55394, r=pnkfelix
Pietro Albini [Sat, 10 Nov 2018 23:21:22 +0000 (00:21 +0100)]
Rollup merge of #55822 - davidtwco:issue-55394, r=pnkfelix

ICE with #![feature(nll)] and elided lifetimes

Fixes #55394.

This commit fixes an ICE and determines the correct return span in cases
with a method implemented on a struct with an an elided lifetime.

r? @pnkfelix

5 years agoRollup merge of #55819 - pnkfelix:issue-55810-must-typeck-pats-eagerly, r=oli-obk
Pietro Albini [Sat, 10 Nov 2018 23:21:21 +0000 (00:21 +0100)]
Rollup merge of #55819 - pnkfelix:issue-55810-must-typeck-pats-eagerly, r=oli-obk

Typecheck patterns of all match arms first, so we get types for bindings

Fix eventually (after backport to beta) the issue #55810

5 years agoRollup merge of #55816 - nnethercote:from_decimal_string-SmallVec, r=oli-obk
Pietro Albini [Sat, 10 Nov 2018 23:21:20 +0000 (00:21 +0100)]
Rollup merge of #55816 - nnethercote:from_decimal_string-SmallVec, r=oli-obk

Use `SmallVec` to avoid allocations in `from_decimal_string`.

This reduces the number of allocations in a "check clean" build of
`tuple-stress` by 14%, reducing instruction counts by 0.6%.

5 years agoRollup merge of #55802 - wesleywiser:inlined_calls_2_electric_boogaloo, r=nagisa
Pietro Albini [Sat, 10 Nov 2018 23:21:19 +0000 (00:21 +0100)]
Rollup merge of #55802 - wesleywiser:inlined_calls_2_electric_boogaloo, r=nagisa

Don't inline virtual calls (take 2)

When I fixed the previous mis-optimizations, I didn't realize there were
actually two different places where we mutate `callsites` and both of
them should have the same behavior.

As a result, if a function was inlined and that function contained
virtual function calls, they were incorrectly being inlined. I also
added a test case which covers this.

5 years agoRollup merge of #55801 - pnkfelix:update-box-insensitivity-test-for-nll, r=davidtwco
Pietro Albini [Sat, 10 Nov 2018 23:21:17 +0000 (00:21 +0100)]
Rollup merge of #55801 - pnkfelix:update-box-insensitivity-test-for-nll, r=davidtwco

NLL: Update box insensitivity test

This is just keeping one of our tests honest with respect to NLL, in two ways:

 1. Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see...
 2. ... I say "would have expected" because all of the errors in this file are part of the reversion of rust-lang/rfcs#130 that is attached to NLL (you can see more discussion of this here https://github.com/rust-lang/rust/issues/43234#issuecomment-411017768 )

5 years agoRollup merge of #55800 - estebank:abolish-ice-for-lifetime, r=oli-obk
Pietro Albini [Sat, 10 Nov 2018 23:21:16 +0000 (00:21 +0100)]
Rollup merge of #55800 - estebank:abolish-ice-for-lifetime, r=oli-obk

Fix ICE in `return_type_impl_trait`

Fix #55796.

5 years agoRollup merge of #55799 - pnkfelix:remove-useless-revisions-marker-from-lint-unused...
Pietro Albini [Sat, 10 Nov 2018 23:21:15 +0000 (00:21 +0100)]
Rollup merge of #55799 - pnkfelix:remove-useless-revisions-marker-from-lint-unused-mut-variables, r=davidtwco

Removed unneeded instance of `// revisions` from a lint test

Removed an unneeded instance of `// revisions`; the compare-mode=nll shows the output is identical now.

cc #54528

5 years agoRollup merge of #55792 - oli-obk:propsicle, r=RalfJung
Pietro Albini [Sat, 10 Nov 2018 23:21:14 +0000 (00:21 +0100)]
Rollup merge of #55792 - oli-obk:propsicle, r=RalfJung

Prevent ICE in const-prop array oob check

fixes https://github.com/rust-lang/rust/issues/55772
fixes https://github.com/rust-lang/rust/issues/54541

5 years agoRollup merge of #55764 - murarth:fix-rc-alloc, r=RalfJung
Pietro Albini [Sat, 10 Nov 2018 23:21:13 +0000 (00:21 +0100)]
Rollup merge of #55764 - murarth:fix-rc-alloc, r=RalfJung

Fix Rc/Arc allocation layout

* Rounds allocation layout up to a multiple of alignment
* Adds a convenience method `Layout::pad_to_align` to perform rounding

Closes #55747

cc #55724

5 years agoRollup merge of #55745 - nnethercote:outlives_components-SmallVec, r=matthewjasper
Pietro Albini [Sat, 10 Nov 2018 23:21:12 +0000 (00:21 +0100)]
Rollup merge of #55745 - nnethercote:outlives_components-SmallVec, r=matthewjasper

Convert `outlives_components`' return value to a `SmallVec` outparam.

This avoids some allocations, reducing instruction counts by 1% on a
couple of benchmarks.

5 years agoRollup merge of #55687 - alexreg:fix-24010, r=scalexm
Pietro Albini [Sat, 10 Nov 2018 23:21:11 +0000 (00:21 +0100)]
Rollup merge of #55687 - alexreg:fix-24010, r=scalexm

Take supertraits into account when calculating associated types

Fixes #24010 and #23856. Applies to trait aliases too.

As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See #50589 for more info.

I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+.

N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this.

CC @carllerche @theemathas @durka @mbrubeck

5 years agoAuto merge of #54864 - ljedrz:cleanup_codegen_llvm_back, r=Mark-Simulacrum
bors [Sat, 10 Nov 2018 23:16:25 +0000 (23:16 +0000)]
Auto merge of #54864 - ljedrz:cleanup_codegen_llvm_back, r=Mark-Simulacrum

Cleanup codegen_llvm/back

- improve allocations
- use `Cow<'static, str>` where applicable
- use `to_owned` instead of `to_string` with string literals
- remove a redundant `continue`
- possible minor speedup in logic
- use `mem::replace` instead of `swap` where more concise
- remove `'static` from consts
- improve common patterns
- remove explicit `return`s
- whitespace & formatting fixes

5 years agomove all static-file include!s into a single module
QuietMisdreavus [Sat, 10 Nov 2018 22:05:29 +0000 (16:05 -0600)]
move all static-file include!s into a single module