]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoFix the `-Zsanitizer_memory_track_origins` error message.
Nicholas Nethercote [Thu, 2 Apr 2020 04:58:07 +0000 (15:58 +1100)]
Fix the `-Zsanitizer_memory_track_origins` error message.

Currently, if you give a bogus value like
`-Zsanitizer-memory-track-origins=99` you get this incorrect error:
```
error: debugging option `sanitizer-memory-track-origins` takes no value
```
This commit fixes it so it gives this instead:
```
error: incorrect value `99` for debugging option `sanitizer-memory-track-origins` - 0, 1, or 2 was expected
```
The commit also makes `parse_sanitizer_memory_track_origins` more
readable.

4 years agoClean up the list of parser descriptions.
Nicholas Nethercote [Thu, 2 Apr 2020 05:06:08 +0000 (16:06 +1100)]
Clean up the list of parser descriptions.

Put identical ones next to each other, and avoid duplicated strings.

4 years agoAllow all boolean options to take values.
Nicholas Nethercote [Thu, 2 Apr 2020 04:47:11 +0000 (15:47 +1100)]
Allow all boolean options to take values.

They now all accept yes/no/y/n/on/off values. (Previously only some of
them did.)

This commit also makes `parse_bool` and `parse_opt_bool` more concise
and readable, and adds some helpful comments to some functions.

4 years agoMake some option descriptions fit the usual pattern.
Nicholas Nethercote [Tue, 31 Mar 2020 23:53:24 +0000 (10:53 +1100)]
Make some option descriptions fit the usual pattern.

- No trailing '.' chars.
- Use a lower-case letter at the start.

4 years agoAuto merge of #71102 - tmiasko:compiler-builtins, r=Mark-Simulacrum
bors [Sun, 19 Apr 2020 02:16:13 +0000 (02:16 +0000)]
Auto merge of #71102 - tmiasko:compiler-builtins, r=Mark-Simulacrum

Update compiler_builtins to 0.1.27

* aarch64: Exclude FP intrinsics on +nofp or +nosimd
* Place intrinsics in individual object files

https://github.com/rust-lang/compiler-builtins/compare/0.1.25...0.1.27

4 years agoAuto merge of #71306 - Dylan-DPC:rollup-kvzc1da, r=Dylan-DPC
bors [Sat, 18 Apr 2020 23:06:08 +0000 (23:06 +0000)]
Auto merge of #71306 - Dylan-DPC:rollup-kvzc1da, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71271 (Move `MapInPlace` to rustc_data_structures)
 - #71276 (miri-unleashed: test that we detect heap allocations)
 - #71283 (Minor improvements to -Zprofile)
 - #71287 (Explain why we shouldn't add inline attr to into_vec)
 - #71303 (remove build warnings)

Failed merges:

r? @ghost

4 years agoRollup merge of #71303 - tshepang:master, r=Mark-Simulacrum
Dylan DPC [Sat, 18 Apr 2020 23:04:56 +0000 (01:04 +0200)]
Rollup merge of #71303 - tshepang:master, r=Mark-Simulacrum

remove build warnings

Code blocks that are not annotated are assumed to be Rust

4 years agoRollup merge of #71287 - JohnTitor:comment-vec, r=RalfJung
Dylan DPC [Sat, 18 Apr 2020 23:04:54 +0000 (01:04 +0200)]
Rollup merge of #71287 - JohnTitor:comment-vec, r=RalfJung

Explain why we shouldn't add inline attr to into_vec

Follow-up of #71204
r? @RalfJung

4 years agoRollup merge of #71283 - Amanieu:zprofile, r=davidtwco
Dylan DPC [Sat, 18 Apr 2020 23:04:53 +0000 (01:04 +0200)]
Rollup merge of #71283 - Amanieu:zprofile, r=davidtwco

Minor improvements to -Zprofile

- `-Zprofile` is broken with codegen units because GCOV assumes that each source file corresponds to one object file. This PR makes `-Zprofile` automatically set codegen units to 1 and gives an error if `-Ccodegen-units=X` is specified on the command line (with `X != 1`).
- The `profiler_builtins` crate is not suitable for `no_std` applications since it contains C code that depends on libc. In such cases a custom implementation of the LLVM gcov API (`llvm_gcov_init`, `llvm_gcda_*`) is needed. This PR adds `-Zno-profiler-runtime` flag which inhibits automatic injection of the `profiler_builtins` crate.

cc @whitequark who implemented the original `-Zprofile` support

4 years agoRollup merge of #71276 - RalfJung:miri-unleash-box, r=ecstatic-morse
Dylan DPC [Sat, 18 Apr 2020 23:04:49 +0000 (01:04 +0200)]
Rollup merge of #71276 - RalfJung:miri-unleash-box, r=ecstatic-morse

miri-unleashed: test that we detect heap allocations

This removes the second-to-last use of `IS_SUPPORTED_IN_MIRI = false`.

r? @ecstatic-morse @oli-obk

