]> git.lizzy.rs Git - rust.git/log
rust.git
5 years agoRollup merge of #60685 - dtolnay:spdx, r=nikomatsakis
Mazdak Farrokhzad [Fri, 17 May 2019 00:54:11 +0000 (02:54 +0200)]
Rollup merge of #60685 - dtolnay:spdx, r=nikomatsakis

Switch to SPDX 2.1 license expression

[According to the Cargo Reference:](https://doc.rust-lang.org/cargo/reference/manifest.html)

> This is an SPDX 2.1 license expression for this package. Currently crates.io will validate the license provided against a whitelist of known license and exception identifiers from the SPDX license list 2.4. Parentheses are not currently supported.
>
> Multiple licenses can be separated with a \`/\`, although that usage is deprecated. Instead, use a license expression with AND and OR operators to get more explicit semantics.

The notation with slashes is deprecated in favor of explicit AND or OR.

As I understand it, Rust's license is MIT *OR* Apache-2.0 matching the meaning of *OR* defined by [SPDX Specification 2.1](https://spdx.org/spdx-specification-21-web-version):

> If presented with a choice between two or more licenses, use the disjunctive binary "OR" operator to construct a new license expression, where both the left and right operands are valid license expression values.

5 years agoAuto merge of #60888 - Manishearth:rollup-oihtoyq, r=Manishearth
bors [Thu, 16 May 2019 21:54:53 +0000 (21:54 +0000)]
Auto merge of #60888 - Manishearth:rollup-oihtoyq, r=Manishearth

Rollup of 5 pull requests

Successful merges:

 - #60207 (Outdent example, preserving nested fence)
 - #60278 (Document the `html_root_url` doc attribute value.)
 - #60597 (Do some simple constant propagation in the ConstProp pass)
 - #60837 (Update release notes for 1.35.0)
 - #60887 (Update clippy)

Failed merges:

r? @ghost

5 years agoRollup merge of #60887 - Manishearth:clippyup, r=Manishearth
Manish Goregaokar [Thu, 16 May 2019 19:31:49 +0000 (12:31 -0700)]
Rollup merge of #60887 - Manishearth:clippyup, r=Manishearth

Update clippy

r? @ghost

5 years agoRollup merge of #60837 - jonas-schievink:releases-1.35.0, r=pietroalbini
Manish Goregaokar [Thu, 16 May 2019 19:31:47 +0000 (12:31 -0700)]
Rollup merge of #60837 - jonas-schievink:releases-1.35.0, r=pietroalbini

Update release notes for 1.35.0

(Applied remaining nit, rebased onto master, and added CVE link to the 1.34.2 release notes, as discussed in the release team meeting)

r? @pietroalbini

5 years agoRollup merge of #60597 - wesleywiser:const_prop, r=oli-obk
Manish Goregaokar [Thu, 16 May 2019 19:31:46 +0000 (12:31 -0700)]
Rollup merge of #60597 - wesleywiser:const_prop, r=oli-obk

Do some simple constant propagation in the ConstProp pass

r? @oli-obk

I added a few test cases. Let me know if you think there should be more.

5 years agoRollup merge of #60278 - ehuss:doc-html_root_url, r=GuillaumeGomez
Manish Goregaokar [Thu, 16 May 2019 19:31:44 +0000 (12:31 -0700)]
Rollup merge of #60278 - ehuss:doc-html_root_url, r=GuillaumeGomez

Document the `html_root_url` doc attribute value.

I'm not sure if this was intentionally not documented, but I think it would be good to include. This was added in #9691.  `--extern-html-root-url` is unstable, but I don't think it hurts to mention it.

5 years agoRollup merge of #60207 - felixrabe:patch-1, r=steveklabnik
Manish Goregaokar [Thu, 16 May 2019 19:31:43 +0000 (12:31 -0700)]
Rollup merge of #60207 - felixrabe:patch-1, r=steveklabnik

Outdent example, preserving nested fence

5 years agoUpdate clippy
Manish Goregaokar [Thu, 16 May 2019 19:11:32 +0000 (12:11 -0700)]
Update clippy

5 years agoAuto merge of #60874 - ehuss:update-cargo, r=alexcrichton
bors [Thu, 16 May 2019 18:57:00 +0000 (18:57 +0000)]
Auto merge of #60874 - ehuss:update-cargo, r=alexcrichton

Update cargo

17 commits in 759b6161a328db1d4863139e90875308ecd25a75..c4fcfb725b4be00c72eb9cf30c7d8b095577c280
2019-05-06 20:47:49 +0000 to 2019-05-15 19:48:47 +0000
- tests: registry: revert readonly permission after running tests. (rust-lang/cargo#6947)
- Remove Candidate (rust-lang/cargo#6946)
- Fix for "Running cargo update without a Cargo.lock ignores arguments" rust-lang/cargo#6872 (rust-lang/cargo#6904)
- Fix a minor mistake in the changelog. (rust-lang/cargo#6944)
- Give a better error message when crates.io requests time out (rust-lang/cargo#6936)
- Re-enable compatibility with readonly CARGO_HOME (rust-lang/cargo#6940)
- Fix version of `ignore`. (rust-lang/cargo#6938)
- Stabilize offline mode. (rust-lang/cargo#6934)
- zsh: Add doc options to include non-public items documentation (rust-lang/cargo#6929)
- zsh: Suggest --lib option as binary template now the default (rust-lang/cargo#6926)
- Migrate package include/exclude to gitignore patterns. (rust-lang/cargo#6924)
- Implement the Cargo half of pipelined compilation (take 2) (rust-lang/cargo#6883)
- Always include `Cargo.toml` when packaging. (rust-lang/cargo#6925)
- Remove unnecessary calls to masquerade_as_nightly_cargo. (rust-lang/cargo#6923)
- download: fix "Downloaded 1 crates" message (crates -> crate) (rust-lang/cargo#6920)
- Changed RUST_LOG usage to CARGO_LOG to avoid confusion. (rust-lang/cargo#6918)
- crate download: don't print that a crate was the largest download if it was the only download (rust-lang/cargo#6916)

5 years agoUpdate cargo
Eric Huss [Thu, 16 May 2019 05:27:39 +0000 (22:27 -0700)]
Update cargo

5 years agoAuto merge of #60877 - Centril:rollup-j0o5mo5, r=Centril
bors [Thu, 16 May 2019 09:58:30 +0000 (09:58 +0000)]
Auto merge of #60877 - Centril:rollup-j0o5mo5, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #59825 (string: implement From<&String> for String)
 - #59923 (Fix convert module's documentation links)
 - #60691 (Include expression to wait for to the span of Await)
 - #60769 (Update rustc book CLI docs.)
 - #60816 (README.md: Mention MSVC 2017+, not 2013(!))
 - #60851 (Move `box` from the stable keyword to unstable keywords list)

Failed merges:

r? @ghost

5 years agoRollup merge of #60851 - Pulkit07:issue60849, r=Centril
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:35 +0000 (10:43 +0200)]
Rollup merge of #60851 - Pulkit07:issue60849, r=Centril

Move `box` from the stable keyword to unstable keywords list

Fixes #60849

5 years agoRollup merge of #60816 - scottmcm:vcpp-download-link, r=alexcrichton
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:34 +0000 (10:43 +0200)]
Rollup merge of #60816 - scottmcm:vcpp-download-link, r=alexcrichton

README.md: Mention MSVC 2017+, not 2013(!)

LLVM will soon require 2017+ (and our in-tree version just rejected the version of 2015 I was using), so update the mention and provide a link.

Ref: https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library

5 years agoRollup merge of #60769 - ehuss:rustc-cli-docs, r=steveklabnik
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:33 +0000 (10:43 +0200)]
Rollup merge of #60769 - ehuss:rustc-cli-docs, r=steveklabnik

Update rustc book CLI docs.

This adds a little detail (and missing flags) to the rustc book. There is still a lot of information missing, but this seemed like a good step to expanding it.

5 years agoRollup merge of #60691 - topecongiro:await-macro-span, r=Centril
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:30 +0000 (10:43 +0200)]
Rollup merge of #60691 - topecongiro:await-macro-span, r=Centril

Include expression to wait for to the span of Await

Currently the span of `await!` only includes itself:

```rust
    await!(3);
//  ^^^^^
```

This PR changes it so that the span holds the whole `await!` expression:

```rust
    await!(3);
//  ^^^^^^^^^

5 years agoRollup merge of #59923 - czipperz:fix-convert-doc-links, r=steveklabnik
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:28 +0000 (10:43 +0200)]
Rollup merge of #59923 - czipperz:fix-convert-doc-links, r=steveklabnik

