]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #67009 - Aaron1011:fix/coerce-suggestion, r=Centril
Mazdak Farrokhzad [Fri, 6 Dec 2019 22:26:57 +0000 (23:26 +0100)]
Rollup merge of #67009 - Aaron1011:fix/coerce-suggestion, r=Centril

Emit coercion suggestions in more places

Fixes #66910

We have several different kinds of suggestions we can try to make when
type coercion fails. However, we were previously only emitting these
suggestions from `demand_coerce_diag`. This resulted in the compiler
failing to emit applicable suggestions in several different cases, such
as when the implicit return value of a function had the wrong type.

This commit adds a new `emit_coerce_suggestions` method, which tries to
emit a number of related suggestions. This method is called from both
`demand_coerce_diag` and `CoerceMany::coerce_inner`, which covers a much
wider range of cases than before.

We now suggest using `.await` in more cases where it is applicable,
among other improvements.

I'm not happy about disabling the `issue-59756`, but from what I can tell, the suggestion infrastructure in rustc lacks any way of indicating mutually exclusive suggestions (and compiletest lacks a way to only apply a subset of available suggestions).

4 years agoRollup merge of #66841 - SimonSapin:float_round_unchecked_to, r=rkruppe
Mazdak Farrokhzad [Fri, 6 Dec 2019 22:26:55 +0000 (23:26 +0100)]
Rollup merge of #66841 - SimonSapin:float_round_unchecked_to, r=rkruppe

Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods

As discussed in https://github.com/rust-lang/rust/issues/10184

Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.

<del>The “fit” wording is copied from https://llvm.org/docs/LangRef.html#fptoui-to-instruction, but I’m not certain what it means exactly. Presumably this is after rounding towards zero, and the doc-test with `i8::MIN` seems to confirm this.</del> Clang presumably uses those LLVM intrinsics to implement C and C++ casts, whose respective standard specify that the value *after truncating to keep its integral part* must be representable in the target type.

4 years agoRollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obk
Mazdak Farrokhzad [Fri, 6 Dec 2019 22:26:54 +0000 (23:26 +0100)]
Rollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obk

Add feature gate for mut refs in const fn

r? @oli-obk

4 years agoAuto merge of #65195 - varkor:to_option, r=Centril
bors [Fri, 6 Dec 2019 19:14:51 +0000 (19:14 +0000)]
Auto merge of #65195 - varkor:to_option, r=Centril

Rename `bool::then_*` to `bool::to_option_*` and use where appropriate

Name change following https://github.com/rust-lang/rfcs/pull/2757. Also try it out throughout the compiler in places I think makes the code more readable.

4 years agoAuto merge of #67091 - JohnTitor:rollup-kitphze, r=JohnTitor
bors [Fri, 6 Dec 2019 15:11:35 +0000 (15:11 +0000)]
Auto merge of #67091 - JohnTitor:rollup-kitphze, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #66846 (Make try_mark_previous_green aware of cycles.)
 - #66959 (Remove potential cfgs duplicates)
 - #66988 (Fix angle bracket formatting when dumping MIR debug vars)
 - #66998 (Modified the testcases for VxWorks)
 - #67008 (rustdoc: Add test for fixed issue)
 - #67023 (SGX: Fix target linker used by bootstrap)
 - #67033 (Migrate to LLVM{Get,Set}ValueName2)
 - #67049 (Simplify {IoSlice, IoSliceMut}::advance examples and tests)
 - #67054 (codegen "unreachable" for invalid SetDiscriminant)
 - #67081 (Fix Query type docs)
 - #67085 (Remove boxed closures in address parser.)

Failed merges:

r? @ghost

4 years agoRollup merge of #67085 - reitermarkus:addr-parser, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Dec 2019 15:10:08 +0000 (00:10 +0900)]
Rollup merge of #67085 - reitermarkus:addr-parser, r=Mark-Simulacrum

Remove boxed closures in address parser.

Simplify address parser by removing unnecessary boxed closures.

Also relevant for https://github.com/rust-lang/rfcs/pull/2832.

4 years agoRollup merge of #67081 - osa1:fix_query_type_docs, r=Dylan-DPC
Yuki Okushi [Fri, 6 Dec 2019 15:10:07 +0000 (00:10 +0900)]
Rollup merge of #67081 - osa1:fix_query_type_docs, r=Dylan-DPC

Fix Query type docs

`give` no longer exists, `compute` is used to generate query results now.

4 years agoRollup merge of #67054 - RalfJung:set-discriminant-unreachable, r=oli-obk
Yuki Okushi [Fri, 6 Dec 2019 15:10:05 +0000 (00:10 +0900)]
Rollup merge of #67054 - RalfJung:set-discriminant-unreachable, r=oli-obk

codegen "unreachable" for invalid SetDiscriminant