4 years agoRollup merge of #71271 - JohnTitor:map-in-place, r=petrochenkov
Dylan DPC [Sat, 18 Apr 2020 23:04:47 +0000 (01:04 +0200)]
Rollup merge of #71271 - JohnTitor:map-in-place, r=petrochenkov

Move `MapInPlace` to rustc_data_structures

Follow-up of #67786, it fits the purpose of rustc_data_structures.
r? @petrochenkov

4 years agoremove build warnings
Tshepang Lekhonkhobe [Sat, 18 Apr 2020 16:39:40 +0000 (18:39 +0200)]
remove build warnings

Code blocks that are not annotated are assumed to be Rust

4 years agoExplain why we shouldn't add inline attr to into_vec
Yuki Okushi [Sat, 18 Apr 2020 16:03:43 +0000 (01:03 +0900)]
Explain why we shouldn't add inline attr to into_vec

4 years agoAuto merge of #71218 - eddyb:a-lifetime-stranded-in-fn-def, r=nikomatsakis
bors [Sat, 18 Apr 2020 14:15:31 +0000 (14:15 +0000)]
Auto merge of #71218 - eddyb:a-lifetime-stranded-in-fn-def, r=nikomatsakis

outlives: ignore lifetimes shallowly found in `ty::FnDef`s.

Fixes #70917 by restoring the pre-#70164 behavior for now.

r? @nikomatsakis

4 years agoAdd an option to inhibit automatic injection of profiler_builtins
Amanieu d'Antras [Fri, 17 Apr 2020 20:21:49 +0000 (21:21 +0100)]
Add an option to inhibit automatic injection of profiler_builtins

4 years agoAuto merge of #71278 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Sat, 18 Apr 2020 11:09:07 +0000 (11:09 +0000)]
Auto merge of #71278 - matthiaskrgr:submodule_upd, r=Dylan-DPC

submodules: update clippy from 6651c1b9 to 891e1a85

This PR gets `cargo clippy --fix -Zunstable-options` into nightly :tada:

Changes:
````
Polished lint and tests
Added final lint and tests
Added basic lint and tests
fix redundant_pattern_matching lint
add lint futures_not_send
Integrate more idiomatic rust changes.
Fix issue #4892.
cargo dev fmt
Cleanup: Rename 'db' variable to 'diag'
question_mark: don't add `as_ref()` for a call expression
unit_arg suggestion may be incorrect
readme: update to cargo clippy --fix command
CI: performing system upgrade fixes broken apt deps on ubuntu 32bit
Do not lint in macros for match lints
[fix] Minor typo in GH Actions 'clippy_dev'
Reenable rustfmt integration test
Add test to map_flatten with an Option
Lint map_flatten if caller is an Option
Apply suggestions from code review
manually fixing formatting at this point lol
fmt
rename field
revert the damn fmt changes
add some tests
split it up for testing but the merge broke tests
dogfood tasted bad
fix rustfmt issue
boycott manish
check for unstable options
Start work on clippy-fix as subcommand
````