Fix convert module's documentation links

r? @steveklabnik

5 years agoRollup merge of #59825 - jsgf:from-ref-string, r=sfackler
Mazdak Farrokhzad [Thu, 16 May 2019 08:43:24 +0000 (10:43 +0200)]
Rollup merge of #59825 - jsgf:from-ref-string, r=sfackler

string: implement From<&String> for String

Allow Strings to be created from borrowed Strings. This is mostly
to make things like passing `&String` to an `impl Into<String>`
parameter frictionless.

Fixes #59827.

5 years agoAuto merge of #60811 - wesleywiser:bump_measureme, r=varkor
bors [Thu, 16 May 2019 07:04:03 +0000 (07:04 +0000)]
Auto merge of #60811 - wesleywiser:bump_measureme, r=varkor

Bump measureme dependency to 0.3

measureme@0.3 adds a version header to the binary file format which will
help reduce tool breakage in the future.

5 years agoAuto merge of #60763 - matklad:tt-parser, r=petrochenkov
bors [Thu, 16 May 2019 04:15:12 +0000 (04:15 +0000)]
Auto merge of #60763 - matklad:tt-parser, r=petrochenkov

Move token tree related lexer state to a separate struct

Just a types-based refactoring.

We only used a bunch of fields when tokenizing into a token tree, so let's move them out of the base lexer

5 years agoAuto merge of #60693 - saleemjaffer:refactor_fntype_stuff, r=eddyb
bors [Thu, 16 May 2019 01:26:13 +0000 (01:26 +0000)]
Auto merge of #60693 - saleemjaffer:refactor_fntype_stuff, r=eddyb

refactor some `FnType` stuff to `rustc::ty::layout`

Does work in the direction of #56166.

5 years agoMove `box` from the stable keyword to unstable keywords list
Pulkit Goyal [Wed, 15 May 2019 13:22:39 +0000 (16:22 +0300)]
Move `box` from the stable keyword to unstable keywords list

Fixes #60849

5 years agoAuto merge of #60832 - petrochenkov:CLazy, r=Mark-Simulacrum
bors [Wed, 15 May 2019 12:10:13 +0000 (12:10 +0000)]
Auto merge of #60832 - petrochenkov:CLazy, r=Mark-Simulacrum

CMake: Do not print installation messages for up-to-date files

Closes https://github.com/rust-lang/rust/issues/60830

5 years agoAdd test to ensure const-prop fails gracefully
Wesley Wiser [Wed, 15 May 2019 10:06:33 +0000 (06:06 -0400)]
Add test to ensure const-prop fails gracefully