Follow-up from https://github.com/rust-lang/rust/pull/66960. I also realized I don't understand our policy for using `abort` vs `unreachable`. AFAIK `abort` is safe to call and just aborts the process, while `unreachable` is UB. But sometimes we use both, like here

https://github.com/rust-lang/rust/blob/d825e35ee8325146e6c175a4c61bcb645b347d5e/src/librustc_codegen_ssa/mir/block.rs#L827-L828

and here

https://github.com/rust-lang/rust/blob/d825e35ee8325146e6c175a4c61bcb645b347d5e/src/librustc_codegen_ssa/mir/block.rs#L264-L265

The second case is even more confusing because that looks like an unreachable `return` to me, so why would we codegen a safe abort there?

r? @eddyb Cc @oli-obk

4 years agoRollup merge of #67049 - tmiasko:io-slice-advance, r=rkruppe
Yuki Okushi [Fri, 6 Dec 2019 15:10:04 +0000 (00:10 +0900)]
Rollup merge of #67049 - tmiasko:io-slice-advance, r=rkruppe

Simplify {IoSlice, IoSliceMut}::advance examples and tests

Remove unnecessary calls to `std::mem::replace` and make variables immutable.

4 years agoRollup merge of #67033 - cuviper:ValueName2, r=rkruppe
Yuki Okushi [Fri, 6 Dec 2019 15:10:02 +0000 (00:10 +0900)]
Rollup merge of #67033 - cuviper:ValueName2, r=rkruppe

Migrate to LLVM{Get,Set}ValueName2

The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated
strings, but the `2` variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
`llvm::{get,set}_value_name` that convert to/from `&[u8]`.

Closes #64223.
r? @rkruppe

4 years agoRollup merge of #67023 - jethrogb:jb/bootstrap-target-linker, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 15:10:00 +0000 (00:10 +0900)]
Rollup merge of #67023 - jethrogb:jb/bootstrap-target-linker, r=alexcrichton

SGX: Fix target linker used by bootstrap

Bootstrap, for some reason, overrides the target linker. This is not correct for x86_64-fortanix-unknown-sgx. Add such targets to the list of exceptions.

r? @alexcrichton

4 years agoRollup merge of #67008 - ollie27:rustdoc_issue_61732, r=Centril
Yuki Okushi [Fri, 6 Dec 2019 15:09:59 +0000 (00:09 +0900)]
Rollup merge of #67008 - ollie27:rustdoc_issue_61732, r=Centril

rustdoc: Add test for fixed issue

#61732 was almost certainly fixed by #63400.

Closes #61732

4 years agoRollup merge of #66998 - Wind-River:master_up, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 15:09:57 +0000 (00:09 +0900)]
Rollup merge of #66998 - Wind-River:master_up, r=alexcrichton

Modified the testcases for VxWorks

4 years agoRollup merge of #66988 - osa1:issue66985, r=matthewjasper
Yuki Okushi [Fri, 6 Dec 2019 15:09:55 +0000 (00:09 +0900)]
Rollup merge of #66988 - osa1:issue66985, r=matthewjasper

Fix angle bracket formatting when dumping MIR debug vars

Fixes #66985

4 years agoRollup merge of #66959 - GuillaumeGomez:cfg-duplicates, r=eddyb
Yuki Okushi [Fri, 6 Dec 2019 15:09:54 +0000 (00:09 +0900)]
Rollup merge of #66959 - GuillaumeGomez:cfg-duplicates, r=eddyb

Remove potential cfgs duplicates

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

Before going any further (the issue seems to be linked to metadata as far as I can tell). Do you think this is the good place to do it or should it be done before?

r? @eddyb

4 years agoRollup merge of #66846 - gizmondo:master, r=michaelwoerister
Yuki Okushi [Fri, 6 Dec 2019 15:09:52 +0000 (00:09 +0900)]
Rollup merge of #66846 - gizmondo:master, r=michaelwoerister

Make try_mark_previous_green aware of cycles.

Fixes #61323

r? @michaelwoerister

4 years agoFix rebase issues
varkor [Fri, 6 Dec 2019 13:09:03 +0000 (13:09 +0000)]
Fix rebase issues

4 years agoMove numeric `From` and `TryFrom` impls to `libcore/convert/num.rs`
Simon Sapin [Mon, 2 Dec 2019 08:44:48 +0000 (09:44 +0100)]
Move numeric `From` and `TryFrom` impls to `libcore/convert/num.rs`

This makes `libcore/num/mod.rs` slightly smaller. It’s still 4911 lines and not easy to navigate. This doesn’t change any public API.

4 years agoAdd `{f32,f64}::approx_unchecked_to<Int>` unsafe methods
Simon Sapin [Thu, 28 Nov 2019 14:24:26 +0000 (15:24 +0100)]
Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods

As discussed in https://github.com/rust-lang/rust/issues/10184

Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.

4 years agoMake `core::convert` a directory-module with `mod.rs`
Simon Sapin [Fri, 6 Dec 2019 12:56:25 +0000 (13:56 +0100)]
Make `core::convert` a directory-module with `mod.rs`

4 years agoRemove boxed closures in address parser.
Markus Reiter [Fri, 6 Dec 2019 12:27:39 +0000 (13:27 +0100)]
Remove boxed closures in address parser.

4 years agoUse `Instant::now` lazily
varkor [Fri, 6 Dec 2019 12:19:44 +0000 (12:19 +0000)]
Use `Instant::now` lazily

4 years agoRename to `then_some` and `then`
varkor [Fri, 6 Dec 2019 12:18:32 +0000 (12:18 +0000)]
Rename to `then_some` and `then`

4 years agoUse `as_ref().map()` rather than `is_some().to_option()`
varkor [Sun, 13 Oct 2019 14:47:38 +0000 (15:47 +0100)]
Use `as_ref().map()` rather than `is_some().to_option()`

4 years agoFix libcore tests
varkor [Tue, 8 Oct 2019 23:48:47 +0000 (00:48 +0100)]
Fix libcore tests

4 years agoUse `to_option_with` in several places
varkor [Tue, 8 Oct 2019 22:09:36 +0000 (23:09 +0100)]
Use `to_option_with` in several places

4 years agoUse `to_option` in various places
varkor [Tue, 8 Oct 2019 00:14:42 +0000 (01:14 +0100)]
Use `to_option` in various places

4 years agoRename `bool`'s `then` to `to_option`
varkor [Mon, 7 Oct 2019 23:05:13 +0000 (00:05 +0100)]
Rename `bool`'s `then` to `to_option`

4 years agoMake try_mark_previous_green aware of cycles.
Alex Aktsipetrov [Fri, 6 Dec 2019 09:48:53 +0000 (12:48 +0300)]
Make try_mark_previous_green aware of cycles.

4 years agoAuto merge of #67080 - JohnTitor:rollup-2t6fm3u, r=JohnTitor
bors [Fri, 6 Dec 2019 07:43:56 +0000 (07:43 +0000)]
Auto merge of #67080 - JohnTitor:rollup-2t6fm3u, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #66649 (VxWorks: fix issues in accessing environment variables)
 - #66764 (Tweak wording of `collect()` on bad target type)
 - #66900 (Clean up error codes)
 - #66974 ([CI] fix the `! isCI` check in src/ci/run.sh)
 - #66979 (Add long error for E0631 and update ui tests.)
 - #67017 (cleanup long error explanations)
 - #67021 (Fix docs for formatting delegations)
 - #67041 (add ExitStatusExt into prelude)
 - #67065 (Fix fetching arguments on the wasm32-wasi target)
 - #67066 (Update the revision of wasi-libc used in wasm32-wasi)

Failed merges:

r? @ghost

4 years agoFix Query type docs
Ömer Sinan Ağacan [Fri, 6 Dec 2019 07:41:48 +0000 (10:41 +0300)]
Fix Query type docs

`give` no longer exists, `compute` is used to generate query results
now.

4 years agoRollup merge of #67066 - alexcrichton:update-wasi-libc, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Dec 2019 06:37:14 +0000 (15:37 +0900)]
Rollup merge of #67066 - alexcrichton:update-wasi-libc, r=Mark-Simulacrum

Update the revision of wasi-libc used in wasm32-wasi

This commit updates the `wasi-libc` repository used to build the
wasm32-wasi target's libstd to ensure that both libstd and libc are
using the same wasi snapshot version.

4 years agoRollup merge of #67065 - alexcrichton:update-wasi, r=sfackler
Yuki Okushi [Fri, 6 Dec 2019 06:37:13 +0000 (15:37 +0900)]
Rollup merge of #67065 - alexcrichton:update-wasi, r=sfackler

Fix fetching arguments on the wasm32-wasi target

Fixes an error introduced in #66750 where wasi executables always think
they have zero arguments because one of the vectors returned here
accidentally thought it was length 0.

4 years agoRollup merge of #67041 - Wind-River:master_base, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 06:37:11 +0000 (15:37 +0900)]
Rollup merge of #67041 - Wind-River:master_base, r=alexcrichton

add ExitStatusExt into prelude

r? @alexcrichton

4 years agoRollup merge of #67021 - elichai:2019-12-fmt, r=QuietMisdreavus
Yuki Okushi [Fri, 6 Dec 2019 06:37:10 +0000 (15:37 +0900)]
Rollup merge of #67021 - elichai:2019-12-fmt, r=QuietMisdreavus