Should be save to rollup since we are in no-toolstate-break week (I also didn't see any breakage when testing the clippy with  28742a114)

4 years agosubmodules: update clippy from 6651c1b9 to 891e1a85
Matthias Krüger [Sat, 18 Apr 2020 10:44:30 +0000 (12:44 +0200)]
submodules: update clippy from 6651c1b9 to 891e1a85

Changes:
````
Polished lint and tests
Added final lint and tests
Added basic lint and tests
fix redundant_pattern_matching lint
add lint futures_not_send
Integrate more idiomatic rust changes.
Fix issue #4892.
cargo dev fmt
Cleanup: Rename 'db' variable to 'diag'
question_mark: don't add `as_ref()` for a call expression
unit_arg suggestion may be incorrect
readme: update to cargo clippy --fix command
CI: performing system upgrade fixes broken apt deps on ubuntu 32bit
Do not lint in macros for match lints
[fix] Minor typo in GH Actions 'clippy_dev'
Reenable rustfmt integration test
Add test to map_flatten with an Option
Lint map_flatten if caller is an Option
Apply suggestions from code review
manually fixing formatting at this point lol
fmt
rename field
revert the damn fmt changes
add some tests
split it up for testing but the merge broke tests
dogfood tasted bad
fix rustfmt issue
boycott manish
check for unstable options
Start work on clippy-fix as subcommand
````

4 years agomiri-unleashed: test that we detect heap allocations
Ralf Jung [Sat, 18 Apr 2020 09:16:07 +0000 (11:16 +0200)]
miri-unleashed: test that we detect heap allocations

4 years agocheck_consts: make ops module private
Ralf Jung [Sat, 18 Apr 2020 09:15:23 +0000 (11:15 +0200)]
check_consts: make ops module private

4 years agoAuto merge of #71204 - JohnTitor:into-vec, r=wesleywiser
bors [Sat, 18 Apr 2020 08:03:38 +0000 (08:03 +0000)]
Auto merge of #71204 - JohnTitor:into-vec, r=wesleywiser

perf: Remove inline attribute from `into_vec()`

It was introduced in #70565 and is likely related to this perf results: https://perf.rust-lang.org/compare.html?start=1edcfc83c6a08ddc5e63fc652b149baea0236e7c&end=d249d756374737eb014079901ac132f1e1ed905e&stat=instructions:u
Let's check if it's related to that.
r? @wesleywiser could you kick off perf check? I don't think I can do it.

4 years agoMove `MapInPlace` to rustc_data_structures
Yuki Okushi [Sat, 18 Apr 2020 04:01:54 +0000 (13:01 +0900)]
Move `MapInPlace` to rustc_data_structures

4 years agoAuto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrum
bors [Sat, 18 Apr 2020 01:37:27 +0000 (01:37 +0000)]
Auto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrum

Update the minimum external LLVM to 8

LLVM 8 was released on March 20, 2019, over a year ago.

4 years agoAuto merge of #71264 - Dylan-DPC:rollup-njgbey7, r=Dylan-DPC
bors [Fri, 17 Apr 2020 21:57:06 +0000 (21:57 +0000)]
Auto merge of #71264 - Dylan-DPC:rollup-njgbey7, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70467 (Use `call` instead of `invoke` for functions that cannot unwind )
 - #71070 (rustbuild: Remove stage 0 LLD flavor workaround for MSVC)
 - #71167 (big-O notation: parenthesis for function calls, explicit multiplication)
 - #71238 (Miri: fix typo)
 - #71242 (Format Mailmap To Work With GitHub)
 - #71243 (Account for use of `try!()` in 2018 edition and guide users in the right direction)

Failed merges:

r? @ghost

4 years agoRollup merge of #71243 - Duddino:Fix2, r=estebank
Dylan DPC [Fri, 17 Apr 2020 21:56:04 +0000 (23:56 +0200)]
Rollup merge of #71243 - Duddino:Fix2, r=estebank

Account for use of `try!()` in 2018 edition and guide users in the right direction

fixes #71155

4 years agoRollup merge of #71242 - XAMPPRocky:mailmap, r=Dylan-DPC
Dylan DPC [Fri, 17 Apr 2020 21:56:03 +0000 (23:56 +0200)]
Rollup merge of #71242 - XAMPPRocky:mailmap, r=Dylan-DPC

Format Mailmap To Work With GitHub

r? @Mark-Simulacrum

4 years agoRollup merge of #71238 - RalfJung:miri-typo, r=oli-obk
Dylan DPC [Fri, 17 Apr 2020 21:56:01 +0000 (23:56 +0200)]
Rollup merge of #71238 - RalfJung:miri-typo, r=oli-obk

Miri: fix typo

r? @oli-obk at least I think this should be "without", right?

4 years agoRollup merge of #71167 - RalfJung:big-o, r=shepmaster
Dylan DPC [Fri, 17 Apr 2020 21:56:00 +0000 (23:56 +0200)]
Rollup merge of #71167 - RalfJung:big-o, r=shepmaster

big-O notation: parenthesis for function calls, explicit multiplication

I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing.

This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here.

While I was at it I also added backticks consistently.

4 years agoRollup merge of #71070 - petrochenkov:nolldaround, r=Mark-Simulacrum
Dylan DPC [Fri, 17 Apr 2020 21:55:58 +0000 (23:55 +0200)]
Rollup merge of #71070 - petrochenkov:nolldaround, r=Mark-Simulacrum

rustbuild: Remove stage 0 LLD flavor workaround for MSVC

4 years agoRollup merge of #70467 - wesleywiser:invoke-vs-call, r=nagisa
Dylan DPC [Fri, 17 Apr 2020 21:55:56 +0000 (23:55 +0200)]
Rollup merge of #70467 - wesleywiser:invoke-vs-call, r=nagisa

Use `call` instead of `invoke` for functions that cannot unwind

The `FnAbi` now knows if the function is allowed to unwind. If a
function isn't allowed to unwind, we can use a `call` instead of an
`invoke`.

This resolves an issue when calling LLVM intrinsics which cannot unwind
LLVM will generate an error if you attempt to invoke them so we need to
ignore cleanup blocks in codegen and generate a call instead.

Fixes #69911

r? @eddyb
cc @rust-lang/wg-ffi-unwind

4 years agoMake -Zprofile set codegen-units to 1
Amanieu d'Antras [Fri, 17 Apr 2020 18:53:31 +0000 (19:53 +0100)]
Make -Zprofile set codegen-units to 1

4 years agoAuto merge of #71255 - Dylan-DPC:rollup-u5yl04z, r=Dylan-DPC
bors [Fri, 17 Apr 2020 18:36:53 +0000 (18:36 +0000)]
Auto merge of #71255 - Dylan-DPC:rollup-u5yl04z, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69642 (Use query to determine whether function needs const checking)
 - #71239 (Rename `asm` test directory in favor of `llvm_asm`)
 - #71246 (Implement `Clone` for `liballoc::collections::linked_list::Cursor`.)
 - #71247 (Remove unnecessary variable intialization)
 - #71254 (Minor fix and addition to doc comments)

Failed merges:

r? @ghost

4 years agoRollup merge of #71254 - JOE1994:add_comment, r=jonas-schievink
Dylan DPC [Fri, 17 Apr 2020 18:35:25 +0000 (20:35 +0200)]
Rollup merge of #71254 - JOE1994:add_comment, r=jonas-schievink

Minor fix and addition to doc comments

1. Fixed doc comment of struct 'rustc_middle::mir::Location'
Currently, the general explanation of the struct appears at the field
explanation section. I moved and changed the doc comments slightly, so
that the general explanation would appear in the proper location in
docs.
2. Added doc comment explaining 'rustc_mir::util::pretty::write_mir_fn'
Unlike other counterparts, brief explanation for this function was missing,
so I added one.

Thank you for reviewing this PR :)