5 years agoRun const propagation at O2
Wesley Wiser [Wed, 8 May 2019 10:42:41 +0000 (06:42 -0400)]
Run const propagation at O2

5 years agoAdd some tests for constant propagation
Wesley Wiser [Sat, 4 May 2019 01:58:16 +0000 (21:58 -0400)]
Add some tests for constant propagation

The results aren't ideal but they represent the current state.

5 years agoDo some simple constant propagation in the ConstProp pass
Wesley Wiser [Mon, 29 Apr 2019 01:58:40 +0000 (21:58 -0400)]
Do some simple constant propagation in the ConstProp pass

5 years agoAuto merge of #60831 - alexcrichton:update-llvm-project, r=nikic
bors [Wed, 15 May 2019 07:23:21 +0000 (07:23 +0000)]
Auto merge of #60831 - alexcrichton:update-llvm-project, r=nikic

Update LLVM to fix assertion when compiling to wasm

More details can be found in #60540!

Closes #60540

5 years agoAuto merge of #60775 - hellow554:no_bitrig, r=joshtriplett
bors [Wed, 15 May 2019 04:34:14 +0000 (04:34 +0000)]
Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplett

Remove bitrig support from rust

Resolves #60743

using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?).

There's also this file https://github.com/rust-lang/rls/blob/5b8e99bb61958ca8abcb7c5eda70521726be1065/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?

5 years agorustbuild/LLVM: Do not print installation messages for up-to-date files
Vadim Petrochenkov [Tue, 14 May 2019 18:33:22 +0000 (21:33 +0300)]
rustbuild/LLVM: Do not print installation messages for up-to-date files

5 years agoAuto merge of #60834 - Centril:rollup-fikyi9i, r=Centril
bors [Tue, 14 May 2019 20:50:26 +0000 (20:50 +0000)]
Auto merge of #60834 - Centril:rollup-fikyi9i, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #60130 (Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators)
 - #60443 (as_ptr returns a read-only pointer)
 - #60444 (forego caching for all participants in cycles, apart from root node)
 - #60719 (Allow subdirectories to be tested by x.py test)
 - #60780 (fix Miri)
 - #60788 (default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets)
 - #60799 (Allow late-bound regions in existential types)
 - #60808 (Improve the "must use" lint for `Future`)
 - #60819 (submodules: update clippy from 3710ec59 to ad3269c4)

Failed merges:

r? @ghost

5 years agoAdd link to the 1.34.0 CVE
Jonas Schievink [Tue, 14 May 2019 20:32:50 +0000 (22:32 +0200)]
Add link to the 1.34.0 CVE

5 years agoUpdated RELEASES.md for 1.35.0
Aaron Power [Sat, 4 May 2019 14:42:06 +0000 (16:42 +0200)]
Updated RELEASES.md for 1.35.0

5 years agoRollup merge of #60819 - matthiaskrgr:submodule_upd, r=oli-obk
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:26 +0000 (22:00 +0200)]
Rollup merge of #60819 - matthiaskrgr:submodule_upd, r=oli-obk

submodules: update clippy from 3710ec59 to ad3269c4

Changes:
````
Rustfmt all the things
Clippy dogfood
Update for compiletest changes
Use symbols instead of strings
Rustup to rustc 1.36.0-nightly (1764b2972 2019-05-12)
Add regression test for identity_conversion FP
UI test cleanup: Extract many_single_char_names tests
Add tests for empty_loop lint
Add in_macro again
Rename in_macro to in_macro_or_desugar
````
r? @oli-obk

5 years agoRollup merge of #60808 - Schultzer:improve-must-use-linit-for-future, r=Centril
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:24 +0000 (22:00 +0200)]
Rollup merge of #60808 - Schultzer:improve-must-use-linit-for-future, r=Centril

Improve the "must use" lint for `Future`

Fixes #60797

5 years agoRollup merge of #60799 - matthewjasper:allow-bound-regions-in-existential-types,...
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:22 +0000 (22:00 +0200)]
Rollup merge of #60799 - matthewjasper:allow-bound-regions-in-existential-types, r=oli-obk

Allow late-bound regions in existential types

closes #60655
r? @oli-obk

5 years agoRollup merge of #60788 - froydnj:apple-target-modifications-followup, r=estebank
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:20 +0000 (22:00 +0200)]
Rollup merge of #60788 - froydnj:apple-target-modifications-followup, r=estebank

default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets

Over in #60378, we made `rustc` switch LLVM target triples dynamically
based on the `MACOSX_DEPLOYMENT_TARGET` environment variable.  This
change was made to align with `clang`'s behavior, and therefore make
cross-language LTO feasible on OS X.  Otherwise, `rustc` would produce
LLVM bitcode files with a target triple of `x86_64-apple-darwin`,
`clang` would produce LLVM bitcode files with a target triple of
`x86_64-apple-macosx$VERSION`, and the linker would complain.

This change worked fine, except for one corner case: if you didn't have
`MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust
code, you'd get warning messages similar to:

```
warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin'
```

This message occurs because libstd is compiled with
`MACOSX_DEPLOYMENT_TARGET` set to 10.7.  The LLVM bitcode distributed in
libstd's rlibs, then, is tagged with the target triple of
`x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for
"user" code is tagged with the target triple of `x86_64-apple-darwin`.

It's not good to have LTO on just Rust code (probably much more common
than cross-language LTO) warn by default.  These warnings also break
Cargo's testsuite.

This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was
set to 10.7.  "user" code will then be given a target triple that is
equivalent to the target triple libstd bitcode is already using.  The
above warning will therefore go away.