Fix docs for formatting delegations

If you use the example in the docs right now it breaks all the options Formatters have to offer.
i.e. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=214392ecc6eff73b4789c32568395f72 this should've padded the output with 4 zeros but didn't.

with the new example it does work: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3bdfb29f395230c5129c5f56dcfcb2a9

The only thing i'm not quite sure about is what's the right way to do it in a loop (altough non of the docs talk about it people are doing it in the wild and there were a couple of attempts to include in libcore)
i.e. https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4c4dca3c90ba36779ecd014f3899ab9c

4 years agoRollup merge of #67017 - GuillaumeGomez:long-err-explanations-2, r=Dylan-DPC
Yuki Okushi [Fri, 6 Dec 2019 06:37:08 +0000 (15:37 +0900)]
Rollup merge of #67017 - GuillaumeGomez:long-err-explanations-2, r=Dylan-DPC

cleanup long error explanations

r? @Dylan-DPC

4 years agoRollup merge of #66979 - reese:E0631-long-error, r=GuillaumeGomez
Yuki Okushi [Fri, 6 Dec 2019 06:37:06 +0000 (15:37 +0900)]
Rollup merge of #66979 - reese:E0631-long-error, r=GuillaumeGomez

Add long error for E0631 and update ui tests.

This PR adds a long error for `E0631`, which covers errors where closure argument types are mismatched. It also updates UI tests where this error is applicable.

Part of #61137

4 years agoRollup merge of #66974 - cuviper:not-isCI, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 06:37:04 +0000 (15:37 +0900)]
Rollup merge of #66974 - cuviper:not-isCI, r=alexcrichton

[CI] fix the `! isCI` check in src/ci/run.sh

Using `if [ ! isCI ] || ...` doesn't run any command, just tests `isCI`
as a string, whereas `if ! isCI || ...` will actually run the `isCI`
command and negate its exit status.

4 years agoRollup merge of #66900 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
Yuki Okushi [Fri, 6 Dec 2019 06:37:03 +0000 (15:37 +0900)]
Rollup merge of #66900 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC

Clean up error codes

r? @Dylan-DPC

4 years agoRollup merge of #66764 - estebank:reword-bad-collect, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 06:37:01 +0000 (15:37 +0900)]
Rollup merge of #66764 - estebank:reword-bad-collect, r=alexcrichton

Tweak wording of `collect()` on bad target type

Fix #60440.

4 years agoRollup merge of #66649 - Wind-River:master_xyz, r=alexcrichton
Yuki Okushi [Fri, 6 Dec 2019 06:36:56 +0000 (15:36 +0900)]
Rollup merge of #66649 - Wind-River:master_xyz, r=alexcrichton

VxWorks: fix issues in accessing environment variables

4 years agoAuto merge of #66835 - AviKozokin:master, r=alexcrichton
bors [Fri, 6 Dec 2019 04:30:51 +0000 (04:30 +0000)]
Auto merge of #66835 - AviKozokin:master, r=alexcrichton

std:win: avoid WSA_FLAG_NO_INHERIT flag and don't use SetHandleInformation on UWP

This flag is not supported on Windows 7 before SP1, and on windows server 2008 SP2. This breaks Socket creation & duplication.
This was fixed in a previous PR. cc #26658

This PR: cc #60260 reuses this flag to support UWP, and makes an attempt to handle the potential error.
This version still fails to create a socket, as the error returned by WSA on this case is WSAEINVAL (invalid argument). and not WSAEPROTOTYPE.

MSDN page for WSASocketW (that states the platform support for WSA_FLAG_NO_HANDLE_INHERIT): https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw

CC #26543
CC #26518

4 years agoAuto merge of #66911 - eddyb:nicer-rustc_regions, r=matthewjasper
bors [Fri, 6 Dec 2019 00:22:54 +0000 (00:22 +0000)]
Auto merge of #66911 - eddyb:nicer-rustc_regions, r=matthewjasper

rustc_mir: use nicer path printing for #[rustc_regions] NLL tests.

Similar to #66850, spotted while working on #66907.

r? @matthewjasper

4 years agouse abort instead of unreachable
Ralf Jung [Thu, 5 Dec 2019 22:59:30 +0000 (23:59 +0100)]
use abort instead of unreachable

4 years agoAuto merge of #67060 - Centril:rollup-hwhdx4h, r=Centril
bors [Thu, 5 Dec 2019 20:56:09 +0000 (20:56 +0000)]
Auto merge of #67060 - Centril:rollup-hwhdx4h, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #66710 (weak-into-raw: Clarify some details in Safety)
 - #66863 (Check break target availability when checking breaks with values)
 - #67002 (Fix documentation of pattern for str::matches())
 - #67005 (capitalize Rust)
 - #67010 (Accurately portray raw identifiers in error messages)
 - #67011 (Include a span in more `expected...found` notes)
 - #67044 (E0023: handle expected != tuple pattern type)
 - #67045 (rustc_parser: cleanup imports)
 - #67055 (Make const-qualification look at more `const fn`s)