4 years agoRollup merge of #71247 - ldm0:minor, r=estebank
Dylan DPC [Fri, 17 Apr 2020 18:35:24 +0000 (20:35 +0200)]
Rollup merge of #71247 - ldm0:minor, r=estebank

Remove unnecessary variable intialization

Minor fix.

4 years agoRollup merge of #71246 - crlf0710:linked_list_cursor, r=Amanieu
Dylan DPC [Fri, 17 Apr 2020 18:35:22 +0000 (20:35 +0200)]
Rollup merge of #71246 - crlf0710:linked_list_cursor, r=Amanieu

Implement `Clone` for `liballoc::collections::linked_list::Cursor`.

This implements `Clone` for linked list `Cursor`. Implementing `Copy` is also possible here, but i'm not sure whether i should also do it.

r? @Amanieu

4 years agoRollup merge of #71239 - JohnTitor:llvm-asm, r=Amanieu
Dylan DPC [Fri, 17 Apr 2020 18:35:21 +0000 (20:35 +0200)]
Rollup merge of #71239 - JohnTitor:llvm-asm, r=Amanieu

Rename `asm` test directory in favor of `llvm_asm`

r? @Amanieu

4 years agoRollup merge of #69642 - ecstatic-morse:issue-69615, r=oli-obk
Dylan DPC [Fri, 17 Apr 2020 18:35:19 +0000 (20:35 +0200)]
Rollup merge of #69642 - ecstatic-morse:issue-69615, r=oli-obk

Use query to determine whether function needs const checking

Resolves #69615.

The HIR const-checker was checking the `constness` of a function's `fn_sig` to determine whether a function needed const-checking. Now that const trait impls are a thing, this is no longer enough. All code should use the `is_const_fn_raw` query instead, which takes the constness of the impl block into account.

r? @oli-obk

4 years agoImproved try_macro_suggestion function
Duddino [Fri, 17 Apr 2020 17:29:36 +0000 (19:29 +0200)]
Improved try_macro_suggestion function

4 years agoMinor fix and addition to doc comments
JOE1994 [Fri, 17 Apr 2020 17:24:33 +0000 (13:24 -0400)]
Minor fix and addition to doc comments
1. Fixed doc comment of struct 'rustc_middle::mir::Location'
Currently, the general explanation of the struct appears at the field
explanation section. I moved and changed the doc comments slightly, so
that the general explanation would appear in the proper location in
docs.
2. Added doc comment explaining 'rustc_mir::util::pretty::write_mir_fn'
Unlike other counterparts, brief explanation for this function was missing,
so I added one.

Thank you for reviewing this PR :)

4 years agoImproved try_macro_suggestion
Duddino [Fri, 17 Apr 2020 17:10:29 +0000 (19:10 +0200)]
Improved try_macro_suggestion

4 years agoMoved is_try check into try_macro_suggestion
Duddino [Fri, 17 Apr 2020 16:26:39 +0000 (18:26 +0200)]
Moved is_try check into try_macro_suggestion

4 years agoImplement `Clone` for `liballoc::collections::linked_list::Cursor`.
Charles Lew [Fri, 17 Apr 2020 13:10:48 +0000 (21:10 +0800)]
Implement `Clone` for `liballoc::collections::linked_list::Cursor`.

4 years agoRemove unnecessary variable intialization
Donough Liu [Sat, 11 Apr 2020 07:53:10 +0000 (15:53 +0800)]
Remove unnecessary variable intialization

4 years agoAccount for use of `try!()` in 2018 edition and guide users in the right direction
Duddino [Fri, 17 Apr 2020 12:07:44 +0000 (14:07 +0200)]
Account for use of `try!()` in 2018 edition and guide users in the right direction

4 years agoAuto merge of #71049 - eddyb:const-err, r=oli-obk
bors [Fri, 17 Apr 2020 11:52:01 +0000 (11:52 +0000)]
Auto merge of #71049 - eddyb:const-err, r=oli-obk

Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it.

By replicating the `ty::Error` approach to encoding "an error has occurred", all of the mechanisms that skip redundant/downstream errors are engaged and help out (see the reduction in test output).

This PR also adds `ErrorHandled::Linted` for the lint case because using `ErrorHandled::Reported` *without* having emitted an error that is *guaranteed* to stop compilation, is incorrect now.

