]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #79844 - tmiasko:rwu-table-mod, r=lcnr
Tyler Mandry [Wed, 9 Dec 2020 21:38:34 +0000 (13:38 -0800)]
Rollup merge of #79844 - tmiasko:rwu-table-mod, r=lcnr

Move RWUTable to a separate module

3 years agoRollup merge of #79826 - LingMan:match_if, r=lcnr
Tyler Mandry [Wed, 9 Dec 2020 21:38:33 +0000 (13:38 -0800)]
Rollup merge of #79826 - LingMan:match_if, r=lcnr

Simplify visit_{foreign,trait}_item

Using an `if` seems like a better semantic fit and saves a few lines.

Noticed while looking at https://github.com/rust-lang/rust/pull/79752, but that's already merged.
r? `@lcnr,` cc `@cjgillot`

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

3 years agoRollup merge of #79824 - LingMan:no_replace, r=lcnr
Tyler Mandry [Wed, 9 Dec 2020 21:38:31 +0000 (13:38 -0800)]
Rollup merge of #79824 - LingMan:no_replace, r=lcnr

Strip prefix instead of replacing it with empty string

r? `@lcnr,` since you reviewed my other PR in the area.
`@rustbot` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #79818 - richkadel:llvm-coverage-counters-2.1.0, r=tmandry
Tyler Mandry [Wed, 9 Dec 2020 21:38:27 +0000 (13:38 -0800)]
Rollup merge of #79818 - richkadel:llvm-coverage-counters-2.1.0, r=tmandry

Fixes to Rust coverage

Fixes: #79725
Some macros can create a situation where `fn_sig_span` and `body_span`
map to different files.

New documentation on coverage tests incorrectly assumed multiple test
binaries could just be listed at the end of the `llvm-cov` command,
but it turns out each binary needs a `--object` prefix.

This PR fixes the bug and updates the documentation to correct that
issue. It also fixes a few other minor issues in internal implementation
comments, and adds documentation on getting coverage results for doc
tests.

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 agoImprove comment grammar
The8472 [Wed, 9 Dec 2020 20:12:39 +0000 (21:12 +0100)]
Improve comment grammar

3 years agoimplement better availability probing for copy_file_range
The8472 [Sat, 21 Nov 2020 18:34:45 +0000 (19:34 +0100)]
implement better availability probing for copy_file_range

previously any attempt to copy to an immutable file (EPERM) would disable
copy_file_range support for the whole process.

3 years agotests: add 3 cases involving pointers to codegen/transmute-scalar.
Eduard-Mihai Burtescu [Wed, 9 Dec 2020 19:54:24 +0000 (21:54 +0200)]
tests: add 3 cases involving pointers to codegen/transmute-scalar.

3 years agoAuto merge of #77611 - oli-obk:atomic_miri_leakage, r=nagisa
bors [Wed, 9 Dec 2020 19:53:23 +0000 (19:53 +0000)]
Auto merge of #77611 - oli-obk:atomic_miri_leakage, r=nagisa

Directly use raw pointers in `AtomicPtr` store/load