Failed merges:

r? @ghost

4 years agoUpdate the revision of wasi-libc used in wasm32-wasi
Alex Crichton [Thu, 5 Dec 2019 19:36:35 +0000 (11:36 -0800)]
Update the revision of wasi-libc used in wasm32-wasi

This commit updates the `wasi-libc` repository used to build the
wasm32-wasi target's libstd to ensure that both libstd and libc are
using the same wasi snapshot version.

4 years agoFix fetching arguments on the wasm32-wasi target
Alex Crichton [Thu, 5 Dec 2019 19:01:26 +0000 (11:01 -0800)]
Fix fetching arguments on the wasm32-wasi target

Fixes an error introduced in #66750 where wasi executables always think
they have zero arguments because one of the vectors returned here
accidentally thought it was length 0.

4 years agoRollup merge of #67055 - lqd:const_qualif, r=oli-obk
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:21 +0000 (19:03 +0100)]
Rollup merge of #67055 - lqd:const_qualif, r=oli-obk

Make const-qualification look at more `const fn`s

As explained in a lot more detail in #67053 this makes const-qualification not ignore the unstable const fns in libcore.

r? @oli-obk cc @ecstatic-morse

(Still a bit unsure about the `cfg`s here, for bootstrapping, does that seem correct ?)

Fixes #67053.

4 years agoRollup merge of #67045 - Centril:parser-import-clean, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:20 +0000 (19:03 +0100)]
Rollup merge of #67045 - Centril:parser-import-clean, r=Mark-Simulacrum

rustc_parser: cleanup imports

Reorganize & canonicalize some imports + Drop `rustc_target` as a dependency.

r? @Mark-Simulacrum

4 years agoRollup merge of #67044 - Centril:67037, r=estebank
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:18 +0000 (19:03 +0100)]
Rollup merge of #67044 - Centril:67037, r=estebank

E0023: handle expected != tuple pattern type

Fixes #67037.

r? @estebank

4 years agoRollup merge of #67011 - Aaron1011:fix/expected-found-span, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:17 +0000 (19:03 +0100)]
Rollup merge of #67011 - Aaron1011:fix/expected-found-span, r=Dylan-DPC

Include a span in more `expected...found` notes

In most places, we use a span when emitting `expected...found` errors.
However, there were a couple of places where we didn't use any span,
resulting in hard-to-interpret error messages.

This commit attaches the relevant span to these notes, and additionally
switches over to using `note_expected_found` instead of manually
formatting the message

4 years agoRollup merge of #67010 - estebank:raw-idents, r=Centril
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:15 +0000 (19:03 +0100)]
Rollup merge of #67010 - estebank:raw-idents, r=Centril

Accurately portray raw identifiers in error messages

When refering to or suggesting raw identifiers, refer to them with `r#`.

Fix #65634.

4 years agoRollup merge of #67005 - andrewbanchich:master, r=joshtriplett
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:13 +0000 (19:03 +0100)]
Rollup merge of #67005 - andrewbanchich:master, r=joshtriplett

capitalize Rust

Capitalize "Rust" in docs.

4 years agoRollup merge of #67002 - JayXon:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:11 +0000 (19:03 +0100)]
Rollup merge of #67002 - JayXon:patch-1, r=Dylan-DPC

Fix documentation of pattern for str::matches()

Made it the same as rmatches()

4 years agoRollup merge of #66863 - osa1:fix_66702, r=cramertj
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:09 +0000 (19:03 +0100)]
Rollup merge of #66863 - osa1:fix_66702, r=cramertj

Check break target availability when checking breaks with values

Fixes #66702

I'll be adding a regression test.

4 years agoRollup merge of #66710 - vorner:weak-into-raw-null-docs, r=dtolnay
Mazdak Farrokhzad [Thu, 5 Dec 2019 18:03:08 +0000 (19:03 +0100)]
Rollup merge of #66710 - vorner:weak-into-raw-null-docs, r=dtolnay

weak-into-raw: Clarify some details in Safety

Clarify it is OK to pass a pointer that never owned a weak count (one
from Weak::new) back into it as it was created from it. Relates to
discussion in #60728.

@CAD97 Do you want to have a look at the new docs?

4 years agoAuto merge of #66828 - GuillaumeGomez:less-minification, r=kinnison
bors [Thu, 5 Dec 2019 17:45:31 +0000 (17:45 +0000)]
Auto merge of #66828 - GuillaumeGomez:less-minification, r=kinnison

Less minification