r? @oli-obk cc @rust-lang/wg-const-eval @varkor @yodaldevoid

4 years agoFormat Mailmap To Work With GitHub
XAMPPRocky [Fri, 17 Apr 2020 11:33:33 +0000 (13:33 +0200)]
Format Mailmap To Work With GitHub

4 years agoRename `asm` test directory in favor of `llvm_asm`
Yuki Okushi [Fri, 17 Apr 2020 09:36:16 +0000 (18:36 +0900)]
Rename `asm` test directory in favor of `llvm_asm`

4 years agoMiri: fix typo
Ralf Jung [Fri, 17 Apr 2020 09:23:20 +0000 (11:23 +0200)]
Miri: fix typo

4 years agoAuto merge of #70629 - anyska:fields-variant, r=oli-obk
bors [Fri, 17 Apr 2020 08:42:51 +0000 (08:42 +0000)]
Auto merge of #70629 - anyska:fields-variant, r=oli-obk

rustc_target::abi: add Primitive variant to FieldsShape.

Originally suggested by @eddyb.

4 years agoAuto merge of #71230 - Dylan-DPC:rollup-rofigbv, r=Dylan-DPC
bors [Fri, 17 Apr 2020 04:15:18 +0000 (04:15 +0000)]
Auto merge of #71230 - Dylan-DPC:rollup-rofigbv, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #70578 (Add long error explanation for E0657)
 - #70910 (Hides default fns inside Fuse impl to avoid exposing it to any crate)
 - #71164 (reword Miri validity errors: undefined -> uninitialized)
 - #71182 (Add some regression tests)
 - #71206 (Miri error messages: avoid try terminology)
 - #71220 (Dogfood or_patterns in the standard library)
 - #71225 (Fix typo in Default trait docs: Provides -> Provide)

Failed merges:

r? @ghost

4 years agoRollup merge of #71225 - leocassarani:patch-1, r=jonas-schievink
Dylan DPC [Fri, 17 Apr 2020 01:05:21 +0000 (03:05 +0200)]
Rollup merge of #71225 - leocassarani:patch-1, r=jonas-schievink

Fix typo in Default trait docs: Provides -> Provide

An earlier commit (99ed06e) accidentally changed this paragraph from the original, imperative `Provide` to the present tense `Provides`. The latter is indeed the standard for Rustdoc comments relating to a function or method, but this snippet is introducing the `Default` trait in general terms and not talking about any particular function. I believe this change was likely made in error and should be reverted.

4 years agoRollup merge of #71220 - cuviper:std_or_patterns, r=Mark-Simulacrum
Dylan DPC [Fri, 17 Apr 2020 01:05:19 +0000 (03:05 +0200)]
Rollup merge of #71220 - cuviper:std_or_patterns, r=Mark-Simulacrum

Dogfood or_patterns in the standard library

We can start using `or_patterns` in the standard library as a step toward stabilization.

cc #54883 @Centril

4 years agoRollup merge of #71206 - RalfJung:dont-try, r=oli-obk
Dylan DPC [Fri, 17 Apr 2020 01:05:18 +0000 (03:05 +0200)]
Rollup merge of #71206 - RalfJung:dont-try, r=oli-obk

Miri error messages: avoid try terminology

r? @oli-obk

4 years agoRollup merge of #71182 - JohnTitor:regression-tests, r=Mark-Simulacrum
Dylan DPC [Fri, 17 Apr 2020 01:05:16 +0000 (03:05 +0200)]
Rollup merge of #71182 - JohnTitor:regression-tests, r=Mark-Simulacrum

Add some regression tests

Closes #24843
Closes #28575
Closes #54067
Closes #66868
Closes #67893
Closes #68813

4 years agoRollup merge of #71164 - RalfJung:uninit-not-undef, r=oli-obk
Dylan DPC [Fri, 17 Apr 2020 01:05:15 +0000 (03:05 +0200)]
Rollup merge of #71164 - RalfJung:uninit-not-undef, r=oli-obk

reword Miri validity errors: undefined -> uninitialized

I don't think we say "undefined value" or anything like that anywhere in the docs or so, but we do use the term "uninitialized memory", so I think we should do the same here.

Longer-term, I think we should also internally rename "undef" to "uninit".

r? @oli-obk

4 years agoRollup merge of #70910 - rakshith-ravi:master, r=cuviper
Dylan DPC [Fri, 17 Apr 2020 01:05:13 +0000 (03:05 +0200)]
Rollup merge of #70910 - rakshith-ravi:master, r=cuviper

Hides default fns inside Fuse impl to avoid exposing it to any crate

Fixes #70796

@cuviper I've added some default, private traits to do the job for us. If required, I can expose them to a specific visibility if you want to call these functions for #70332

r? @cuviper

4 years agoRollup merge of #70578 - PankajChaudhary5:master, r=GuillaumeGomez
Dylan DPC [Fri, 17 Apr 2020 01:05:11 +0000 (03:05 +0200)]
Rollup merge of #70578 - PankajChaudhary5:master, r=GuillaumeGomez