I was unable to find any reason for this limitation in the latest source of LLVM or in the documentation [here](http://llvm.org/docs/Atomics.html#libcalls-atomic).

fixes https://github.com/rust-lang/miri/issues/1574

3 years agoRemove tab-lock and replace it with ctrl+up/down arrows to switch between search...
Guillaume Gomez [Wed, 9 Dec 2020 19:47:55 +0000 (20:47 +0100)]
Remove tab-lock and replace it with ctrl+up/down arrows to switch between search result tabs

3 years agoAccept arbitrary expressions in key-value attributes at parse time
Vadim Petrochenkov [Sat, 7 Nov 2020 13:09:40 +0000 (16:09 +0300)]
Accept arbitrary expressions in key-value attributes at parse time

3 years agoClarify that String::split_at takes a byte index.
Corey Farwell [Wed, 9 Dec 2020 18:17:54 +0000 (13:17 -0500)]
Clarify that String::split_at takes a byte index.

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 agoClarify the 'default is only allowed on...' error
Camelid [Wed, 9 Dec 2020 05:56:22 +0000 (21:56 -0800)]
Clarify the 'default is only allowed on...' error

Code like

    impl Foo {
        default fn foo() {}
    }

will trigger the error

    error: `default` is only allowed on items in `impl` definitions
     --> src/lib.rs:5:5
      |
    5 |     default fn foo() {}
      |     -------^^^^^^^^^
      |     |
      |     `default` because of this

but that's very confusing! I *did* put it on an item in an impl!

So this commit changes the message to

    error: `default` is only allowed on items in trait impls
     --> src/lib.rs:5:5
      |
    5 |     default fn foo() {}
      |     -------^^^^^^^^^
      |     |
      |     `default` because of this

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 agoFix rustup support in default_build_triple for python3
Joshua Nelson [Wed, 9 Dec 2020 00:18:06 +0000 (19:18 -0500)]
Fix rustup support in default_build_triple for python3

bootstrap completely ignores all errors when detecting a rustup version,
so this wasn't noticed before.

Fixes the following error:

```
rustup not detected: a bytes-like object is required, not 'str'
falling back to auto-detect
```

This also takes the opportunity to only call rustup and other external
commands only once during startup.

3 years agoUpdate LLVM submodule
Tomasz Miąsko [Wed, 9 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Update LLVM submodule

3 years agoMove RWUTable to a separate module
Tomasz Miąsko [Wed, 9 Dec 2020 00:00:00 +0000 (00:00 +0000)]
Move RWUTable to a separate module

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 agoUse Pin for the 'don't move' requirement of ReentrantMutex.
Mara Bos [Sat, 10 Oct 2020 18:20:14 +0000 (20:20 +0200)]
Use Pin for the 'don't move' requirement of ReentrantMutex.

The code in io::stdio before this change misused the ReentrantMutexes,
by calling init() on them and moving them afterwards. Now that
ReentrantMutex requires Pin for init(), this mistake is no longer easy
to make.

3 years agoAdd (internal-only) SyncOnceCell::get_or_init_pin.
Mara Bos [Wed, 7 Oct 2020 15:19:38 +0000 (17:19 +0200)]
Add (internal-only) SyncOnceCell::get_or_init_pin.

3 years agoRemove unnecessary import of `crate::marker` in std::sys_common::remutex.
Mara Bos [Sat, 10 Oct 2020 18:15:55 +0000 (20:15 +0200)]
Remove unnecessary import of `crate::marker` in std::sys_common::remutex.

It was used for marker::Send, but Send is already in scope.

3 years agoFix outdated comment about not needing to flush stderr.
Mara Bos [Sat, 10 Oct 2020 18:13:03 +0000 (20:13 +0200)]
Fix outdated comment about not needing to flush stderr.

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 agoRemove deprecated linked_list_extras methods.
Mara Bos [Tue, 8 Dec 2020 19:52:57 +0000 (20:52 +0100)]
Remove deprecated linked_list_extras methods.

3 years agoReview feedback
Eric Arellano [Tue, 8 Dec 2020 19:50:52 +0000 (12:50 -0700)]
Review feedback

* Use a match statement.
* Clarify why we can't use `file_stem()`.
* Error if the `:` is missing for Tidy error codes, rather than no-oping.

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 agoSimplify visit_{foreign,trait}_item
LingMan [Tue, 8 Dec 2020 14:37:39 +0000 (15:37 +0100)]
Simplify visit_{foreign,trait}_item

Using an `if` seems like a better semantic fit and saves a few lines.

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 agoStrip prefix instead of replacing it with empty string
LingMan [Tue, 8 Dec 2020 13:46:19 +0000 (14:46 +0100)]
Strip prefix instead of replacing it with empty string

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 agofix unsoundness in `make_contiguous`
Bastian Kauschke [Tue, 8 Dec 2020 09:34:31 +0000 (10:34 +0100)]
fix unsoundness in `make_contiguous`

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 agoFixes to Rust coverage
Rich Kadel [Tue, 8 Dec 2020 01:41:53 +0000 (17:41 -0800)]
Fixes to Rust coverage

Fixes: #79725
Some macros can create a situation where `fn_sig_span` and `body_span`
map to different files.

New documentation on coverage tests incorrectly assumed multiple test
binaries could just be listed at the end of the `llvm-cov` command,
but it turns out each binary needs a `--object` prefix.

This PR fixes the bug and updates the documentation to correct that
issue. It also fixes a few other minor issues in internal implementation
comments, and adds documentation on getting coverage results for doc
tests.

3 years agoFix net.rs - rsplitn() returns a reverse iterator
Eric Arellano [Mon, 7 Dec 2020 22:29:51 +0000 (15:29 -0700)]
Fix net.rs - rsplitn() returns a reverse iterator

3 years agoReview feedback for collect_intra_doc_links.rs
Eric Arellano [Mon, 7 Dec 2020 22:07:24 +0000 (15:07 -0700)]
Review feedback for collect_intra_doc_links.rs

* Add assertion value is defined.
* Simplify comment.
* Fix bad change in err message.

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 agoMake write and slice_as_[mut_]_ptr const
Albin Hedman [Mon, 7 Dec 2020 23:07:34 +0000 (00:07 +0100)]
Make write and slice_as_[mut_]_ptr const

3 years agoMake assume_init_{ref,mut} const
Albin Hedman [Mon, 7 Dec 2020 23:05:26 +0000 (00:05 +0100)]
Make assume_init_{ref,mut} const

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 agoDogfood 'str_split_once()` in the std lib
Eric Arellano [Mon, 7 Dec 2020 21:24:05 +0000 (14:24 -0700)]
Dogfood 'str_split_once()` in the std lib

3 years agoDogfood 'str_split_once() with librustdoc
Eric Arellano [Mon, 7 Dec 2020 21:00:31 +0000 (14:00 -0700)]
Dogfood 'str_split_once() with librustdoc

3 years agoDogfood 'str_split_once() with linkchecker
Eric Arellano [Mon, 7 Dec 2020 20:39:30 +0000 (13:39 -0700)]
Dogfood 'str_split_once() with linkchecker

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 agoUse 'error-pattern' in ui test
Albin Hedman [Mon, 7 Dec 2020 20:26:09 +0000 (21:26 +0100)]
Use 'error-pattern' in ui test

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 agoDogfood 'str_split_once() with Tidy
Eric Arellano [Mon, 7 Dec 2020 19:54:55 +0000 (12:54 -0700)]
Dogfood 'str_split_once() with Tidy

3 years agoDogfood 'str_split_once() with `compiler/`
Eric Arellano [Mon, 7 Dec 2020 18:59:24 +0000 (11:59 -0700)]
Dogfood 'str_split_once() with `compiler/`

3 years agoAdd comment for assert_inhabited in compiler/rustc_mir/src/interpret/intrinsics.rs
Albin Hedman [Mon, 7 Dec 2020 17:59:10 +0000 (18:59 +0100)]
Add comment for assert_inhabited in compiler/rustc_mir/src/interpret/intrinsics.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
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 agorustc_codegen_ssa: use bitcasts instead of type punning for scalar transmutes.
Eduard-Mihai Burtescu [Mon, 7 Dec 2020 15:33:43 +0000 (17:33 +0200)]
rustc_codegen_ssa: use bitcasts instead of type punning for scalar transmutes.

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 handling UpvarRef to PlaceBuilder
Aman Arora [Thu, 19 Nov 2020 03:54:31 +0000 (22:54 -0500)]
Move handling UpvarRef to PlaceBuilder

- This allows us to delay figuring out the index of a capture
  in the closure structure when all projections to atleast form
  a capture have been applied to the builder

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
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 agoRemove unused feature gate
Albin Hedman [Sun, 6 Dec 2020 21:29:13 +0000 (22:29 +0100)]
Remove unused feature gate

3 years agoUse min_captures for creating UpvarSusbts::tupled_upvar_tys
Aman Arora [Thu, 26 Nov 2020 04:56:55 +0000 (23:56 -0500)]
Use min_captures for creating UpvarSusbts::tupled_upvar_tys

- final_upvar_tys now reads types from places instead of using `node_ty`

Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
3 years agoWriteback min_capture map to TypeckResults
Aman Arora [Sat, 21 Nov 2020 09:52:18 +0000 (04:52 -0500)]
Writeback min_capture map to TypeckResults

- Derive TypeFoldable on `hir::place::Place` and associated
  structs, to them to be written into typeck results.

Co-authored-by: Jennifer Wills <wills.jenniferg@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
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 agoFix comments related to abort()
Albin Hedman [Sun, 6 Dec 2020 19:25:13 +0000 (20:25 +0100)]
Fix comments related to abort()

3 years agoTests finally working
Albin Hedman [Sun, 6 Dec 2020 18:29:35 +0000 (19:29 +0100)]
Tests finally working

3 years agoMoved failing test to src/test/ui/
Albin Hedman [Sun, 6 Dec 2020 18:01:03 +0000 (19:01 +0100)]
Moved failing test to src/test/ui/
Still have not figured out how to make it work

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`