The goal of this PR is to remove the minification process on the `search-index.js` file. It provides great result in term of space reduction but the computation time is far too long. I'll work on this issue and will put it back once it's fast enough.

cc @nox @lqd
r? @kinnison

4 years agoupdate comment to explain the importance of this check more clearly
Remy Rakic [Thu, 5 Dec 2019 16:41:25 +0000 (17:41 +0100)]
update comment to explain the importance of this check more clearly

4 years agoAuto merge of #66815 - mark-i-m:simplify-borrow_check-errors, r=Dylan-DPC
bors [Thu, 5 Dec 2019 14:39:11 +0000 (14:39 +0000)]
Auto merge of #66815 - mark-i-m:simplify-borrow_check-errors, r=Dylan-DPC

Reorganize borrow check diagnostic code

Currently borrow checker diagnostics are split across many different modules in different places in the `librustc_mir` crate. This moves them all to a `diagnostics` module. This also reduces the nesting of the modules a bit (sooo much nesting).

I am also thinking of moving stuff out of the `nll` module since we only have one borrow checker now (:tada:), and maybe it even makes sense to split out all of this stuff to a `librustc_borrow_check`, but those are for the future. Feel free to ping me here or on zulip and let me know what you think...

cc @nikomatsakis @matthewjasper @eddyb

4 years agoweak-into-raw: Clarify some details in Safety
Michal 'vorner' Vaner [Sun, 24 Nov 2019 18:00:25 +0000 (19:00 +0100)]
weak-into-raw: Clarify some details in Safety

Clarify it is OK to pass a pointer that never owned a weak count (one
from Weak::new) back into it as it was created from it. Relates to
discussion in #60728.

4 years agoadd regression test for issue 67053
Remy Rakic [Thu, 5 Dec 2019 14:02:41 +0000 (15:02 +0100)]
add regression test for issue 67053

4 years agolibcore: rnable 2 unstable const fn features
Remy Rakic [Thu, 5 Dec 2019 14:01:30 +0000 (15:01 +0100)]
libcore: rnable 2 unstable const fn features

So that we can bootstrap successfully

4 years agomake const-qualif look at more `const fn`s
Remy Rakic [Thu, 5 Dec 2019 13:59:56 +0000 (14:59 +0100)]
make const-qualif look at more `const fn`s

the unstables ones in libcore, with the unstable feature disabled, were not checked

4 years agocomments
Ralf Jung [Thu, 5 Dec 2019 13:38:24 +0000 (14:38 +0100)]
comments

4 years agoadd a test
Ralf Jung [Thu, 5 Dec 2019 13:33:37 +0000 (14:33 +0100)]
add a test

4 years agocodegen: mark invalid SetDiscriminant unreachable
Ralf Jung [Thu, 5 Dec 2019 13:20:53 +0000 (14:20 +0100)]
codegen: mark invalid SetDiscriminant unreachable

4 years agoAuto merge of #66952 - 0dvictor:print, r=rkruppe
bors [Thu, 5 Dec 2019 11:23:26 +0000 (11:23 +0000)]
Auto merge of #66952 - 0dvictor:print, r=rkruppe

Use Module::print() instead of a PrintModulePass

llvm::Module has a print() method. It is unnecessary to create a pass just for the purpose of printing LLVM IR.

4 years agorustc_parser: cleanup imports
Mazdak Farrokhzad [Thu, 5 Dec 2019 05:38:06 +0000 (06:38 +0100)]
rustc_parser: cleanup imports

4 years agoAuto merge of #66520 - alexcrichton:disable-gdb-wasm, r=eddyb
bors [Thu, 5 Dec 2019 05:28:48 +0000 (05:28 +0000)]
Auto merge of #66520 - alexcrichton:disable-gdb-wasm, r=eddyb

Disable gdb pretty printer global section on wasm targets

The wasm targets don't support gdb anyway so there's no need for this
section there.

4 years agoE0023: handle expected != pat-tup-type
Mazdak Farrokhzad [Thu, 5 Dec 2019 03:36:53 +0000 (04:36 +0100)]
E0023: handle expected != pat-tup-type

4 years agoDisable gdb pretty printer global section on wasm targets
Alex Crichton [Mon, 18 Nov 2019 15:41:10 +0000 (07:41 -0800)]
Disable gdb pretty printer global section on wasm targets

The wasm targets don't support gdb anyway so there's no need for this
section there.

4 years agoMerge pull request #46 from Wind-River/master_base_V7LIBC-1069
n-salim [Thu, 5 Dec 2019 00:16:49 +0000 (16:16 -0800)]
Merge pull request #46 from Wind-River/master_base_V7LIBC-1069

add ExitStatusExt into prelude