Add long error explanation for E0657

Added proper error explanation for issue E0657 in the Rust compiler.

Part of #61137

r? @GuillaumeGomez

4 years agoAuto merge of #71131 - pnkfelix:issue-69798-dont-reuse-post-lto-products-when-exports...
bors [Fri, 17 Apr 2020 00:44:24 +0000 (00:44 +0000)]
Auto merge of #71131 - pnkfelix:issue-69798-dont-reuse-post-lto-products-when-exports-change, r=nagisa

Do not reuse post LTO products when exports change

Do not reuse post lto products when exports change

Generalizes code from PR #67020, which handled case when imports change.

Fix #69798

4 years agoFix typo in Default trait docs: Provides -> Provide
Leo Cassarani [Thu, 16 Apr 2020 21:30:53 +0000 (22:30 +0100)]
Fix typo in Default trait docs: Provides -> Provide

An earlier commit (99ed06e) accidentally changed this paragraph from the
original, imperative "Provide" to the present tense "Provides". The
latter is indeed the standard for Rustdoc comments relating to a
function or method, but this snippet is introducing the Default trait in
general terms and not talking about any particular function. I believe
this change was likely made in error and should be reverted.

4 years agoAuto merge of #71223 - Dylan-DPC:rollup-z5itu39, r=Dylan-DPC
bors [Thu, 16 Apr 2020 21:36:23 +0000 (21:36 +0000)]
Auto merge of #71223 - Dylan-DPC:rollup-z5itu39, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70611 (Add long error explanation for E0708 #61137)
 - #71197 (Don't use the HirId to NodeId map in MIR)
 - #71211 (Update cargo)
 - #71219 (Minor fixes to doc comments of 'VecDeque')
 - #71221 (Dogfood or_patterns in rustdoc)

Failed merges:

r? @ghost

4 years agoRollup merge of #71221 - cuviper:rustdoc_or_patterns, r=Mark-Simulacrum
Dylan DPC [Thu, 16 Apr 2020 21:34:46 +0000 (23:34 +0200)]
Rollup merge of #71221 - cuviper:rustdoc_or_patterns, r=Mark-Simulacrum

Dogfood or_patterns in rustdoc

We can start using `or_patterns` in `rustdoc` as a step toward stabilization.

cc #54883 @Centril

4 years agoRollup merge of #71219 - JOE1994:patch-4, r=Mark-Simulacrum
Dylan DPC [Thu, 16 Apr 2020 21:34:45 +0000 (23:34 +0200)]
Rollup merge of #71219 - JOE1994:patch-4, r=Mark-Simulacrum

Minor fixes to doc comments of 'VecDeque'

1. Changed descriptions of `fn get` & `fn get_mut`.
  Since both of these functions are returning references, and not the owned value, I thought the doc comments could be fixed to be consistent with doc comments of `fn front` & `fn front_mut`.

2. Other changes are minor fixes or additions for clarification.

Thank you for taking a look :)