`rustc` already assumes that compiling without
`MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target
compatible with OS X 10.7 (e.g. that things like TLS work properly).  So
this change is really just making things conform more closely to the
status quo.

(It's also worth noting that before and after this patch, compiling with
`MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target
triples with an "apple" version ignore OS versions when checking
compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just
fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)

5 years agoRollup merge of #60780 - RalfJung:miri, r=oli-obk
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:19 +0000 (22:00 +0200)]
Rollup merge of #60780 - RalfJung:miri, r=oli-obk

fix Miri

This reverts https://github.com/rust-lang/rust/pull/60156, which turned out to be a dead end (see https://github.com/rust-lang/rust/pull/60469).

r? @oli-obk

5 years agoRollup merge of #60719 - varkor:xpy-test-folder, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:16 +0000 (22:00 +0200)]
Rollup merge of #60719 - varkor:xpy-test-folder, r=Mark-Simulacrum

Allow subdirectories to be tested by x.py test

Fixes https://github.com/rust-lang/rust/issues/60718.

As far as I can tell, multiple `--test-args` flags are ignored (only the first is respected), so if you specify a subdirectory, you won't also be able to filter using `--test-args`. If you don't specify a subdirectory, `--test-args` will continue working as usual, so this is strictly an improvement on the current state of affairs.

5 years agoRollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, r=pnkfelix
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:13 +0000 (22:00 +0200)]
Rollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, r=pnkfelix

forego caching for all participants in cycles, apart from root node

This is a targeted fix for #60010, which uncovered a pretty bad failure of our caching strategy in the face of coinductive cycles. The problem is explained in the comment in the PR on the new field, `in_cycle`, but I'll reproduce it here:

> Starts out as false -- if, during evaluation, we encounter a
> cycle, then we will set this flag to true for all participants
> in the cycle (apart from the "head" node). These participants
> will then forego caching their results. This is not the most
> efficient solution, but it addresses #60010. The problem we
> are trying to prevent:
>
> - If you have `A: AutoTrait` requires `B: AutoTrait` and `C: NonAutoTrait`
> - `B: AutoTrait` requires `A: AutoTrait` (coinductive cycle, ok)
> - `C: NonAutoTrait` requires `A: AutoTrait` (non-coinductive cycle, not ok)
>
> you don't want to cache that `B: AutoTrait` or `A: AutoTrait`
> is `EvaluatedToOk`; this is because they were only considered
> ok on the premise that if `A: AutoTrait` held, but we indeed
> encountered a problem (later on) with `A: AutoTrait. So we
> currently set a flag on the stack node for `B: AutoTrait` (as
> well as the second instance of `A: AutoTrait`) to supress
> caching.
>
> This is a simple, targeted fix. The correct fix requires
> deeper changes, but would permit more caching: we could
> basically defer caching until we have fully evaluated the
> tree, and then cache the entire tree at once.

I'm not sure what the impact of this fix will be in terms of existing crates or performance: we were accepting incorrect code before, so there will perhaps be some regressions, and we are now caching less.

As the comment above notes, we could do a lot better than this fix, but that would involve more invasive rewrites. I thought it best to start with something simple.

r? @pnkfelix -- but let's do crater/perf run
cc @arielb1

5 years agoRollup merge of #60443 - RalfJung:as_ptr, r=SimonSapin
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:11 +0000 (22:00 +0200)]
Rollup merge of #60443 - RalfJung:as_ptr, r=SimonSapin

as_ptr returns a read-only pointer

Add comments to `as_ptr` methods to warn that these are read-only pointers, and writing to them is UB.

[It was pointed out](https://internals.rust-lang.org/t/as-ptr-vs-as-mut-ptr/9940) that `CStr` does not even have an `as_mut_ptr`. I originally was going to add one, but there is no method at all that would mutate a `CStr`. Was that a deliberate choice or should I add an `as_mut_ptr` (similar to [what I did for `str`](https://github.com/rust-lang/rust/pull/58200))?

5 years agoRollup merge of #60130 - khuey:efficient_last, r=sfackler
Mazdak Farrokhzad [Tue, 14 May 2019 20:00:09 +0000 (22:00 +0200)]
Rollup merge of #60130 - khuey:efficient_last, r=sfackler

Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators

Provided a `DoubleEndedIterator` has finite length, `Iterator::last` is equivalent to `DoubleEndedIterator::next_back`. But searching forwards through the iterator when it's unnecessary is obviously not good for performance. I ran into this on one of the collection iterators.

I tried adding appropriate overloads for a bunch of the iterator adapters like filter, map, etc, but I ran into a lot of type inference failures after doing so.

The other interesting case is what to do with `Repeat`. Do we consider it part of the contract that `Iterator::last` will loop forever on it? The docs do say that the iterator will be evaluated until it returns None. This is also relevant for the adapters, it's trivially easy to observe whether a `Map` adapter invoked its closure a zillion times or just once for the last element.

5 years agoUpdate LLVM to fix assertion when compiling to wasm
Alex Crichton [Tue, 14 May 2019 17:55:55 +0000 (10:55 -0700)]
Update LLVM to fix assertion when compiling to wasm

More details can be found in #60540!

Closes #60540

5 years agoAuto merge of #60787 - alexcrichton:error-type-id-destabilize-master, r=pietroalbini
bors [Tue, 14 May 2019 15:58:33 +0000 (15:58 +0000)]
Auto merge of #60787 - alexcrichton:error-type-id-destabilize-master, r=pietroalbini

Destabilize the `Error::type_id` function

This commit destabilizes the `Error::type_id` function in the standard library.
This does so by effectively reverting #58048, restoring the `#[unstable]`
attribute. The security mailing list has recently been notified of a
vulnerability relating to the stabilization of this function. First stabilized
in Rust 1.34.0, a stable function here allows users to implement a custom
return value for this function:

    struct MyType;

    impl Error for MyType {
fn type_id(&self) -> TypeId {
    // Enable safe casting to `String` by accident.
    TypeId::of::<String>()
}
    }