4 years agoSimplify {IoSlice, IoSliceMut}::advance examples and tests
Tomasz Miąsko [Thu, 5 Dec 2019 00:00:00 +0000 (00:00 +0000)]
Simplify {IoSlice, IoSliceMut}::advance examples and tests

Remove unnecessary calls to `std::mem::replace` and make variables immutable.

4 years agoAuto merge of #67038 - RalfJung:miri, r=RalfJung
bors [Wed, 4 Dec 2019 23:07:13 +0000 (23:07 +0000)]
Auto merge of #67038 - RalfJung:miri, r=RalfJung

update miri

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

r? @ghost

4 years agoupdate miri
Ralf Jung [Wed, 4 Dec 2019 23:00:44 +0000 (00:00 +0100)]
update miri

4 years agoMigrate to LLVM{Get,Set}ValueName2
Josh Stone [Wed, 4 Dec 2019 20:00:28 +0000 (12:00 -0800)]
Migrate to LLVM{Get,Set}ValueName2

The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated
strings, but the `2` variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
`llvm::{get,set}_value_name` that convert to/from `&[u8]`.

4 years agoAuto merge of #66866 - oli-obk:const_fn_memoization, r=RalfJung
bors [Wed, 4 Dec 2019 17:48:19 +0000 (17:48 +0000)]
Auto merge of #66866 - oli-obk:const_fn_memoization, r=RalfJung

Only memoize const fn calls during const eval

Miri and other engines may want to execute the function in order to detect UB inside of them.

r? @RalfJung

4 years agoUpdate src/librustc_mir/interpret/terminator.rs
Oliver Scherer [Wed, 4 Dec 2019 15:38:58 +0000 (16:38 +0100)]
Update src/librustc_mir/interpret/terminator.rs

Co-Authored-By: Ralf Jung <post@ralfj.de>
4 years agomore private
Mark Mansi [Mon, 2 Dec 2019 23:05:25 +0000 (17:05 -0600)]
more private

4 years agominor fix
Mark Mansi [Fri, 29 Nov 2019 22:37:52 +0000 (16:37 -0600)]
minor fix

4 years agofix some imports
Mark Mansi [Wed, 27 Nov 2019 18:22:17 +0000 (12:22 -0600)]
fix some imports

4 years agomove region errors to diagnostics module
Mark Mansi [Wed, 27 Nov 2019 18:07:47 +0000 (12:07 -0600)]
move region errors to diagnostics module

4 years agofix imports
Mark Mansi [Wed, 27 Nov 2019 17:45:05 +0000 (11:45 -0600)]
fix imports

4 years agomove explain_borrow to diagnostics
Mark Mansi [Wed, 27 Nov 2019 17:44:58 +0000 (11:44 -0600)]
move explain_borrow to diagnostics

4 years agofix imports
Mark Mansi [Wed, 27 Nov 2019 17:39:25 +0000 (11:39 -0600)]
fix imports

4 years agocreate new borrow_check::diagnostics module and move stuff there
Mark Mansi [Wed, 27 Nov 2019 17:39:21 +0000 (11:39 -0600)]
create new borrow_check::diagnostics module and move stuff there

4 years agoSGX: Fix target linker used by bootstrap
Jethro Beekman [Wed, 4 Dec 2019 15:02:28 +0000 (16:02 +0100)]
SGX: Fix target linker used by bootstrap

4 years agoAuto merge of #66408 - nnethercote:greedy-process_obligations, r=nmatsakis
bors [Wed, 4 Dec 2019 14:33:38 +0000 (14:33 +0000)]
Auto merge of #66408 - nnethercote:greedy-process_obligations, r=nmatsakis

Make `process_obligations()` greedier.

`process_obligations()` adds new nodes, but it does not process these
new nodes until the next time it is called.

This commit changes it so that it does process these new nodes within
the same call. This change reduces the number of calls to
`process_obligations()` required to complete processing, sometimes
giving significant speed-ups.

The change required some changes to tests.
- The output of `cycle-cache-err-60010.rs` is slightly different.
- The unit tests required extra cases to handle the earlier processing
  of the added nodes. I mostly did these in the simplest possible way,
  by making the added nodes be ignored, thus giving outcomes the same as
  with the old behaviour. But I changed `success_in_grandchildren()`
  more extensively so that some obligations are completed earlier than
  they used to be.

r? @nikomatsakis

4 years agoFix docs for formatting delegations
Elichai Turkel [Wed, 4 Dec 2019 13:13:43 +0000 (15:13 +0200)]
Fix docs for formatting delegations

4 years agosome error codes long explanation
Guillaume Gomez [Wed, 4 Dec 2019 12:36:50 +0000 (13:36 +0100)]
some error codes long explanation

4 years agoClean up E0118 error code long explanation
Guillaume Gomez [Wed, 4 Dec 2019 12:35:26 +0000 (13:35 +0100)]
Clean up E0118 error code long explanation