4 years agoRollup merge of #71211 - ehuss:update-cargo, r=ehuss
Dylan DPC [Thu, 16 Apr 2020 21:34:43 +0000 (23:34 +0200)]
Rollup merge of #71211 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 74e3a7d5b756d7c0e94399fc29fcd154e792c22a..ebda5065ee8a1e46801380abcbac21a25bc7e755
2020-04-13 20:41:52 +0000 to 2020-04-16 14:28:43 +0000
- Don't use debug display for error object. (rust-lang/cargo#8119)
- Add backwards-compatibility for old cargo-tree flags. (rust-lang/cargo#8115)
- Try to avoid panics on buggy (?) clocks (rust-lang/cargo#8114)

4 years agoRollup merge of #71197 - ljedrz:unsafe_unused, r=ecstatic-morse
Dylan DPC [Thu, 16 Apr 2020 21:34:42 +0000 (23:34 +0200)]
Rollup merge of #71197 - ljedrz:unsafe_unused, r=ecstatic-morse

Don't use the HirId to NodeId map in MIR

Another step towards not having to build a `HirId` to `NodeId` map other than for doc and RLS purposes.

We are currently sorting `unsafe` blocks by `NodeId` in `check_unsafety`; change it to sorting by `Span` instead; this passes the tests, but better ideas are welcome.

In addition, simplify the split between the used and unused `unsafe` blocks for readability and less sorting.

cc https://github.com/rust-lang/rust/issues/50928

4 years agoRollup merge of #70611 - pawanbisht62:doc/61137-add-long-error-code-e0708, r=Guillaum...
Dylan DPC [Thu, 16 Apr 2020 21:34:41 +0000 (23:34 +0200)]
Rollup merge of #70611 - pawanbisht62:doc/61137-add-long-error-code-e0708, r=GuillaumeGomez

Add long error explanation for E0708 #61137

Add long explanation for the E0708 error code
Part of #61137

r? @GuillaumeGomez

4 years agoAvoid emitting stderr for now
Yuki Okushi [Thu, 16 Apr 2020 15:14:52 +0000 (00:14 +0900)]
Avoid emitting stderr for now

4 years agoAdd test for issue-67893
Yuki Okushi [Thu, 16 Apr 2020 01:09:59 +0000 (10:09 +0900)]
Add test for issue-67893

4 years agoAdd test for issue-54067
Yuki Okushi [Thu, 16 Apr 2020 01:09:47 +0000 (10:09 +0900)]
Add test for issue-54067

4 years agoAdd test for issue-28575
Yuki Okushi [Thu, 16 Apr 2020 01:09:34 +0000 (10:09 +0900)]
Add test for issue-28575

4 years agoAdd test for issue-24843
Yuki Okushi [Thu, 16 Apr 2020 01:09:16 +0000 (10:09 +0900)]
Add test for issue-24843

4 years agoDogfood or_patterns in rustdoc
Josh Stone [Thu, 16 Apr 2020 20:58:47 +0000 (13:58 -0700)]
Dogfood or_patterns in rustdoc

4 years agoMinor fixes to doc comments of 'VecDequeue'
Youngsuk Kim [Thu, 16 Apr 2020 20:26:14 +0000 (16:26 -0400)]
Minor fixes to doc comments of 'VecDequeue'

1. Changed descriptions of `fn get` & `fn get_mut`.
  Since both of these functions are returning references, and not the owned value, I thought the doc comments could be fixed to be consistent with doc comments of `fn front` & `fn front_mut`.

2. Other changes are minor fixes or additions for clarification.

Thank you for taking a look :)

4 years agooutlives: ignore lifetimes shallowly found in `ty::FnDef`s.
Eduard-Mihai Burtescu [Thu, 16 Apr 2020 20:18:44 +0000 (23:18 +0300)]
outlives: ignore lifetimes shallowly found in `ty::FnDef`s.

4 years agoDogfood or_patterns in the standard library
Josh Stone [Thu, 16 Apr 2020 19:44:57 +0000 (12:44 -0700)]
Dogfood or_patterns in the standard library

4 years agoAuto merge of #71201 - Dylan-DPC:rollup-23202uf, r=Dylan-DPC
bors [Thu, 16 Apr 2020 18:02:11 +0000 (18:02 +0000)]
Auto merge of #71201 - Dylan-DPC:rollup-23202uf, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #70566 (Don't bail out before linting in generic contexts.)
 - #71141 (Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa)
 - #71149 (remove an impossible branch from check_consts)
 - #71179 (fix more clippy warnings)
 - #71191 (Clean up E0520 explanation)

Failed merges:

r? @ghost

4 years agocomment on the sorting of unused unsafe blocks
ljedrz [Thu, 16 Apr 2020 18:00:54 +0000 (20:00 +0200)]
comment on the sorting of unused unsafe blocks

4 years agoUpdate cargo
Eric Huss [Thu, 16 Apr 2020 17:16:11 +0000 (10:16 -0700)]
Update cargo

4 years agobikeshed
Ralf Jung [Thu, 16 Apr 2020 16:47:05 +0000 (18:47 +0200)]
bikeshed

4 years agoty: convert `ErrorHandled::Reported` to `ConstKind::Error`.
Eduard-Mihai Burtescu [Sun, 12 Apr 2020 04:16:38 +0000 (07:16 +0300)]
ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.

4 years agomir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.
Eduard-Mihai Burtescu [Sun, 12 Apr 2020 01:24:25 +0000 (04:24 +0300)]
mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.

4 years agoPartially revert "Do not ICE in the face of invalid enum discriminant"
Eduard-Mihai Burtescu [Thu, 16 Apr 2020 10:48:17 +0000 (13:48 +0300)]
Partially revert "Do not ICE in the face of invalid enum discriminant"

This (partially) reverts commit f47c4ffdfacc783b3fe4bad395a6e16ae296b3d1.

4 years agoty: add `ty::ConstKind::Error` to replace `tcx.consts.err`.
Eduard-Mihai Burtescu [Thu, 16 Apr 2020 10:47:47 +0000 (13:47 +0300)]
ty: add `ty::ConstKind::Error` to replace `tcx.consts.err`.

4 years agoMiri error messages: avoid try terminology
Ralf Jung [Thu, 16 Apr 2020 15:41:28 +0000 (17:41 +0200)]
Miri error messages: avoid try terminology

4 years agoRemove inline attribute from `into_vec()`
Yuki Okushi [Thu, 16 Apr 2020 15:23:44 +0000 (00:23 +0900)]
Remove inline attribute from `into_vec()`

4 years agorustc_target::abi: add Primitive variant to FieldsShape.
Ana-Maria Mihalache [Thu, 16 Apr 2020 15:15:46 +0000 (15:15 +0000)]
rustc_target::abi: add Primitive variant to FieldsShape.

4 years agoRollup merge of #71191 - GuillaumeGomez:cleanup-e0520, r=Dylan-DPC
Dylan DPC [Thu, 16 Apr 2020 14:34:32 +0000 (16:34 +0200)]
Rollup merge of #71191 - GuillaumeGomez:cleanup-e0520, r=Dylan-DPC

Clean up E0520 explanation

r? @Dylan-DPC

4 years agoRollup merge of #71179 - matthiaskrgr:cl6ppy, r=Dylan-DPC
Dylan DPC [Thu, 16 Apr 2020 14:34:30 +0000 (16:34 +0200)]
Rollup merge of #71179 - matthiaskrgr:cl6ppy, r=Dylan-DPC

fix more clippy warnings

4 years agoRollup merge of #71149 - RalfJung:check-const-call, r=eddyb
Dylan DPC [Thu, 16 Apr 2020 14:34:29 +0000 (16:34 +0200)]
Rollup merge of #71149 - RalfJung:check-const-call, r=eddyb

remove an impossible branch from check_consts

All function calleess are either `FnPtr` or `FnDef`, so we can remove the alternative from check_consts and just make it ICE instead.

4 years agoRollup merge of #71141 - Duddino:master, r=estebank
Dylan DPC [Thu, 16 Apr 2020 14:34:27 +0000 (16:34 +0200)]
Rollup merge of #71141 - Duddino:master, r=estebank

Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa

Fixes #71089

4 years agoRollup merge of #70566 - jumbatm:exceeding-bitshifts-constprop, r=RalfJung
Dylan DPC [Thu, 16 Apr 2020 14:34:23 +0000 (16:34 +0200)]
Rollup merge of #70566 - jumbatm:exceeding-bitshifts-constprop, r=RalfJung

Don't bail out before linting in generic contexts.

Fixes #69021.

cc #70017

r? @RalfJung

4 years agoAuto merge of #70755 - wesleywiser:simplify_locals_2_electric_boogaloo, r=oli-obk
bors [Thu, 16 Apr 2020 14:26:43 +0000 (14:26 +0000)]
Auto merge of #70755 - wesleywiser:simplify_locals_2_electric_boogaloo, r=oli-obk

[mir-opt] Run SimplifyLocals to a fixedpoint and handle most rvalues

Follow up to review feedback left on #70595.

4 years agosort unused unsafe blocks by Span instead of NodeId
ljedrz [Thu, 16 Apr 2020 12:53:09 +0000 (14:53 +0200)]
sort unused unsafe blocks by Span instead of NodeId

4 years agoRespond to code review feedback
Wesley Wiser [Thu, 16 Apr 2020 12:34:37 +0000 (08:34 -0400)]
Respond to code review feedback

- Remove reads of indirect `Place`s
- Add comments explaining what the algorithm does

4 years agosimplify unused unsafe block handling
ljedrz [Thu, 16 Apr 2020 12:24:52 +0000 (14:24 +0200)]
simplify unused unsafe block handling

4 years agoClean up E0520 explanation
Guillaume Gomez [Thu, 16 Apr 2020 11:51:02 +0000 (13:51 +0200)]
Clean up E0520 explanation

4 years agotest fast path offset reporting
Ralf Jung [Thu, 16 Apr 2020 11:21:23 +0000 (13:21 +0200)]
test fast path offset reporting

4 years agoswitch back to 'bytes'
Ralf Jung [Thu, 16 Apr 2020 11:19:51 +0000 (13:19 +0200)]
switch back to 'bytes'

4 years agoAuto merge of #70831 - sfackler:shrink-future-stack, r=matthewjasper
bors [Thu, 16 Apr 2020 09:13:07 +0000 (09:13 +0000)]
Auto merge of #70831 - sfackler:shrink-future-stack, r=matthewjasper

Remove a stack frame from .await calls

The stack frames when `.await`ing one async fn from another currently look like this:

```
  12: foo::b::{{closure}}
             at src/main.rs:2
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66
  14: core::future::poll_with_context
             at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:84
  15: foo::a::{{closure}}
             at src/main.rs:6
```

Since the move away from using TLS to pass the Context around, it's now easy to remove frame 14 by removing poll_with_context in favor of calling Future::poll directly. This still leaves the `GenFuture` frame, but that seems significantly harder to deal with.

It also improves diagnostics a bit since they no longer talk about the private poll_with_context function.

4 years agoAuto merge of #71173 - RalfJung:miri, r=RalfJung
bors [Thu, 16 Apr 2020 05:47:24 +0000 (05:47 +0000)]
Auto merge of #71173 - RalfJung:miri, r=RalfJung

bump Miri

Fixes https://github.com/rust-lang/rust/issues/71110
r? @ghost Cc @rust-lang/miri

4 years agoAuto merge of #71159 - topecongiro:rustfmt-1.4.14, r=Dylan-DPC
bors [Thu, 16 Apr 2020 02:10:29 +0000 (02:10 +0000)]
Auto merge of #71159 - topecongiro:rustfmt-1.4.14, r=Dylan-DPC

Bump rustfmt and rls

Close #71076. Close #71077.

r? @Xanewok

4 years agobump Miri
Ralf Jung [Wed, 15 Apr 2020 16:32:41 +0000 (18:32 +0200)]
bump Miri