Commit Graph

93289 Commits

Author SHA1 Message Date
Esteban Küber
65b731908a Explain that ? converts the error type using From 2019-05-17 12:18:56 -07:00
bors
1962adea6a 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
2019-05-16 09:58:30 +00:00
Mazdak Farrokhzad
b59ce94bce
Rollup merge of #60851 - Pulkit07:issue60849, r=Centril
Move `box` from the stable keyword to unstable keywords list

Fixes #60849
2019-05-16 10:43:35 +02:00
Mazdak Farrokhzad
90952171ac
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
2019-05-16 10:43:34 +02:00
Mazdak Farrokhzad
6b299878ba
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.
2019-05-16 10:43:33 +02:00
Mazdak Farrokhzad
013e4daa41
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);
//  ^^^^^^^^^
2019-05-16 10:43:30 +02:00
Mazdak Farrokhzad
250fe9b37e
Rollup merge of #59923 - czipperz:fix-convert-doc-links, r=steveklabnik
Fix convert module's documentation links

r? @steveklabnik
2019-05-16 10:43:28 +02:00
Mazdak Farrokhzad
f08c5bbc85
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.
2019-05-16 10:43:24 +02:00
bors
472211ab0a 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.
2019-05-16 07:04:03 +00:00
bors
024c25dc79 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
2019-05-16 04:15:12 +00:00
bors
49d139c64b 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.
2019-05-16 01:26:13 +00:00
Pulkit Goyal
65d09ea468 Move box from the stable keyword to unstable keywords list
Fixes #60849
2019-05-15 16:22:39 +03:00
bors
7158ed9cbe 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
2019-05-15 12:10:13 +00:00
bors
f2951e6fd7 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
2019-05-15 07:23:21 +00:00
bors
c84a7abf8b 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 5b8e99bb61/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?
2019-05-15 04:34:14 +00:00
Vadim Petrochenkov
3646b3c3d9 rustbuild/LLVM: Do not print installation messages for up-to-date files 2019-05-15 01:36:18 +03:00
bors
372be4f360 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
2019-05-14 20:50:26 +00:00
Mazdak Farrokhzad
2e844ef449
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
2019-05-14 22:00:26 +02:00
Mazdak Farrokhzad
7dbf37b209
Rollup merge of #60808 - Schultzer:improve-must-use-linit-for-future, r=Centril
Improve the "must use" lint for `Future`

Fixes #60797
2019-05-14 22:00:24 +02:00
Mazdak Farrokhzad
b24981a4fe
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
2019-05-14 22:00:22 +02:00
Mazdak Farrokhzad
29f93ad507
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.)
2019-05-14 22:00:20 +02:00
Mazdak Farrokhzad
020111adfc
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
2019-05-14 22:00:19 +02:00
Mazdak Farrokhzad
3b4234a175
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.
2019-05-14 22:00:16 +02:00
Mazdak Farrokhzad
b4c340e4bb
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
2019-05-14 22:00:13 +02:00
Mazdak Farrokhzad
088c99410b
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))?
2019-05-14 22:00:11 +02:00
Mazdak Farrokhzad
bab03cecfe
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.
2019-05-14 22:00:09 +02:00
Alex Crichton
441ca638cc Update LLVM to fix assertion when compiling to wasm
More details can be found in #60540!

Closes #60540
2019-05-14 10:55:55 -07:00
bors
f59c71eb8e 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.
2019-05-14 15:58:33 +00:00
Saleem Jaffer
44eb607d76 removes AbiMethods 2019-05-14 21:23:01 +05:30
Saleem Jaffer
e1b3c79d5c refactor complete 2019-05-14 15:20:29 +05:30
Matthias Krüger
41184aa545 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
````
2019-05-14 11:45:10 +02:00
Saleem Jaffer
3031705009 some more refactor of FnType. Things build now 2019-05-14 14:14:12 +05:30
varkor
b470d48c8a Add comment 2019-05-14 09:42:32 +01:00
Scott McMurray
7171bd1f69 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
2019-05-13 23:17:54 -07:00
bors
80e7cde223 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
2019-05-14 03:09:46 +00:00
Wesley Wiser
ea93215576 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.
2019-05-13 22:15:55 -04:00
Benjamin Schultzer
58c6a94f00 Improve the "must use" lint for Future
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-05-13 16:01:20 -07:00
Nathan Froyd
7e94f9c72e 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.)
2019-05-13 17:04:59 -04:00
Matthew Jasper
36fd00e81c Allow late bound regions in existential types 2019-05-13 21:57:20 +01:00
Ralf Jung
43207cada2 update miri 2019-05-13 22:08:25 +02:00
Mazdak Farrokhzad
b698609624
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.
2019-05-13 21:36:55 +02:00
Mazdak Farrokhzad
25b5d30163
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.
2019-05-13 21:36:54 +02:00
Mazdak Farrokhzad
e952b52a16
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.
2019-05-13 21:36:52 +02:00
Mazdak Farrokhzad
c8ef512480
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.
2019-05-13 21:36:51 +02:00
Mazdak Farrokhzad
2821329c34
Rollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix
Explain error when yielding a reference to a local variable

Closes #56508
2019-05-13 21:36:49 +02:00
Pulkit Goyal
ea956e3ae9 add impl_trait_in_bindings to INCOMPLETE_FEATURES
impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.
2019-05-13 18:45:20 +03:00
Pietro Albini
3db667a819
add release notes for rust 1.34.2 2019-05-13 17:44:24 +02:00
Alex Crichton
c47e2ef8d4 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.
2019-05-13 08:18:37 -07:00
Aleksey Kladov
e249f2e526 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
2019-05-13 14:54:34 +03:00
Aleksey Kladov
b91e0a3786 move span and token to tt reader 2019-05-13 14:54:34 +03:00