]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #79810 - Aaron1011:fix/def-path-table-gap, r=lcnr
Tyler Mandry [Wed, 9 Dec 2020 21:38:25 +0000 (13:38 -0800)]
Rollup merge of #79810 - Aaron1011:fix/def-path-table-gap, r=lcnr

Account for gaps in def path table during decoding

When encoding a proc-macro crate, there may be gaps in the table (since
we only encode the crate root and proc-macro items). Account for this by
checking if the entry is present, rather than using `unwrap()`

3 years agoRollup merge of #79803 - jyn514:xsv, r=Mark-Simulacrum
Tyler Mandry [Wed, 9 Dec 2020 21:38:24 +0000 (13:38 -0800)]
Rollup merge of #79803 - jyn514:xsv, r=Mark-Simulacrum

Update xsv to prevent random CI failures

This fixes occasional proptest failures due to a bug in xsv, which
aren't related to bugs in the rust compiler.

See https://github.com/rust-lang/rust/pull/79751#issuecomment-740027046 for context.

3 years agoRollup merge of #79795 - matklad:unicode-private, r=cramertj
Tyler Mandry [Wed, 9 Dec 2020 21:38:22 +0000 (13:38 -0800)]
Rollup merge of #79795 - matklad:unicode-private, r=cramertj

Privatize some of libcore unicode_internals

My understanding is that these API are perma unstable, so it doesn't
make sense to pollute docs & IDE completion[1] with them.

[1]: https://github.com/rust-analyzer/rust-analyzer/issues/6738

3 years agoRollup merge of #79777 - tmiasko:remove-first-merge, r=lcnr
Tyler Mandry [Wed, 9 Dec 2020 21:38:20 +0000 (13:38 -0800)]
Rollup merge of #79777 - tmiasko:remove-first-merge, r=lcnr

Remove `first_merge` from liveness debug logs

3 years agoRollup merge of #79750 - camelid:fix-lint-docs-trimming, r=Mark-Simulacrum
Tyler Mandry [Wed, 9 Dec 2020 21:38:18 +0000 (13:38 -0800)]
Rollup merge of #79750 - camelid:fix-lint-docs-trimming, r=Mark-Simulacrum

Fix trimming of lint docs

Fixes #79748.

It was removing all the indentation before.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #79732 - matthiaskrgr:cl12ppy, r=Dylan-DPC
Tyler Mandry [Wed, 9 Dec 2020 21:38:12 +0000 (13:38 -0800)]
Rollup merge of #79732 - matthiaskrgr:cl12ppy, r=Dylan-DPC

minor stylistic clippy cleanups

simplify if let Some(_) = x  to  if x.is_some()  (clippy::redundant_pattern_matching)
don't create owned values for comparison (clippy::cmp_owned)
use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some)
don't wrap code block in Ok()  (clipppy::unit_arg)

3 years agoAuto merge of #79387 - woodruffw-forks:ww/peer-cred-pid-macos, r=Amanieu
bors [Wed, 9 Dec 2020 17:27:35 +0000 (17:27 +0000)]
Auto merge of #79387 - woodruffw-forks:ww/peer-cred-pid-macos, r=Amanieu

ext/ucred: Support PID in peer creds on macOS

This is a follow-up to https://github.com/rust-lang/rust/pull/75148 (RFC: https://github.com/rust-lang/rust/issues/42839).

The original PR used `getpeereid` on macOS and the BSDs, since they don't (generally) support the `SO_PEERCRED` mechanism that Linux supplies.

This PR splits the macOS/iOS implementation of `peer_cred()` from that of the BSDs, since macOS supplies the `LOCAL_PEERPID` sockopt as a source of the missing PID. It also adds a `cfg`-gated tests that ensures that platforms with support for PIDs in `UCred` have the expected data.

3 years agoAuto merge of #79721 - Aaron1011:fix/reuse-def-path-hash, r=wesleywiser
bors [Wed, 9 Dec 2020 13:54:07 +0000 (13:54 +0000)]
Auto merge of #79721 - Aaron1011:fix/reuse-def-path-hash, r=wesleywiser

Properly re-use def path hash in incremental mode

Fixes #79661

In incremental compilation mode, we update a `DefPathHash -> DefId`
mapping every time we create a `DepNode` for a foreign `DefId`.
This mapping is written out to the on-disk incremental cache, and is
read by the next compilation session to allow us to lazily decode
`DefId`s.

When we decode a `DepNode` from the current incremental cache, we need
to ensure that any previously-recorded `DefPathHash -> DefId` mapping
gets recorded in the new mapping that we write out. However, PR #74967
didn't do this in all cases, leading to us being unable to decode a
`DefPathHash` in certain circumstances.

This PR refactors some of the code around `DepNode` deserialization to
prevent this kind of mistake from happening again.

3 years agoAuto merge of #78679 - oli-obk:temp_lifetime, r=eddyb
bors [Wed, 9 Dec 2020 11:31:32 +0000 (11:31 +0000)]
Auto merge of #78679 - oli-obk:temp_lifetime, r=eddyb