This, when combined with the `Error::downcast` family of functions, allows
safely casting a type to any other type, clearly a memory safety issue! A
formal announcement has been made to the [security mailing list](https://groups.google.com/forum/#!topic/rustlang-security-announcements/aZabeCMUv70) as well as [the blog](https://blog.rust-lang.org/2019/05/13/Security-advisory.html)

This commit simply destabilizes the `Error::type_id` which, although breaking
for users since Rust 1.34.0, is hoped to have little impact and has been deemed
sufficient to mitigate this issue for the stable channel. The long-term fate of
the `Error::type_id` API will be discussed at #60784.

5 years agoremoves `AbiMethods`
Saleem Jaffer [Tue, 14 May 2019 15:53:01 +0000 (21:23 +0530)]
removes `AbiMethods`

5 years agorefactor complete
Saleem Jaffer [Tue, 14 May 2019 09:50:29 +0000 (15:20 +0530)]
refactor complete

5 years agosubmodules: update clippy from 3710ec59 to ad3269c4
Matthias Krüger [Tue, 14 May 2019 09:36:31 +0000 (11:36 +0200)]
submodules: update clippy from 3710ec59 to ad3269c4

Changes:
````
Rustfmt all the things
Clippy dogfood
Update for compiletest changes
Use symbols instead of strings
Rustup to rustc 1.36.0-nightly (1764b2972 2019-05-12)
Add regression test for identity_conversion FP
UI test cleanup: Extract many_single_char_names tests
Add tests for empty_loop lint
Add in_macro again
Rename in_macro to in_macro_or_desugar
````

5 years agosome more refactor of FnType. Things build now
Saleem Jaffer [Tue, 14 May 2019 08:44:12 +0000 (14:14 +0530)]
some more refactor of FnType. Things build now

5 years agoAdd comment
varkor [Tue, 14 May 2019 08:42:32 +0000 (09:42 +0100)]
Add comment

5 years agoREADME: Mention MSVC 2017+, not 2013(!)
Scott McMurray [Tue, 14 May 2019 04:54:47 +0000 (21:54 -0700)]
README: Mention MSVC 2017+, not 2013(!)

LLVM will soon require 2017+ [1] (and our in-tree version just rejected the version of 2015 I was using), so update the mention and provide a link.

[1]: https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library

5 years agoAuto merge of #60794 - Centril:rollup-vlguvns, r=Centril
bors [Tue, 14 May 2019 03:09:46 +0000 (03:09 +0000)]
Auto merge of #60794 - Centril:rollup-vlguvns, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #60176 (Explain error when yielding a reference to a local variable)
 - #60201 (coretest: Downgrade deny to warn)
 - #60562 (Add #[doc(hidden)] attribute on compiler generated module.)
 - #60710 (Use `delay_span_bug` for error cases when checking `AnonConst` parent)
 - #60770 (add impl_trait_in_bindings to INCOMPLETE_FEATURES)

Failed merges:

r? @ghost

5 years agoBump measureme dependency to 0.3
Wesley Wiser [Tue, 14 May 2019 02:15:55 +0000 (22:15 -0400)]
Bump measureme dependency to 0.3

measureme@0.3 adds a version header to the binary file format which will
help reduce tool breakage in the future.

5 years agoImprove the "must use" lint for `Future`
Benjamin Schultzer [Mon, 13 May 2019 22:13:17 +0000 (15:13 -0700)]
Improve the "must use" lint for `Future`

Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
5 years agodefault to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets
Nathan Froyd [Mon, 13 May 2019 15:03:48 +0000 (11:03 -0400)]
default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets

Over in #60378, we made `rustc` switch LLVM target triples dynamically
based on the `MACOSX_DEPLOYMENT_TARGET` environment variable.  This
change was made to align with `clang`'s behavior, and therefore make
cross-language LTO feasible on OS X.  Otherwise, `rustc` would produce
LLVM bitcode files with a target triple of `x86_64-apple-darwin`,
`clang` would produce LLVM bitcode files with a target triple of
`x86_64-apple-macosx$VERSION`, and the linker would complain.

This change worked fine, except for one corner case: if you didn't have
`MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust
code, you'd get warning messages similar to:

```
warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin'
```

This message occurs because libstd is compiled with
`MACOSX_DEPLOYMENT_TARGET` set to 10.7.  The LLVM bitcode distributed in
libstd's rlibs, then, is tagged with the target triple of
`x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for
"user" code is tagged with the target triple of `x86_64-apple-darwin`.

It's not good to have LTO on just Rust code (probably much more common
than cross-language LTO) warn by default.  These warnings also break
Cargo's testsuite.

This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was
set to 10.7.  "user" code will then be given a target triple that is
equivalent to the target triple libstd bitcode is already using.  The
above warning will therefore go away.

`rustc` already assumes that compiling without
`MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target
compatible with OS X 10.7 (e.g. that things like TLS work properly).  So
this change is really just making things conform more closely to the
status quo.

(It's also worth noting that before and after this patch, compiling with
`MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target
triples with an "apple" version ignore OS versions when checking
compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just
fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)

5 years agoAllow late bound regions in existential types
Matthew Jasper [Mon, 13 May 2019 20:57:20 +0000 (21:57 +0100)]
Allow late bound regions in existential types