4 years agoClean up E0117 error code long explanation
Guillaume Gomez [Wed, 4 Dec 2019 12:31:40 +0000 (13:31 +0100)]
Clean up E0117 error code long explanation

4 years agoClean up E0116 error code long explanation
Guillaume Gomez [Wed, 4 Dec 2019 12:27:17 +0000 (13:27 +0100)]
Clean up E0116 error code long explanation

4 years agoAuto merge of #66275 - oli-obk:organize-intrinsics-promotion-checks, r=RalfJung
bors [Wed, 4 Dec 2019 11:22:26 +0000 (11:22 +0000)]
Auto merge of #66275 - oli-obk:organize-intrinsics-promotion-checks, r=RalfJung

Organize intrinsics promotion checks

cc @vertexclique

supersedes #61835

r? @RalfJung

4 years agoRemove potential cfgs duplicates
Guillaume Gomez [Tue, 3 Dec 2019 17:07:00 +0000 (18:07 +0100)]
Remove potential cfgs duplicates

4 years agoAuto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisa
bors [Wed, 4 Dec 2019 08:22:05 +0000 (08:22 +0000)]
Auto merge of #65947 - eddyb:fn-abi, r=oli-obk,nagisa

rustc: split FnAbi's into definitions/direct calls ("of_instance") and indirect calls ("of_fn_ptr").

After this PR:
* `InstanceDef::Virtual` is only used for "direct" virtual calls, and shims around those calls use `InstanceDef::ReifyShim` (i.e. for `<dyn Trait as Trait>::f as fn(_)`)
  * this could easily be done for intrinsics as well, to allow their reification, but I didn't do it
* `FnAbi::of_instance` is **always** used for declaring/defining an `fn`, and for direct calls to an `fn`
  * this is great for e.g. https://github.com/rust-lang/rust/pull/65881 (`#[track_caller]`), which can introduce the "caller location" argument into "codegen signatures" by only changing `FnAbi::of_instance`, after this PR
* `FnAbi::of_fn_ptr` is used primarily for indirect calls, i.e. to `fn` pointers
  * *not* virtual calls (which use `FnAbi::of_instance` with `InstanceDef::Virtual`)
  * there's also a couple uses where the `rustc_codegen_llvm` needs to declare (i.e. FFI-import) an LLVM function that has no Rust declaration available at all
    * at least one of them could probably be a "weak lang item" instead

As there are many steps, this PR is best reviewed commit by commit - some of which arguably should be in their own PRs, I may have gotten carried away a bit.

cc @nagisa @rkruppe @oli-obk @anp

4 years agoAccount for raw idents in module file finding
Esteban Küber [Wed, 4 Dec 2019 06:25:44 +0000 (22:25 -0800)]
Account for raw idents in module file finding

4 years agoreview comments: move test
Esteban Küber [Wed, 4 Dec 2019 06:25:15 +0000 (22:25 -0800)]
review comments: move test

4 years agoAuto merge of #66996 - ehuss:update-cargo, r=alexcrichton
bors [Wed, 4 Dec 2019 05:07:34 +0000 (05:07 +0000)]
Auto merge of #66996 - ehuss:update-cargo, r=alexcrichton

Update cargo

11 commits in 750cb1482e4d0e74822cded7ab8b3c677ed8b041..626f0f40efd32e6b3dbade50cd53fdfaa08446ba
2019-11-23 23:06:36 +0000 to 2019-12-03 16:53:04 +0000
- Change some texts to links in README (rust-lang/cargo#7652)
- Update config and environment variable docs. (rust-lang/cargo#7650)
- Stop ignoring .rs.bk files; rustfmt hasn't generated them in years (rust-lang/cargo#7647)
- Various contributing docs updates. (rust-lang/cargo#7642)
- Stabilize profile-overrides. (rust-lang/cargo#7591)
- Update comment about ResolveVersion default version. (rust-lang/cargo#7637)
- Update tests for slight wording change in rustdoc error message. (rust-lang/cargo#7641)
- Remove dep_targets. (rust-lang/cargo#7626)
- vendor: don't use canonical path in .cargo/config (rust-lang/cargo#7629)
- Minor testsuite organization. (rust-lang/cargo#7628)
- Remove failing plugin tests. (rust-lang/cargo#7630)

4 years agoInclude a span in more `expected...found` notes
Aaron Hill [Wed, 4 Dec 2019 03:20:05 +0000 (22:20 -0500)]
Include a span in more `expected...found` notes

In most places, we use a span when emitting `expected...found` errors.
However, there were a couple of places where we didn't use any span,
resulting in hard-to-interpret error messages.

This commit attaches the relevant span to these notes, and additionally
switches over to using `note_expected_found` instead of manually
formatting the message