Also generate `StorageDead` in constants

r? `@eddyb`

None of this special casing is actually necessary since we started promoting within constants and statics.

We may want to keep some of it around out of perf reasons, but it's not required for user visible behaviour

somewhat related: #68622

3 years agoAlso generate `StorageDead` in constants
oli [Wed, 9 Dec 2020 10:50:34 +0000 (10:50 +0000)]
Also generate `StorageDead` in constants

3 years agoAuto merge of #78363 - RalfJung:promotion, r=oli-obk
bors [Wed, 9 Dec 2020 09:13:54 +0000 (09:13 +0000)]
Auto merge of #78363 - RalfJung:promotion, r=oli-obk

remove this weird special case from promotion

Promotion has a special case to ignore interior mutability under some specific circumstances. The purpose of this PR is to figure out what changes if we remove that. Since `Cell::new` and friends only get promoted inside `const`/`static` initializers these days, it actually is not easy to exploit this case: you need something like
```rust
const TEST_INTERIOR_MUT: () = {
    // The "0." case is already ruled out by not permitting any interior mutability in `const`.
    let _val: &'static _ = &(Cell::new(1), 2).1;
};
```

I assume something like `&Some(&(Cell::new(1), 2).1)` would hit the nested case inside `validate_rvalue`... though I am not sure why that would not just trigger nested promotion, first promoting the inner reference and then the outer one?

Fixes https://github.com/rust-lang/rust/issues/67534 (by simply rejecting that code^^)

r? `@oli-obk` (but for now this is not meant to be merged!)
Cc `@rust-lang/wg-const-eval`

3 years agoremove a test that does not work any more
Ralf Jung [Sun, 15 Nov 2020 14:22:38 +0000 (15:22 +0100)]
remove a test that does not work any more

3 years agoremove a hack that seems to only benefit a few very special cases
Ralf Jung [Sun, 25 Oct 2020 17:06:41 +0000 (18:06 +0100)]
remove a hack that seems to only benefit a few very special cases

3 years agomake sure we do not promote things with interior mutability
Ralf Jung [Sun, 25 Oct 2020 16:46:01 +0000 (17:46 +0100)]
make sure we do not promote things with interior mutability

3 years agoAuto merge of #79767 - tmiasko:malformed-required-const, r=matthewjasper
bors [Wed, 9 Dec 2020 06:31:49 +0000 (06:31 +0000)]
Auto merge of #79767 - tmiasko:malformed-required-const, r=matthewjasper

Don't ICE on malformed `rustc_args_required_const` attribute

3 years agoAuto merge of #79575 - jyn514:time-passes, r=Mark-Simulacrum
bors [Wed, 9 Dec 2020 04:17:29 +0000 (04:17 +0000)]
Auto merge of #79575 - jyn514:time-passes, r=Mark-Simulacrum

Don't time `emit_ignored_resolution_errors`

This printed several hundred lines each time rustdoc was run, almost all
of which rounded to 0.000. Since this isn't useful info, don't print it
everywhere, so other perf info is easier to read.

r? `@Mark-Simulacrum`

3 years agoAuto merge of #78768 - mzabaluev:optimize-buf-writer, r=cramertj
bors [Wed, 9 Dec 2020 01:54:08 +0000 (01:54 +0000)]
Auto merge of #78768 - mzabaluev:optimize-buf-writer, r=cramertj

Use is_write_vectored to optimize the write_vectored implementation for BufWriter

In case when the underlying writer does not have an efficient implementation `write_vectored`, the present implementation of
`write_vectored` for `BufWriter` may still forward vectored writes directly to the writer depending on the total length of the data. This misses the advantage of buffering, as the actually written slice may be small.

Provide an alternative code path for the non-vectored case, where the slices passed to `BufWriter` are coalesced in the buffer before being flushed to the underlying writer with plain `write` calls. The buffer is only bypassed if an individual slice's length is at least as large as the buffer.

Remove a FIXME comment referring to #72919 as the issue has been closed with an explanation provided.