5 years agoupdate miri
Ralf Jung [Mon, 13 May 2019 09:39:30 +0000 (11:39 +0200)]
update miri

5 years agoRollup merge of #60770 - Pulkit07:issue60764, r=Centril
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:55 +0000 (21:36 +0200)]
Rollup merge of #60770 - Pulkit07:issue60764, r=Centril

add impl_trait_in_bindings to INCOMPLETE_FEATURES

impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.

5 years agoRollup merge of #60710 - varkor:delay_span_bug-const-parent, r=matthewjasper
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:54 +0000 (21:36 +0200)]
Rollup merge of #60710 - varkor:delay_span_bug-const-parent, r=matthewjasper

Use `delay_span_bug` for error cases when checking `AnonConst` parent

Fixes #60704.
Fixes #60650.

5 years agoRollup merge of #60562 - iliekturtles:proc-macro-missing-docs, r=alexcrichton
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:52 +0000 (21:36 +0200)]
Rollup merge of #60562 - iliekturtles:proc-macro-missing-docs, r=alexcrichton

Add #[doc(hidden)] attribute on compiler generated module.

Resolves unavoidable `missing_docs` warning/error on proc-macro crates.
Resolves #42008.

Changes not yet tested locally, however I wanted to submit first since `rustc` takes forever to compile.

5 years agoRollup merge of #60201 - RalfJung:core-tests, r=alexcrichton
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:51 +0000 (21:36 +0200)]
Rollup merge of #60201 - RalfJung:core-tests, r=alexcrichton

coretest: Downgrade deny to warn

The `deny` causes a build failure in https://github.com/RalfJung/miri-test-libstd. Since we use `-D warnings` for rustc builds, `warn` should be enough to lead to compile errors here, without impeding external builds.

5 years agoRollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix
Mazdak Farrokhzad [Mon, 13 May 2019 19:36:49 +0000 (21:36 +0200)]
Rollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix

Explain error when yielding a reference to a local variable

Closes #56508

5 years agoadd impl_trait_in_bindings to INCOMPLETE_FEATURES
Pulkit Goyal [Sun, 12 May 2019 21:37:05 +0000 (00:37 +0300)]
add impl_trait_in_bindings to INCOMPLETE_FEATURES

impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.

5 years agoadd release notes for rust 1.34.2
Pietro Albini [Mon, 13 May 2019 15:30:14 +0000 (17:30 +0200)]
add release notes for rust 1.34.2

5 years agoDestabilize the `Error::type_id` function
Alex Crichton [Mon, 13 May 2019 15:14:02 +0000 (08:14 -0700)]
Destabilize the `Error::type_id` function

This commit destabilizes the `Error::type_id` function in the standard library.
This does so by effectively reverting #58048, restoring the `#[unstable]`
attribute. The security mailing list has recently been notified of a
vulnerability relating to the stabilization of this function. First stabilized
in Rust 1.34.0, a stable function here allows users to implement a custom
return value for this function:

    struct MyType;

    impl Error for MyType {
fn type_id(&self) -> TypeId {
    // Enable safe casting to `String` by accident.
    TypeId::of::<String>()
}
    }

This, when combined with the `Error::downcast` family of functions, allows
safely casting a type to any other type, clearly a memory safety issue! A
security announcement will be shortly posted to the security mailing list as
well as the Rust Blog, and when those links are available they'll be filled in
for this PR as well.

This commit simply destabilizes the `Error::type_id` which, although breaking
for users since Rust 1.34.0, is hoped to have little impact and has been deemed
sufficient to mitigate this issue for the stable channel. The long-term fate of
the `Error::type_id` API will be discussed at #60784.

5 years agomove raw span to tt reader
Aleksey Kladov [Mon, 13 May 2019 11:30:18 +0000 (14:30 +0300)]
move raw span to tt reader

See https://github.com/rust-lang/rust/pull/50838/files#r283296243 for
explanation how jointness checking works with *next* pair

5 years agomove span and token to tt reader
Aleksey Kladov [Mon, 13 May 2019 09:06:37 +0000 (12:06 +0300)]
move span and token to tt reader

5 years agoMove token tree related lexer state to a separate struct
Aleksey Kladov [Sun, 12 May 2019 16:55:16 +0000 (19:55 +0300)]
Move token tree related lexer state to a separate struct

We only used a bunch of fields when tokenizing into a token tree,
so let's move them out of the base lexer

5 years agomodify comment
Felix S Klock II [Mon, 13 May 2019 11:29:49 +0000 (13:29 +0200)]
modify comment

modify the comment on `in_cycle` to reflect changes requested by ariel and myself.

5 years agoAuto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk
bors [Mon, 13 May 2019 10:57:59 +0000 (10:57 +0000)]
Auto merge of #60649 - Xanewok:save-analysis-assoc-const-ice, r=oli-obk

save-analysis: Fix ICE when processing associated constant

Closes #59134
Closes https://github.com/rust-lang/rls/issues/1449

Thanks @swgillespie for helping tracking this down and fixing it!

r? @eddyb

5 years agoRevert "use SecRandomCopyBytes on macOS in Miri"
Ralf Jung [Mon, 13 May 2019 09:34:11 +0000 (11:34 +0200)]
Revert "use SecRandomCopyBytes on macOS in Miri"

This reverts commit 54aefc6a2d076b74921a8d78c5d8c68c13bfa4a7.

5 years agoRemove bitrig support from rust
Marcel Hellwig [Mon, 13 May 2019 07:13:07 +0000 (09:13 +0200)]
Remove bitrig support from rust