3 years agoRemove `first_merge` from liveness debug logs
Tomasz Miąsko [Wed, 9 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Remove `first_merge` from liveness debug logs

3 years agoAuto merge of #79727 - tmiasko:8bit-rwu, r=lcnr
bors [Tue, 8 Dec 2020 20:58:20 +0000 (20:58 +0000)]
Auto merge of #79727 - tmiasko:8bit-rwu, r=lcnr

Compress RWU from at least 32 bits to 4 bits

The liveness uses a mixed representation of RWUs based on the
observation that most of them have invalid reader and invalid
writer. The packed variant uses 32 bits and unpacked 96 bits.
Unpacked data contains reader live node and writer live node.

Since live nodes are used only to determine their validity,
RWUs can always be stored in a packed form with four bits for
each: reader bit, writer bit, used bit, and one extra padding
bit to simplify packing and unpacking operations.

3 years agosimplify if let Some(_) = x to if x.is_some() (clippy::redundant_pattern_matching)
Matthias Krüger [Sat, 5 Dec 2020 12:35:05 +0000 (13:35 +0100)]
simplify if let Some(_) = x  to  if x.is_some()  (clippy::redundant_pattern_matching)

3 years agodon't create owned values for comparison (clippy::cmp_owned)
Matthias Krüger [Sat, 5 Dec 2020 12:32:08 +0000 (13:32 +0100)]
don't create owned values for comparison (clippy::cmp_owned)

3 years agouse .contains() or .any() instead of find(x).is_some() (clippy::search_is_some)
Matthias Krüger [Sat, 5 Dec 2020 12:16:34 +0000 (13:16 +0100)]
use .contains() or .any() instead of find(x).is_some() (clippy::search_is_some)

3 years agodon't wrap code block in Ok() (clipppy::unit_arg)
Matthias Krüger [Sat, 5 Dec 2020 12:12:07 +0000 (13:12 +0100)]
don't wrap code block in Ok()  (clipppy::unit_arg)

3 years agoAccount for gaps in def path table during decoding
Aaron Hill [Mon, 7 Dec 2020 22:05:28 +0000 (17:05 -0500)]
Account for gaps in def path table during decoding

When encoding a proc-macro crate, there may be gaps in the table (since
we only encode the crate root and proc-macro items). Account for this by
checking if the entry is present, rather than using `unwrap()`

3 years agoAuto merge of #79817 - LingMan:if_map, r=lcnr
bors [Tue, 8 Dec 2020 13:58:15 +0000 (13:58 +0000)]
Auto merge of #79817 - LingMan:if_map, r=lcnr

Replace simple `if let` constructs with Option::map

Replaces a few constructs of the form

```
if let Some(x) = var {
    Some(...)
} else {
    None
}
```

with calls to `Option::map`.

`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoAuto merge of #79752 - cjgillot:dead-alien, r=lcnr
bors [Tue, 8 Dec 2020 11:16:19 +0000 (11:16 +0000)]
Auto merge of #79752 - cjgillot:dead-alien, r=lcnr

Visit ForeignItems when marking dead code

Follow-up to #79318

r? `@lcnr`

3 years agoAuto merge of #79806 - LeSeulArtichaut:fixup-filter-is-none, r=jyn514
bors [Tue, 8 Dec 2020 08:51:51 +0000 (08:51 +0000)]
Auto merge of #79806 - LeSeulArtichaut:fixup-filter-is-none, r=jyn514

Fixup: `filter().is_none()` -> `!any()`

3 years agoVisit ForeignItems when marking dead code.
Camille GILLOT [Thu, 26 Nov 2020 20:00:35 +0000 (21:00 +0100)]
Visit ForeignItems when marking dead code.

3 years agoAuto merge of #79712 - JohnTitor:test-issue-66286, r=estebank
bors [Tue, 8 Dec 2020 06:25:31 +0000 (06:25 +0000)]
Auto merge of #79712 - JohnTitor:test-issue-66286, r=estebank

Add a regression test for issue-66286

Fixes #66422

3 years agoAuto merge of #79820 - ehuss:update-cargo, r=ehuss
bors [Tue, 8 Dec 2020 03:43:39 +0000 (03:43 +0000)]
Auto merge of #79820 - ehuss:update-cargo, r=ehuss

Update cargo

10 commits in 63d0fe43449adcb316d34d98a982b597faca4178..d274fcf862b89264fa2c6b917b15230705257317
2020-12-02 01:44:30 +0000 to 2020-12-07 23:08:44 +0000
- Clarify cargo manifest edition field docs (rust-lang/cargo#8953)
- Run rustdoc doctests relative to the workspace (rust-lang/cargo#8954)
- Workaround fs issue in `cargo publish`. (rust-lang/cargo#8950)
- Fix panic with -Zbuild-std and no roots. (rust-lang/cargo#8942)
- Slightly optimize `cargo vendor` (rust-lang/cargo#8937)
- Fixes rust-lang/cargo#8783 , cargo new fails without a author name or email (rust-lang/cargo#8912)
- Fix test escaping __CARGO_TEST_ROOT (rust-lang/cargo#8929)
- Add period to allowed feature name characters. (rust-lang/cargo#8932)
- faq: small fixes (rust-lang/cargo#8931)
- Fix semver documentation tests. (rust-lang/cargo#8930)

3 years agoUpdate cargo
Eric Huss [Tue, 8 Dec 2020 02:35:06 +0000 (18:35 -0800)]
Update cargo

3 years agoReplace simple `if let` constructs with Option::map
LingMan [Tue, 8 Dec 2020 01:40:14 +0000 (02:40 +0100)]
Replace simple `if let` constructs with Option::map

Replaces a few constructs of the form

if let Some(x) = var {
    Some(...)
} else {
    None
}

with calls to Option::map.

3 years agoAuto merge of #79780 - camelid:use-summary_opts, r=GuillaumeGomez
bors [Tue, 8 Dec 2020 01:15:26 +0000 (01:15 +0000)]
Auto merge of #79780 - camelid:use-summary_opts, r=GuillaumeGomez

Use `summary_opts()` in another spot

I added `summary_opts()` before I cut the branch for #77686 (2 months
ago!), so this "slipped through the cracks".

3 years agoAuto merge of #79653 - tmiasko:naked-functions, r=Amanieu
bors [Mon, 7 Dec 2020 22:47:20 +0000 (22:47 +0000)]
Auto merge of #79653 - tmiasko:naked-functions, r=Amanieu

Validate naked functions definitions

Validate that naked functions are defined in terms of a single inline assembly
block that uses only `const` and `sym` operands and has `noreturn` option.

Implemented as future incompatibility lint with intention to migrate it into
hard error. When it becomes a hard error it will ensure that naked functions are
either unsafe or contain an unsafe block around the inline assembly. It will
guarantee that naked functions do not reference functions parameters (obsoleting
part of existing checks from #79411). It will limit the definitions of naked
functions to what can be reliably supported. It will also reject naked functions
implemented using legacy LLVM style assembly since it cannot satisfy those
conditions.

https://github.com/rust-lang/rfcs/pull/2774
https://github.com/rust-lang/rfcs/pull/2972

3 years agoFixup: `filter().is_none()` -> `!any()`
LeSeulArtichaut [Mon, 7 Dec 2020 20:40:20 +0000 (21:40 +0100)]
Fixup: `filter().is_none()` -> `!any()`

3 years agoAuto merge of #79797 - jethrogb:sgx-fix-79038, r=Mark-Simulacrum
bors [Mon, 7 Dec 2020 20:25:24 +0000 (20:25 +0000)]
Auto merge of #79797 - jethrogb:sgx-fix-79038, r=Mark-Simulacrum

Fix SGX CI, take 3

Broken in #79038

r? `@Mark-Simulacrum`

I actually ran `./x.py test --target x86_64-fortanix-unknown-sgx` on the commit before submitting it this time.

3 years agoUpdate xsv to prevent random CI failures
Joshua Nelson [Mon, 7 Dec 2020 17:51:28 +0000 (12:51 -0500)]
Update xsv to prevent random CI failures

This fixes occasional proptest failures due to a bug in xsv, which
aren't related to bugs in the rust compiler.

3 years agoAuto merge of #79751 - aDotInTheVoid:json-true-idx, r=jyn514
bors [Mon, 7 Dec 2020 17:35:02 +0000 (17:35 +0000)]
Auto merge of #79751 - aDotInTheVoid:json-true-idx, r=jyn514

Rustdoc: Use correct def_id for doctree::Import

The default overwrites the crate root, which crashes rustdoc-json.

While investigating this, It turns out somehow, some items are being documented twice. I'm not sure how this is happening but for now, we just make sure they were the same if they have the same id.

[Zulip descussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Panic.20in.20json-format/near/218899256)

[Bless script](https://gist.github.com/aDotInTheVoid/2dfce0d241338def3f033f941b7c183d) (Once this is more pollished I'll submit it)

r? `@jyn514`

3 years agoAuto merge of #79773 - lcnr:type-visitor, r=oli-obk
bors [Mon, 7 Dec 2020 15:07:09 +0000 (15:07 +0000)]
Auto merge of #79773 - lcnr:type-visitor, r=oli-obk

small `TypeVisitor` refactor

cc `@LeSeulArtichaut` `@scottmcm`

adds `ControlFlow::map_break`

3 years agosmall `TypeVisitor` refactor
Bastian Kauschke [Sun, 6 Dec 2020 20:31:42 +0000 (21:31 +0100)]
small `TypeVisitor` refactor

3 years agoFix SGX CI, take 3
Jethro Beekman [Mon, 7 Dec 2020 14:14:56 +0000 (15:14 +0100)]
Fix SGX CI, take 3

Broken in #79038

3 years agoPrivatize some of libcore unicode_internals
Aleksey Kladov [Mon, 7 Dec 2020 13:16:42 +0000 (16:16 +0300)]
Privatize some of libcore unicode_internals

My understanding is that these API are perma unstable, so it doesn't
make sense to pollute docs & IDE completion[1] with them.

[1]: https://github.com/rust-analyzer/rust-analyzer/issues/6738

3 years agoAuto merge of #79772 - ethanboxx:79760-wrongly-speaks-of-methods, r=oli-obk
bors [Mon, 7 Dec 2020 09:28:25 +0000 (09:28 +0000)]
Auto merge of #79772 - ethanboxx:79760-wrongly-speaks-of-methods, r=oli-obk

smarter E0390

Should fix #79760

I am fairly new to the compiler so am hoping I did things correctly :).

3 years agoAuto merge of #79641 - sourcefrog:split-example, r=dtolnay
bors [Mon, 7 Dec 2020 06:05:34 +0000 (06:05 +0000)]
Auto merge of #79641 - sourcefrog:split-example, r=dtolnay

Add a doctest example of str::split on a slice of chars

This is mentioned as supported, but the semantics are not described.

3 years agoUse `summary_opts()` in another spot
Camelid [Mon, 7 Dec 2020 02:52:36 +0000 (18:52 -0800)]
Use `summary_opts()` in another spot

I added `summary_opts()` before I cut the branch for #77686 (2 months
ago!), so this "slipped through the cracks".

3 years agoValidate naked functions definitions
Tomasz Miąsko [Mon, 7 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Validate naked functions definitions

3 years agoAuto merge of #79776 - petrochenkov:mvtest, r=Mark-Simulacrum
bors [Mon, 7 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Auto merge of #79776 - petrochenkov:mvtest, r=Mark-Simulacrum

Move some tests to subdirectories

Mostly tests related to imports.
(A couple of very outdated tests is also deleted.)

Part of https://github.com/rust-lang/rust/issues/73494.

3 years agoMove some tests to subdirectories
Vadim Petrochenkov [Sun, 6 Dec 2020 23:01:35 +0000 (02:01 +0300)]
Move some tests to subdirectories

3 years agoFix trimming of lint docs
Camelid [Sun, 6 Dec 2020 22:11:02 +0000 (14:11 -0800)]
Fix trimming of lint docs

It was removing all the indentation before.

Co-authored-by: Eric Huss <eric@huss.org>
3 years agosuggestions from camelid review
Ethan Brierley [Sun, 6 Dec 2020 21:30:30 +0000 (21:30 +0000)]
suggestions from camelid review

3 years agosmarter E0390
Ethan Brierley [Sun, 6 Dec 2020 20:30:07 +0000 (20:30 +0000)]
smarter E0390

3 years agoRetain assembly operands span when lowering AST to HIR
Tomasz Miąsko [Fri, 27 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Retain assembly operands span when lowering AST to HIR

3 years agoAuto merge of #79765 - flip1995:clippyup, r=Manishearth
bors [Sun, 6 Dec 2020 16:59:10 +0000 (16:59 +0000)]
Auto merge of #79765 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update (which I forgot about on Thursday)

This includes a `Cargo.lock` update, so probably needs `rollup=never`.

r? `@Manishearth`

3 years agoUpdate Cargo.lock
flip1995 [Sun, 6 Dec 2020 14:07:59 +0000 (15:07 +0100)]
Update Cargo.lock

3 years agoMerge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup
flip1995 [Sun, 6 Dec 2020 14:01:03 +0000 (15:01 +0100)]
Merge commit 'c1664c50b27a51f7a78c93ba65558e7c33eabee6' into clippyup

3 years agoAuto merge of #78609 - lcnr:rustdoc-const-eval, r=matthewjasper
bors [Sun, 6 Dec 2020 13:03:45 +0000 (13:03 +0000)]
Auto merge of #78609 - lcnr:rustdoc-const-eval, r=matthewjasper

extend `WithOptConstParam` docs, move rustdoc test

This should hopefully make things a bit clearer, feel free to comment on anything which can still be improved.

cc `@ecstatic-morse` `@nikomatsakis` `@RalfJung`

3 years agoAuto merge of #79734 - ethanboxx:inferred_const_note, r=varkor
bors [Sun, 6 Dec 2020 08:08:05 +0000 (08:08 +0000)]
Auto merge of #79734 - ethanboxx:inferred_const_note, r=varkor

Const parameters can not be inferred with `_` help note

This should close: #79557

# Example output
```
error[E0747]: type provided when a constant was expected
 --> inferred_const_note.rs:6:19
  |
6 |     let a = foo::<_, 2>([0, 1, 2]);
  |                   ^
  |
  = help: Const parameters can not be inferred with `_`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0747`.
```

r? `@lcnr`

3 years agoAuto merge of #6421 - xFrednet:4176-unreadable-literal-lint-fractal-option, r=Manishearth
bors [Sun, 6 Dec 2020 07:18:33 +0000 (07:18 +0000)]
Auto merge of #6421 - xFrednet:4176-unreadable-literal-lint-fractal-option, r=Manishearth

Added a lint-fraction-readability flag to the configuration

This adds an option to disable the `unreadable_literal` lint for floats with a longer fraction. This allows users to write `0.100200300` without getting a warning. Fixes #4176

I have some open questions about this PR:
1. I've named the option `lint-fraction-readability` is this a good name or should I rename it to something else?
2. What should the default configuration value be?
    * The current default value is `true` as this was also the previous default.
3. Do I have to document this new option somewhere else or will it be extracted from the code comment?
4. The current fix option will also rewrite the fraction if the integer part violates the `unreadable_literal` lint it would otherwise also trigger the `inconsistent_digit_grouping` lint. Is this also okay?
    * `1.100200300` will be unaffected by the fix function
    * `100200300.100200300` will be effected and fixed to `100_200_300.100_200_300`

---

The project needed some getting used to but I'm happy with the result. A big thank you to `@flip1995` for giving me some pointers for this implementation and to everyone for the great introduction documentation!

---

changelog: Added the `unreadable-literal-lint-fractions` configuration to disable the `unreadable_literal` lint for fractions

3 years agoAuto merge of #79737 - Xanewok:update-rls, r=calebcartwright
bors [Sun, 6 Dec 2020 05:52:47 +0000 (05:52 +0000)]
Auto merge of #79737 - Xanewok:update-rls, r=calebcartwright

Update RLS and Rustfmt

Fixes #79406 Fixes #79407

This does pull 1.4.28 version of Rustfmt. Do you want me to pull the 1.4.29 while we're at it?

r? `@calebcartwright`

3 years agoAuto merge of #79729 - matthiaskrgr:clones_, r=jyn514
bors [Sun, 6 Dec 2020 03:38:56 +0000 (03:38 +0000)]
Auto merge of #79729 - matthiaskrgr:clones_, r=jyn514

remove redundant clones

3 years agoBump Rustfmt to 1.4.29
Igor Matuszewski [Sun, 6 Dec 2020 01:16:06 +0000 (02:16 +0100)]
Bump Rustfmt to 1.4.29

3 years agoAuto merge of #79650 - the8472:fix-take, r=dtolnay
bors [Sun, 6 Dec 2020 01:15:37 +0000 (01:15 +0000)]
Auto merge of #79650 - the8472:fix-take, r=dtolnay

Fix incorrect io::Take's limit resulting from io::copy specialization

The specialization introduced in #75272 fails to update `io::Take` wrappers after performing the copy syscalls which bypass those wrappers. The buffer flushing before the copy does update them correctly, but the bytes copied after the initial flush weren't subtracted.

The fix is to subtract the bytes copied from each `Take` in the chain of wrappers, even when an error occurs during the syscall loop. To do so the `CopyResult` enum now has to carry the bytes copied so far in the error case.

3 years agoDon't ICE on malformed `rustc_args_required_const` attribute
Tomasz Miąsko [Sun, 6 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Don't ICE on malformed `rustc_args_required_const` attribute

3 years agoCompress RWU from at least 32 bits to 4 bits
Tomasz Miąsko [Sun, 6 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Compress RWU from at least 32 bits to 4 bits

The liveness uses a mixed representation of RWUs based on the
observation that most of them have invalid reader and invalid
writer. The packed variant uses 32 bits and unpacked 96 bits.
Unpacked data contains reader live node and writer live node.

Since live nodes are used only to determine their validity,
RWUs can always be stored in a packed form with four bits for
each: reader bit, writer bit, used bit, and one extra padding
bit to simplify packing and unpacking operations.

3 years agoAuto merge of #79697 - rylev:clearer-const-diagnostic, r=oli-obk
bors [Sat, 5 Dec 2020 22:47:37 +0000 (22:47 +0000)]
Auto merge of #79697 - rylev:clearer-const-diagnostic, r=oli-obk

A slightly clearer diagnostic when misusing const

Fixes #79598

This produces the following diagnostic:
"expected one of `>`, a const expression, lifetime, or type, found keyword `const`"

Instead of the previous, more confusing:
"expected one of `>`, const, lifetime, or type, found keyword `const`"

This might not be completely clear as some users might not understand what a const expression is, but I do believe this is an improvement.

3 years agoUse true ID for def_id.
Nixon Enraght-Moony [Sat, 5 Dec 2020 22:23:17 +0000 (22:23 +0000)]
Use true ID for def_id.

3 years agoRenamed the configuraiton to unreadable-literal-lint-fractions
xFrednet [Sat, 5 Dec 2020 20:59:53 +0000 (20:59 +0000)]
Renamed the configuraiton to unreadable-literal-lint-fractions

3 years agoAuto merge of #79685 - sivadeilra:fix_env_vars_win, r=davidtwco
bors [Sat, 5 Dec 2020 20:30:58 +0000 (20:30 +0000)]
Auto merge of #79685 - sivadeilra:fix_env_vars_win, r=davidtwco

Fix src/test/ui/env-vars.rs on 128-core machines on Windows

On Windows, the environment variable NUMBER_OF_PROCESSORS has special
meaning. Unfortunately, you can get different answers, depending on
whether you are enumerating all environment variables or querying a
specific variable. This was causing the src/test/ui/env-vars.rs test
to fail on machines with more than 64 processors when run on Windows.

3 years agoAuto merge of #79719 - JohnTitor:nomicon, r=Mark-Simulacrum
bors [Sat, 5 Dec 2020 18:21:58 +0000 (18:21 +0000)]
Auto merge of #79719 - JohnTitor:nomicon, r=Mark-Simulacrum

Ping me when nomicon's toolstate is broken

So that I can notice the breakage easily.

3 years agoAdd libc to rustc-workspace-hack
Igor Matuszewski [Sat, 5 Dec 2020 17:08:33 +0000 (18:08 +0100)]
Add libc to rustc-workspace-hack

3 years agoAuto merge of #79445 - SNCPlay42:struct-tail-recursion-limit, r=oli-obk
bors [Sat, 5 Dec 2020 15:58:06 +0000 (15:58 +0000)]
Auto merge of #79445 - SNCPlay42:struct-tail-recursion-limit, r=oli-obk

check the recursion limit when finding a struct's tail

fixes #79437

This does a `delay_span_bug` (via `ty_error_with_message`) rather than emit a new error message, under the assumption that there will be an error elsewhere (even if the type isn't infinitely recursive, just deeper than the recursion limit, this appears to be the case).

3 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Sat, 5 Dec 2020 15:40:24 +0000 (16:40 +0100)]
Update RLS and Rustfmt

3 years agoConst parameters can not be inferred with `_`
Ethan Brierley [Sat, 5 Dec 2020 14:40:56 +0000 (14:40 +0000)]
Const parameters can not be inferred with `_`

Small improvement. Thanks varkor

Co-authored-by: varkor <github@varkor.com>
Bless

3 years agoAuto merge of #78373 - matthewjasper:drop-on-into, r=pnkfelix
bors [Sat, 5 Dec 2020 13:41:08 +0000 (13:41 +0000)]
Auto merge of #78373 - matthewjasper:drop-on-into, r=pnkfelix

Don't leak return value after panic in drop

Closes #47949

3 years agoremove redundant clones
Matthias Krüger [Sat, 5 Dec 2020 11:59:54 +0000 (12:59 +0100)]
remove redundant clones

3 years agoAuto merge of #79724 - RalfJung:miri, r=RalfJung
bors [Sat, 5 Dec 2020 11:24:40 +0000 (11:24 +0000)]
Auto merge of #79724 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoupdate Miri
Ralf Jung [Sat, 5 Dec 2020 09:02:18 +0000 (10:02 +0100)]
update Miri

3 years agoAuto merge of #6418 - flip1995:apple_wraps_mhm, r=llogiq
bors [Sat, 5 Dec 2020 08:42:21 +0000 (08:42 +0000)]
Auto merge of #6418 - flip1995:apple_wraps_mhm, r=llogiq

Turn unnecessary_wraps applicability to MaybeIncorrect

Fixes: #6417
changelog: Turn [`unnecessary_wraps`] applicability to `MaybeIncorrect`

3 years agoProperly re-use def path hash in incremental mode
Aaron Hill [Fri, 4 Dec 2020 23:37:21 +0000 (18:37 -0500)]
Properly re-use def path hash in incremental mode

Fixes #79661

In incremental compilation mode, we update a `DefPathHash -> DefId`
mapping every time we create a `DepNode` for a foreign `DefId`.
This mapping is written out to the on-disk incremental cache, and is
read by the next compilation session to allow us to lazily decode
`DefId`s.

When we decode a `DepNode` from the current incremental cache, we need
to ensure that any previously-recorded `DefPathHash -> DefId` mapping
gets recorded in the new mapping that we write out. However, PR #74967
didn't do this in all cases, leading to us being unable to decode a
`DefPathHash` in certain circumstances.

This PR refactors some of the code around `DepNode` deserialization to
prevent this kind of mistake from happening again.

3 years agoPing me when nomicon's toolstate is broken
Yuki Okushi [Sat, 5 Dec 2020 03:05:03 +0000 (12:05 +0900)]
Ping me when nomicon's toolstate is broken

3 years agoAuto merge of #76301 - matklad:fmt-test, r=matklad
bors [Sat, 5 Dec 2020 01:03:48 +0000 (01:03 +0000)]
Auto merge of #76301 - matklad:fmt-test, r=matklad

Cleanup: move format! ui tests to where they belong

3 years agoAvoid leaking block expression values
Matthew Jasper [Sat, 24 Oct 2020 21:30:57 +0000 (22:30 +0100)]
Avoid leaking block expression values

3 years agoAdd a regression test for issue-66286
Yuki Okushi [Fri, 4 Dec 2020 23:02:56 +0000 (08:02 +0900)]
Add a regression test for issue-66286

3 years agoAuto merge of #79673 - ijackson:intoinnerintoinnererror, r=m-ou-se
bors [Fri, 4 Dec 2020 22:30:19 +0000 (22:30 +0000)]
Auto merge of #79673 - ijackson:intoinnerintoinnererror, r=m-ou-se

Provide IntoInnerError::into_parts

Hi.  This is an updated version of the IntoInnerError bits of my previous portmanteau MR #78689.  Thanks to `@jyn514` and `@m-ou-se` for helpful comments there.

I have made this insta-stable since it seems like it will probably be uncontroversial, but that is definitely something that someone from the libs API team should be aware of and explicitly consider.

I included a tangentially-related commit providing documentation of the buffer full behaviiour of `&mut [u8] as Write`; the behaviour I am documenting is relied on by the doctest for `into_parts`.

3 years agoUse `record_operands_moved` more aggresively
Matthew Jasper [Sat, 24 Oct 2020 10:18:32 +0000 (11:18 +0100)]
Use `record_operands_moved` more aggresively

3 years agoSimplify unscheduling of drops after moves
Matthew Jasper [Mon, 5 Oct 2020 21:10:37 +0000 (22:10 +0100)]
Simplify unscheduling of drops after moves

3 years agoUpdated code for CI
xFrednet [Fri, 4 Dec 2020 22:05:52 +0000 (22:05 +0000)]
Updated code for CI

3 years agoAdded a lint-fraction-readability flag to the configuration
xFrednet [Fri, 4 Dec 2020 21:26:47 +0000 (21:26 +0000)]
Added a lint-fraction-readability flag to the configuration

3 years agoAuto merge of #79286 - TimDiekmann:rename-allocref, r=Lokathor,Wodann,m-ou-se
bors [Fri, 4 Dec 2020 20:07:04 +0000 (20:07 +0000)]
Auto merge of #79286 - TimDiekmann:rename-allocref, r=Lokathor,Wodann,m-ou-se

Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`

Calling `Box::alloc_ref` and `Vec::alloc_ref` sounds like allocating a reference. To solve this ambiguity, this renames `AllocRef` to `Allocator` and `alloc` to `allocate`. For a more detailed explaination see https://github.com/rust-lang/wg-allocators/issues/76.

closes https://github.com/rust-lang/wg-allocators/issues/76

r? `@KodrAus`
`@rustbot` modify labels: +A-allocators +T-libs
`@rustbot` ping wg-allocators

3 years agoIntoInnerError: Provide into_error
Ian Jackson [Fri, 4 Dec 2020 17:32:26 +0000 (17:32 +0000)]
IntoInnerError: Provide into_error

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoIntoInnerError: Provide into_parts
Ian Jackson [Mon, 2 Nov 2020 20:58:12 +0000 (20:58 +0000)]
IntoInnerError: Provide into_parts

In particular, IntoIneerError only currently provides .error() which
returns a reference, not an owned value.  This is not helpful and
means that a caller of BufWriter::into_inner cannot acquire an owned
io::Error which seems quite wrong.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agostd: impl of `Write` for `&mut [u8]`: document the buffer full error
Ian Jackson [Thu, 3 Dec 2020 20:13:51 +0000 (20:13 +0000)]
std: impl of `Write` for `&mut [u8]`: document the buffer full error

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocheck the recursion limit when finding struct tail
SNCPlay42 [Thu, 26 Nov 2020 15:32:41 +0000 (15:32 +0000)]
check the recursion limit when finding struct tail

3 years agoAuto merge of #6419 - giraffate:fix_a_style_of_texts_in_size_of_in_element_count...
bors [Fri, 4 Dec 2020 14:42:07 +0000 (14:42 +0000)]
Auto merge of #6419 - giraffate:fix_a_style_of_texts_in_size_of_in_element_count, r=flip1995

Fix a style of texts in `size_of_in_element_count`

Add missing ` to texts

changelog: none

3 years agoFix a style of texts in `size_of_in_element_count`
Takayuki Nakata [Fri, 4 Dec 2020 14:36:07 +0000 (23:36 +0900)]
Fix a style of texts in `size_of_in_element_count`

3 years ago Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`
Tim Diekmann [Fri, 4 Dec 2020 13:47:15 +0000 (14:47 +0100)]
 Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`

3 years agoMove format machinery tests to where they belong
Aleksey Kladov [Fri, 4 Dec 2020 13:22:36 +0000 (16:22 +0300)]
Move format machinery tests to where they belong

3 years agoAuto merge of #79680 - Nadrieril:fix-regression-79284, r=jonas-schievink
bors [Fri, 4 Dec 2020 11:21:35 +0000 (11:21 +0000)]
Auto merge of #79680 - Nadrieril:fix-regression-79284, r=jonas-schievink

Fix perf regression caused by #79284

https://github.com/rust-lang/rust/pull/79284 only moved code around but this changed inlining and caused a large perf regression. This fixes it for me, though I'm less confident than usual because the regression was not observable with my usual (i.e. incremental) compilation settings.

r? `@Mark-Simulacrum`

3 years agoFix UI tests for 'const expression' change
Ryan Levick [Fri, 4 Dec 2020 11:21:33 +0000 (12:21 +0100)]
Fix UI tests for 'const expression' change

3 years agoA slightly clearer diagnostic when misusing
Ryan Levick [Fri, 4 Dec 2020 10:33:30 +0000 (11:33 +0100)]
A slightly clearer diagnostic when misusing