5 years agoAuto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk
bors [Mon, 13 May 2019 08:13:01 +0000 (08:13 +0000)]
Auto merge of #60765 - matthewjasper:fix-more-escaping-rescopes, r=oli-obk

Fix more escaping ReScopes

Closes #58840

5 years agoAuto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkov
bors [Mon, 13 May 2019 00:28:38 +0000 (00:28 +0000)]
Auto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkov

Use `Symbol` more

A `Symbol` can be equated with a string (e.g. `&str`). This involves a
TLS lookup to get the chars (and a Mutex lock in a parallel compiler)
and then a char-by-char comparison. This functionality is convenient but
avoids one of the main benefits of `Symbol`s, which is fast equality
comparisons.

This PR removes the `Symbol`/string equality operations, forcing a lot
of existing string occurrences to become `Symbol`s. Fortunately, these
are almost all static strings (many are attribute names) and we can add
static `Symbol`s as necessary, and very little extra interning occurs.
The benefits are (a) a slight speedup (possibly greater in a parallel
compiler), and (b) the code is a lot more principled about `Symbol` use.
The main downside is verbosity, particularly with more `use
syntax::symbol::symbols` items.

r? @Zoxc

5 years agoReturn a `Symbol` from `name_or_empty` functions.
Nicholas Nethercote [Wed, 8 May 2019 04:33:06 +0000 (14:33 +1000)]
Return a `Symbol` from `name_or_empty` functions.

5 years agoRemove the equality operation between `Symbol` and strings.
Nicholas Nethercote [Tue, 7 May 2019 06:03:44 +0000 (16:03 +1000)]
Remove the equality operation between `Symbol` and strings.

And also the equality between `Path` and strings, because `Path` is made
up of `Symbol`s.

5 years agoPass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.
Nicholas Nethercote [Wed, 8 May 2019 03:21:18 +0000 (13:21 +1000)]
Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.

5 years agoRename `syntax::symbol::symbols` as `syntax::symbol::sym`.
Nicholas Nethercote [Thu, 9 May 2019 23:57:08 +0000 (09:57 +1000)]
Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.

Because it's going to be used a lot.

5 years agoAdd lots of static `Symbols`.
Nicholas Nethercote [Mon, 6 May 2019 23:55:12 +0000 (09:55 +1000)]
Add lots of static `Symbols`.

These will be used in the subsequent commits. Many of them are
attributes.

The commit also adds the ability to handle symbols that aren't
identifiers (e.g. "proc-macro").

5 years agoUpdate rustc book CLI docs.
Eric Huss [Sun, 12 May 2019 21:16:50 +0000 (14:16 -0700)]
Update rustc book CLI docs.

5 years agoAuto merge of #60767 - Centril:rollup-4cbsb73, r=Centril
bors [Sun, 12 May 2019 20:28:19 +0000 (20:28 +0000)]
Auto merge of #60767 - Centril:rollup-4cbsb73, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60694 (Fix HIR printing of existential type #60662)
 - #60750 (syntax: Remove some legacy nonterminal tokens)
 - #60751 (Assorted cleanup in parser & AST validation)
 - #60752 (Fix minor typos for ItemLocalId)

Failed merges:

r? @ghost

5 years agoRollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiser
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:11 +0000 (21:14 +0200)]
Rollup merge of #60752 - shiatsumat:minor-typos-hir, r=wesleywiser

Fix minor typos for ItemLocalId

* added comma after 'that is'
* "can be implement" -> "can be implemented"

5 years agoRollup merge of #60751 - Centril:general-cleanup, r=petrochenkov
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:10 +0000 (21:14 +0200)]
Rollup merge of #60751 - Centril:general-cleanup, r=petrochenkov

Assorted cleanup in parser & AST validation

r? @petrochenkov

Extracted out of a larger PR.

5 years agoRollup merge of #60750 - petrochenkov:noquotok2, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:08 +0000 (21:14 +0200)]
Rollup merge of #60750 - petrochenkov:noquotok2, r=Mark-Simulacrum

syntax: Remove some legacy nonterminal tokens

They were used by legacy quote macros removed in https://github.com/rust-lang/rust/pull/51285.

5 years agoRollup merge of #60694 - Pulkit07:issue60662, r=alexreg
Mazdak Farrokhzad [Sun, 12 May 2019 19:14:07 +0000 (21:14 +0200)]
Rollup merge of #60694 - Pulkit07:issue60662, r=alexreg

Fix HIR printing of existential type #60662

This fixes https://github.com/rust-lang/rust/issues/60662

5 years agoDon't allow any ReScope in impl trait types
Matthew Jasper [Sun, 12 May 2019 17:51:40 +0000 (18:51 +0100)]
Don't allow any ReScope in impl trait types

This shouldn't be possible any more, but if it does happen, emit an
error rather than maybe panicking later when NLL finds a the ReScope.
Impl trait in bindings is sufficiently broken that I don't think this
breaks anything that works for it.

5 years agoAuto merge of #60679 - petrochenkov:lit2, r=matklad
bors [Sun, 12 May 2019 17:44:06 +0000 (17:44 +0000)]
Auto merge of #60679 - petrochenkov:lit2, r=matklad

Keep original literal tokens in AST

The original literal tokens (`token::Lit`) are kept in AST until lowering to HIR.

The tokens are kept together with their lowered "semantic" representation (`ast::LitKind`), so the size of `ast::Lit` is increased (this also increases the size of meta-item structs used for processing built-in attributes).
However, the size of `ast::Expr` stays the same.

The intent is to remove the "semantic" representation from AST eventually and keep literals as tokens until lowering to HIR (at least), and I'm going to work on that, but it would be good to land this sooner to unblock progress on the [lexer refactoring](https://github.com/rust-lang/rust/pull/59706).

Fixes a part of https://github.com/rust-lang/rust/issues/43081 (literal tokens that are passed to proc macros are always precise, including hexadecimal numbers, strings with their original escaping, etc)
Fixes a part of https://github.com/rust-lang/rust/issues/60495 (everything except for proc macro API doesn't need escaping anymore)
This also allows to eliminate a certain hack from the lexer (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/pretty-printing.20comments/near/165005357).

cc @matklad

5 years agoTreat generators the same as closure for escaping lifetimes
Matthew Jasper [Sun, 12 May 2019 16:52:33 +0000 (17:52 +0100)]
Treat generators the same as closure for escaping lifetimes

5 years agoAlways use the stronger outlives version for opaque types
Matthew Jasper [Sun, 12 May 2019 16:12:49 +0000 (17:12 +0100)]
Always use the stronger outlives version for opaque types

5 years agoAuto merge of #60244 - SimonSapin:dangling, r=oli-obk
bors [Sun, 12 May 2019 14:32:11 +0000 (14:32 +0000)]
Auto merge of #60244 - SimonSapin:dangling, r=oli-obk

const-stabilize NonNull::dangling and NonNull::cast

5 years agoAuto merge of #60474 - mati865:musl_toolchain, r=alexcrichton
bors [Sun, 12 May 2019 09:19:28 +0000 (09:19 +0000)]
Auto merge of #60474 - mati865:musl_toolchain, r=alexcrichton

 Make tests compatible with musl host

As an alternative to passing explicit linker all over the place I could try linking `cc` to musl gcc since this bootstraps itself.

Assigning for discussion:
r? @alexcrichton

5 years agoAuto merge of #60396 - cuviper:ordered-retain, r=scottmcm
bors [Sun, 12 May 2019 06:24:10 +0000 (06:24 +0000)]
Auto merge of #60396 - cuviper:ordered-retain, r=scottmcm

Document the order of {Vec,VecDeque,String}::retain

It's natural for `retain` to work in order from beginning to end, but
this wasn't actually documented to be the case. If we actually promise
this, then the caller can do useful things like track the index of each
element being tested, as [discussed in the forum][1]. This is now
documented for `Vec`, `VecDeque`, and `String`.

[1]: https://users.rust-lang.org/t/vec-retain-by-index/27697

`HashMap` and `HashSet` also have `retain`, and the `hashbrown`
implementation does happen to use a plain `iter()` order too, but it's
not certain that this should always be the case for these types.

r? @scottmcm

5 years agoFix minor typos for ItemLocalId
Yusuke Matsushita [Sun, 12 May 2019 00:52:38 +0000 (09:52 +0900)]
Fix minor typos for ItemLocalId

* added comma before 'that is'
* "can be implement" -> "can be implemented"

5 years agoMinor cleanup in parse_assoc_expr_with.
Mazdak Farrokhzad [Sun, 12 May 2019 00:17:34 +0000 (02:17 +0200)]
Minor cleanup in parse_assoc_expr_with.

5 years agoparse_bottom_expr: extract common 'return' out.
Mazdak Farrokhzad [Sun, 12 May 2019 00:01:32 +0000 (02:01 +0200)]
parse_bottom_expr: extract common 'return' out.

5 years agosyntax::parse::parser: convert unnecessary '&mut self's to '&self'.
Mazdak Farrokhzad [Sun, 12 May 2019 00:00:06 +0000 (02:00 +0200)]
syntax::parse::parser: convert unnecessary '&mut self's to '&self'.

5 years agoast_validation: comments -> doc comments
Mazdak Farrokhzad [Sun, 5 May 2019 12:06:04 +0000 (14:06 +0200)]
ast_validation: comments -> doc comments

5 years agosyntax: Remove some legacy nonterminal tokens
Vadim Petrochenkov [Sat, 11 May 2019 19:44:33 +0000 (22:44 +0300)]
syntax: Remove some legacy nonterminal tokens

5 years agoFix HIR printing of existential type #60662
Pulkit Goyal [Thu, 9 May 2019 18:32:33 +0000 (21:32 +0300)]
Fix HIR printing of existential type #60662

This fixes https://github.com/rust-lang/rust/issues/60662

5 years agoAuto merge of #60748 - Centril:rollup-rr63jqo, r=Centril
bors [Sat, 11 May 2019 22:13:10 +0000 (22:13 +0000)]
Auto merge of #60748 - Centril:rollup-rr63jqo, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #60720 (Remove unnecessary unwraps)
 - #60727 (add comment to `Rc`/`Arc`'s `Eq` specialization)
 - #60733 (Cleanup the .await HIR lowering with .stmt(..).)
 - #60741 (Remove redundant "let mut" in write_graph_label)

Failed merges:

r? @ghost

5 years agoRollup merge of #60741 - shiatsumat:patch-let-mut-write-graph-label, r=varkor
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:41 +0000 (23:41 +0200)]
Rollup merge of #60741 - shiatsumat:patch-let-mut-write-graph-label, r=varkor

Remove redundant "let mut" in write_graph_label

Removed the redundant "let mut" in the write_graph_label function (it caused "let mut let mut" for non-user-defined local variables).

5 years agoRollup merge of #60733 - Centril:cleanup-lowering-await, r=varkor
Mazdak Farrokhzad [Sat, 11 May 2019 21:41:40 +0000 (23:41 +0200)]
Rollup merge of #60733 - Centril:cleanup-lowering-await, r=varkor

Cleanup the .await HIR lowering with .stmt(..).

r? @cramertj