]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoCheck opaque types satisfy their bounds
Matthew Jasper [Sun, 28 Jun 2020 15:46:02 +0000 (16:46 +0100)]
Check opaque types satisfy their bounds

3 years agoCheck projections are well-formed when using projection candidates
Matthew Jasper [Sun, 28 Jun 2020 11:41:46 +0000 (12:41 +0100)]
Check projections are well-formed when using projection candidates

3 years agoMake projection wf check the predicates for the projection
Matthew Jasper [Sun, 28 Jun 2020 09:51:32 +0000 (10:51 +0100)]
Make projection wf check the predicates for the projection

3 years agoSeparate bounds and predicates for associated/opaque types
Matthew Jasper [Sat, 27 Jun 2020 20:36:35 +0000 (21:36 +0100)]
Separate bounds and predicates for associated/opaque types

3 years agoSplit bounds from predicates
Matthew Jasper [Wed, 24 Jun 2020 18:13:44 +0000 (19:13 +0100)]
Split bounds from predicates

3 years agoMove item_bounds to typeck::collect
Matthew Jasper [Tue, 23 Jun 2020 17:18:06 +0000 (18:18 +0100)]
Move item_bounds to typeck::collect

3 years agoRename projection_predicates to item_bounds
Matthew Jasper [Tue, 23 Jun 2020 16:57:24 +0000 (17:57 +0100)]
Rename projection_predicates to item_bounds

3 years agoAuto merge of #77606 - JohnTitor:rollup-7rgahdt, r=JohnTitor
bors [Tue, 6 Oct 2020 08:05:27 +0000 (08:05 +0000)]
Auto merge of #77606 - JohnTitor:rollup-7rgahdt, r=JohnTitor

Rollup of 13 pull requests

Successful merges:

 - #76388 (Add a note about the panic behavior of math operations on time objects)
 - #76855 (Revamp rustdoc docs about documentation using `cfg`)
 - #76995 (Reduce boilerplate with the matches! macro)
 - #77228 (Add missing examples for MaybeUninit)
 - #77528 (Avoid unchecked casts in net parser)
 - #77534 (Disallow overriding forbid in same scope)
 - #77555 (Allow anyone to set regression labels)
 - #77558 (Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml})
 - #77559 (Fix rustdoc warnings about invalid Rust syntax)
 - #77560 (Fix LitKind's byte buffer to use refcounted slice)
 - #77573 (Hint doc use convert::identity relative link)
 - #77587 (Fix span for unicode escape suggestion.)
 - #77591 (Record `expansion_that_defined` into crate metadata)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebank
Yuki Okushi [Tue, 6 Oct 2020 07:26:16 +0000 (16:26 +0900)]
Rollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebank

Record `expansion_that_defined` into crate metadata

Fixes #77523

Now that hygiene serialization is implemented, we also need to record
`expansion_that_defined` so that we properly handle a foreign
`SyntaxContext`.

3 years agoRollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse
Yuki Okushi [Tue, 6 Oct 2020 07:26:14 +0000 (16:26 +0900)]
Rollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse

Fix span for unicode escape suggestion.

If a unicode escape is missing the curly braces, the suggested fix is to add the curly braces, but the span for the fix was incorrect. It was not covering the `\u`, but the suggested text includes the `\u`, causing the resulting fix to be `"\u\u{1234}"`. This changes it so that the span includes the `\u`. An alternate fix would be to remove `\u` from the suggested fix, but I think the error message reads better if the entire escape is included.

3 years agoRollup merge of #77573 - pickfire:patch-7, r=jyn514
Yuki Okushi [Tue, 6 Oct 2020 07:26:12 +0000 (16:26 +0900)]
Rollup merge of #77573 - pickfire:patch-7, r=jyn514

Hint doc use convert::identity relative link

r? @jyn514

3 years agoRollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:11 +0000 (16:26 +0900)]
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr

Fix LitKind's byte buffer to use refcounted slice

While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.

This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).

3 years agoRollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:09 +0000 (16:26 +0900)]
Rollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr

Fix rustdoc warnings about invalid Rust syntax

3 years agoRollup merge of #77558 - thomcc:defaults-toml-extension, r=jyn514
Yuki Okushi [Tue, 6 Oct 2020 07:26:07 +0000 (16:26 +0900)]
Rollup merge of #77558 - thomcc:defaults-toml-extension, r=jyn514

Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}

This allows these files to have okay syntax highlighting in editors, and helps avoid nagging from editors which want to suggest that I install a plugin for `*.library` files to view the `config.toml.library` or whatever.

It's a very minor change.

r?@jyn514

3 years agoRollup merge of #77555 - camelid:patch-8, r=Mark-Simulacrum
Yuki Okushi [Tue, 6 Oct 2020 07:26:05 +0000 (16:26 +0900)]
Rollup merge of #77555 - camelid:patch-8, r=Mark-Simulacrum

Allow anyone to set regression labels

Cc https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/improve.20reporting.20of.20regressions/near/212245535

r? @Mark-Simulacrum

3 years agoRollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in...
Yuki Okushi [Tue, 6 Oct 2020 07:26:04 +0000 (16:26 +0900)]
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov

Disallow overriding forbid in same scope

Rebased #73379.

Fixes #70819.

3 years agoRollup merge of #77528 - tamird:avoid-cast-net-parser, r=dtolnay
Yuki Okushi [Tue, 6 Oct 2020 07:26:02 +0000 (16:26 +0900)]
Rollup merge of #77528 - tamird:avoid-cast-net-parser, r=dtolnay

Avoid unchecked casts in net parser

Once this and #77426 are in, I'll send another PR adding scope id parsing.

r? @dtolnay

3 years agoRollup merge of #77228 - GuillaumeGomez:maybeuninit-examples, r=pickfire
Yuki Okushi [Tue, 6 Oct 2020 07:26:00 +0000 (16:26 +0900)]
Rollup merge of #77228 - GuillaumeGomez:maybeuninit-examples, r=pickfire

Add missing examples for MaybeUninit

r? @Dylan-DPC

3 years agoRollup merge of #76995 - LingMan:middle_matches, r=varkor
Yuki Okushi [Tue, 6 Oct 2020 07:25:58 +0000 (16:25 +0900)]
Rollup merge of #76995 - LingMan:middle_matches, r=varkor

Reduce boilerplate with the matches! macro

Replaces simple bool `match`es of the form

    match $expr {
        $pattern => true
        _ => false
    }

and their inverse with invocations of the matches! macro.

Limited to rustc_middle for now to get my feet wet.

3 years agoRollup merge of #76855 - jyn514:platform-specific, r=ollie27
Yuki Okushi [Tue, 6 Oct 2020 07:25:55 +0000 (16:25 +0900)]
Rollup merge of #76855 - jyn514:platform-specific, r=ollie27

Revamp rustdoc docs about documentation using `cfg`

- Move `cfg(doc)` out of `unstable-features`. It's not unstable.
- Remove outdated reference to `everybody_loops`.
- Improve wording in various places
- Give an example of code this allows (and does not allow)
- Link to `cfg(doc)` in `doc(cfg)` documentation. Since one is stable
and the other is not, don't combine them.
- Cleanup wording for `doc(cfg)`
- Incorporate changes from #76849
- Mention that `doc(cfg)` is also for features

Addresses https://github.com/rust-lang/rust/pull/76849#issuecomment-694516199.
Obsoletes https://github.com/rust-lang/rust/pull/76849 (I made sure to fix the weird dashes too).
r? @steveklabnik

3 years agoRollup merge of #76388 - poliorcetics:system-time-document-panic, r=KodrAus
Yuki Okushi [Tue, 6 Oct 2020 07:25:53 +0000 (16:25 +0900)]
Rollup merge of #76388 - poliorcetics:system-time-document-panic, r=KodrAus

Add a note about the panic behavior of math operations on time objects

Fixes #71226.

3 years agoRevamp rustdoc docs about documentation using `cfg`
Joshua Nelson [Thu, 17 Sep 2020 22:05:56 +0000 (18:05 -0400)]
Revamp rustdoc docs about documentation using `cfg`

- Move `cfg(doc)` out of `unstable-features`. It's not unstable.
- Remove outdated reference to `everybody_loops`.
- Improve wording in various places
- Give an example of code this allows (and does not allow)
- Link to `cfg(doc)` in `doc(cfg)` documentation. Since one is stable
and the other is not, don't combine them.
- Cleanup wording for `doc(cfg)`
- Incorporate changes from #76849
- Mention that `doc(cfg)` is also for features

3 years agoFixup
Camelid [Mon, 5 Oct 2020 22:07:27 +0000 (15:07 -0700)]
Fixup

3 years agoRecord `expansion_that_defined` into crate metadata
Aaron Hill [Mon, 5 Oct 2020 19:32:25 +0000 (15:32 -0400)]
Record `expansion_that_defined` into crate metadata

Fixes #77523

Now that hygiene serialization is implemented, we also need to record
`expansion_that_defined` so that we properly handle a foreign
`SyntaxContext`.

3 years agoAuto merge of #77080 - richkadel:llvm-coverage-counters-2, r=tmandry
bors [Mon, 5 Oct 2020 19:34:44 +0000 (19:34 +0000)]
Auto merge of #77080 - richkadel:llvm-coverage-counters-2, r=tmandry

Working branch-level code coverage

Add a generalized implementation for computing branch-level coverage spans.

This iteration resolves some of the challenges I had identified a few weeks ago.

I've tried to implement a solution that is general enough to work for a lot of different graphs/patterns. It's encouraging to see the results on fairly large and complex crates seem to meet my expectations. This may be a "functionally complete" implementation.

Except for bug fixes or edge cases I haven't run into yet, the next and essentially final step, I think, is to replace some Counters with CounterExpressions (where their counter values can be computed by adding or subtracting other counters/expressions).

Examples of branch-level coverage support enabled in this PR:

* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_drop_trait.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if_else.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_loop.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_match.txt
* ... _and others in the same directory_

Examples of coverage analysis results (MIR spanview files) used to inject counters in the right `BasicBlocks`:

* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_drop_trait/coverage_of_drop_trait.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if/coverage_of_if.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if_else/coverage_of_if_else.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_loop/coverage_of_simple_loop.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_match/coverage_of_simple_match.main.-------.InstrumentCoverage.0.html
* ... _and others in the same directory_

Here is some sample coverage output after compiling a few real-world crates with the new branch-level coverage features:

<img width="801" alt="Screen Shot 2020-09-25 at 1 03 11 PM" src="https://user-images.githubusercontent.com/3827298/94316848-fd882c00-ff39-11ea-9cff-0402d3abd1e7.png">
<img width="721" alt="Screen Shot 2020-09-25 at 1 00 36 PM" src="https://user-images.githubusercontent.com/3827298/94316886-11cc2900-ff3a-11ea-9d03-80b26c8a5173.png">
<img width="889" alt="Screen Shot 2020-09-25 at 12 54 57 PM" src="https://user-images.githubusercontent.com/3827298/94316900-18f33700-ff3a-11ea-8a80-58f67d84b8de.png">

r? `@tmandry`
FYI: `@wesleywiser`

3 years agoFix span for unicode escape suggestion.
Eric Huss [Mon, 5 Oct 2020 18:19:08 +0000 (11:19 -0700)]
Fix span for unicode escape suggestion.

3 years agoAuto merge of #77171 - VFLashM:better_sso_structures, r=oli-obk
bors [Mon, 5 Oct 2020 17:18:01 +0000 (17:18 +0000)]
Auto merge of #77171 - VFLashM:better_sso_structures, r=oli-obk

Better sso structures

This change greatly expands interface of MiniSet/MiniMap and renames them because they are no longer "Mini".

3 years agoRenamed tests to avoid exceeding Windows max path limit
Rich Kadel [Mon, 5 Oct 2020 16:26:30 +0000 (09:26 -0700)]
Renamed tests to avoid exceeding Windows max path limit

3 years agohint doc use intra-doc links
Ivan Tham [Mon, 5 Oct 2020 15:29:43 +0000 (23:29 +0800)]
hint doc use intra-doc links

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoUpdates to experimental coverage counter injection
Rich Kadel [Tue, 1 Sep 2020 23:15:17 +0000 (16:15 -0700)]
Updates to experimental coverage counter injection

This is a combination of 18 commits.

Commit #2:

Additional examples and some small improvements.

Commit #3:

fixed mir-opt non-mir extensions and spanview title elements

Corrected a fairly recent assumption in runtest.rs that all MIR dump
files end in .mir. (It was appending .mir to the graphviz .dot and
spanview .html file names when generating blessed output files. That
also left outdated files in the baseline alongside the files with the
incorrect names, which I've now removed.)

Updated spanview HTML title elements to match their content, replacing a
hardcoded and incorrect name that was left in accidentally when
originally submitted.

Commit #4:

added more test examples

also improved Makefiles with support for non-zero exit status and to
force validation of tests unless a specific test overrides it with a
specific comment.

Commit #5:

Fixed rare issues after testing on real-world crate

Commit #6:

Addressed PR feedback, and removed temporary -Zexperimental-coverage

-Zinstrument-coverage once again supports the latest capabilities of
LLVM instrprof coverage instrumentation.

Also fixed a bug in spanview.

Commit #7:

Fix closure handling, add tests for closures and inner items

And cleaned up other tests for consistency, and to make it more clear
where spans start/end by breaking up lines.

Commit #8:

renamed "typical" test results "expected"

Now that the `llvm-cov show` tests are improved to normally expect
matching actuals, and to allow individual tests to override that
expectation.

Commit #9:

test coverage of inline generic struct function

Commit #10:

Addressed review feedback

* Removed unnecessary Unreachable filter.
* Replaced a match wildcard with remining variants.
* Added more comments to help clarify the role of successors() in the
CFG traversal

Commit #11:

refactoring based on feedback

* refactored `fn coverage_spans()`.
* changed the way I expand an empty coverage span to improve performance
* fixed a typo that I had accidently left in, in visit.rs

Commit #12:

Optimized use of SourceMap and SourceFile

Commit #13:

Fixed a regression, and synched with upstream

Some generated test file names changed due to some new change upstream.

Commit #14:

Stripping out crate disambiguators from demangled names

These can vary depending on the test platform.

Commit #15:

Ignore llvm-cov show diff on test with generics, expand IO error message

Tests with generics produce llvm-cov show results with demangled names
that can include an unstable "crate disambiguator" (hex value). The
value changes when run in the Rust CI Windows environment. I added a sed
filter to strip them out (in a prior commit), but sed also appears to
fail in the same environment. Until I can figure out a workaround, I'm
just going to ignore this specific test result. I added a FIXME to
follow up later, but it's not that critical.

I also saw an error with Windows GNU, but the IO error did not
specify a path for the directory or file that triggered the error. I
updated the error messages to provide more info for next, time but also
noticed some other tests with similar steps did not fail. Looks
spurious.

Commit #16:

Modify rust-demangler to strip disambiguators by default

Commit #17:

Remove std::process::exit from coverage tests

Due to Issue #77553, programs that call std::process::exit() do not
generate coverage results on Windows MSVC.

Commit #18:

fix: test file paths exceeding Windows max path len

3 years agoHint doc use convert::identity relative link
Ivan Tham [Mon, 5 Oct 2020 14:47:52 +0000 (22:47 +0800)]
Hint doc use convert::identity relative link

3 years agoAuto merge of #77543 - Mark-Simulacrum:rsp-quoting, r=eddyb
bors [Mon, 5 Oct 2020 13:54:22 +0000 (13:54 +0000)]
Auto merge of #77543 - Mark-Simulacrum:rsp-quoting, r=eddyb

Force posix-style quoting on lld, independent of host platform

This just blindly applies the logic from `@eddyb's` comment here: https://github.com/rust-lang/rust/issues/76466#issuecomment-699024973

Hopefully, this fixed #76466 -- I cannot test this though.

3 years agoInstruct lld that our @ files are posix-style, not Windows
Mark Rousskov [Sun, 4 Oct 2020 20:10:08 +0000 (16:10 -0400)]
Instruct lld that our @ files are posix-style, not Windows

An upstream LLVM change changed behavior here to respect the host system quoting
rules; previously the posix-style format was always used for @files.

3 years agoAuto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk
bors [Mon, 5 Oct 2020 11:41:59 +0000 (11:41 +0000)]
Auto merge of #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk

 Fix miscompile in SimplifyBranchSame

Cherry-picked from #77486, but with a different test case that used to be compiled incorrectly on both master & beta branches.

3 years agoAdd missing examples for MaybeUninit
Guillaume Gomez [Sat, 26 Sep 2020 13:31:30 +0000 (15:31 +0200)]
Add missing examples for MaybeUninit

3 years agoAuto merge of #77552 - ecstatic-morse:body-def-id, r=lcnr
bors [Mon, 5 Oct 2020 09:26:32 +0000 (09:26 +0000)]
Auto merge of #77552 - ecstatic-morse:body-def-id, r=lcnr

Replace `(Body, DefId)` with `Body` where possible

Follow-up to #77430.

I `grep`-ed for parameter lists in which a `Body` appeared within a few lines of a `DefId`, so it's possible that I missed some cases, but this should be pretty complete. Most of these changes were mechanical, but there's a few places where I started calling things "caller" and "callee" when multiple `DefId`s were in-scope at once. Also, we should probably have a helper function on `Body` that returns a `LocalDefId`. I can do that in this PR or in a follow-up.

3 years agoAuto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC
bors [Mon, 5 Oct 2020 02:49:51 +0000 (02:49 +0000)]
Auto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #75853 (Use more intra-doc-links in `core::fmt`)
 - #75928 (Remove trait_selection error message in specific case)
 - #76329 (Add check for doc alias attribute at crate level)
 - #77219 (core::global_allocator docs link to std::alloc::GlobalAlloc)
 - #77395 (BTreeMap: admit the existence of leaf edges in comments)
 - #77407 (Improve build-manifest to work with the improved promote-release)
 - #77426 (Include scope id in SocketAddrV6::Display)
 - #77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`)
 - #77471 (BTreeMap: refactoring around edges, missed spots)
 - #77512 (Allow `Abort` terminators in all const-contexts)
 - #77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter)

Failed merges:

r? `@ghost`

3 years agoFix rustdoc warnings about invalid Rust syntax
Camelid [Mon, 5 Oct 2020 02:08:40 +0000 (19:08 -0700)]
Fix rustdoc warnings about invalid Rust syntax

3 years agoAdd changelog entry mentioning the renamed profile files
Thom Chiovoloni [Mon, 5 Oct 2020 01:39:59 +0000 (18:39 -0700)]
Add changelog entry mentioning the renamed profile files

3 years agoRename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}
Thom Chiovoloni [Mon, 5 Oct 2020 01:35:16 +0000 (18:35 -0700)]
Rename bootstrap/defaults/{config.toml.PROFILE => config.PROFILE.toml}

3 years agoAuto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasper
bors [Mon, 5 Oct 2020 00:35:58 +0000 (00:35 +0000)]
Auto merge of #77466 - Aaron1011:reland-drop-tree, r=matthewjasper

Re-land PR #71840 (Rework MIR drop tree lowering)

PR https://github.com/rust-lang/rust/pull/71840 was reverted in https://github.com/rust-lang/rust/pull/72989 to fix an LLVM error (https://github.com/rust-lang/rust/issues/72470). That LLVM error no longer occurs with the recent upgrade to LLVM 11 (https://github.com/rust-lang/rust/pull/73526), so let's try re-landing this PR.

I've cherry-picked the commits from the original PR (with the exception of the commit blessing test output), making as few modifications as possible. I addressed the rebase fallout in separate commits on top of those.

r? `@matthewjasper`

3 years agoRollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:42 +0000 (02:29 +0200)]
Rollup merge of #77514 - scottmcm:less-once-chain-once, r=estebank

Replace some once(x).chain(once(y)) with [x, y] IntoIter

Now that we have by-value array iterators that are [already used](https://github.com/rust-lang/rust/blob/25c8c53dd994acb3f4f7c02fe6bb46076393f8b0/compiler/rustc_hir/src/def.rs#L305-L307)...

For example,
```diff
-        once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it)
+        IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
```

3 years agoRollup merge of #77512 - ecstatic-morse:const-checking-allow-abort, r=RalfJung
Dylan DPC [Mon, 5 Oct 2020 00:29:40 +0000 (02:29 +0200)]
Rollup merge of #77512 - ecstatic-morse:const-checking-allow-abort, r=RalfJung

Allow `Abort` terminators in all const-contexts

We never unwind during const-eval, so we basically have these semantics already. Also I just figured out that these only appear along the cleanup path, which doesn't get const-checked. In other words, this doesn't actually change behavior: the `check-pass` test I added compiles just fine on nightly.

r? @RalfJung
cc @rust-lang/wg-const-eval

3 years agoRollup merge of #77471 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:38 +0000 (02:29 +0200)]
Rollup merge of #77471 - ssomers:btree_cleanup_3, r=Mark-Simulacrum

BTreeMap: refactoring around edges, missed spots

Tweaks from #77244 (and more) that are really inconsistencies in #77005.

r? @Mark-Simulacrum

3 years agoRollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:36 +0000 (02:29 +0200)]
Rollup merge of #77439 - varkor:min_const_generics-tests, r=lcnr,estebank

Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`

Closes https://github.com/rust-lang/rust/issues/61410.

Adds `min_const_generics` tests for:
- https://github.com/rust-lang/rust/issues/73727
- https://github.com/rust-lang/rust/issues/72293
- https://github.com/rust-lang/rust/issues/67375
- https://github.com/rust-lang/rust/issues/75153
- https://github.com/rust-lang/rust/issues/71922
- https://github.com/rust-lang/rust/issues/69913
- https://github.com/rust-lang/rust/issues/67945
- https://github.com/rust-lang/rust/issues/69239

Adds `const_generics` tests for:
- https://github.com/rust-lang/rust/issues/67375
- https://github.com/rust-lang/rust/issues/75153
- https://github.com/rust-lang/rust/issues/71922
- https://github.com/rust-lang/rust/issues/69913
- https://github.com/rust-lang/rust/issues/67945
- https://github.com/rust-lang/rust/issues/69239

(I only added separate `min_const_generics` and `const_generics` tests if they were handled differently by the two features.)

We need to figure out how to deduplicate when `const_generics` is stabilised, but we can discuss that later. For now, we should be checking neither feature breaks, so require regression tests for both. I've given them identical names when I've added both, which should make it easier to spot them later.

r? @lcnr

3 years agoRollup merge of #77426 - tamird:sockaddr-scope-id, r=dtolnay
Dylan DPC [Mon, 5 Oct 2020 00:29:35 +0000 (02:29 +0200)]
Rollup merge of #77426 - tamird:sockaddr-scope-id, r=dtolnay

Include scope id in SocketAddrV6::Display

r? @tmandry

I couldn't find any unit tests for these functions.

cc @ghanan94 @brunowonka

3 years agoRollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:33 +0000 (02:29 +0200)]
Rollup merge of #77407 - pietroalbini:less-build-manifest, r=Mark-Simulacrum

Improve build-manifest to work with the improved promote-release

This PR makes some changes to build-manifest to have it work better with the other improvements I'm making to [promote-release](https://github.com/rust-lang/promote-release).

A new way to invoke the tool was added: `./x.py run src/tools/build-manifest`. The new invocation disables the generation of `.sha256` files and the generation of GPG signatures, as those steps are not tied to the Rust version we're building the manifest of: handling them in `promote-release` will improve the maintenability of our release process. Invocations through the old command (`./x.py dist hash-and-sign`) are referred inside the source code as "legacy". The new invocation also enables internal parallelism, disabled on legacy to avoid overloading our old server.

Improvements were also made on how the checksums included in the manifest are generated:

* The manifest is first generated with placeholder checksums, and then a function walks through the manifes and calculates only the needed hashes. Before this PR, all the hashes were calculated beforehand, including the hashes of unused files.
* Calculating the hashes is now done in parallel with rayon, to better utilize all the available disk bandwidth.
* The `sha2` crate is now used instead of the `sha256sum` CLI tool: this avoids the overhead of calling another process, but more importantly enables hardware acceleration whenever available (the `sha256sum` CLI tool doesn't support it at all).

r? @Mark-Simulacrum
This PR is best reviewed commit-by-commit.

3 years agoRollup merge of #77395 - ssomers:btree_love_the_leaf_edge_comments, r=Mark-Simulacrum
Dylan DPC [Mon, 5 Oct 2020 00:29:31 +0000 (02:29 +0200)]
Rollup merge of #77395 - ssomers:btree_love_the_leaf_edge_comments, r=Mark-Simulacrum

BTreeMap: admit the existence of leaf edges in comments

The btree code is ambiguous about leaf edges (i.e., edges within leaf nodes). Iteration relies on them heavily, but some of the comments suggest there are no leaf edges (extracted from #77025)

r? @Mark-Simulacrum

3 years agoRollup merge of #77219 - mightyiam:issue_77100, r=jyn514
Dylan DPC [Mon, 5 Oct 2020 00:29:29 +0000 (02:29 +0200)]
Rollup merge of #77219 - mightyiam:issue_77100, r=jyn514

core::global_allocator docs link to std::alloc::GlobalAlloc

Closes #77100

3 years agoRollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasper
Dylan DPC [Mon, 5 Oct 2020 00:29:27 +0000 (02:29 +0200)]
Rollup merge of #76329 - GuillaumeGomez:doc-alias-crate-level, r=matthewjasper

Add check for doc alias attribute at crate level

Fixes #76298, #64734, #69365.

r? @ollie27

3 years agoRollup merge of #75928 - JulianKnodt:non_utf8, r=estebank
Dylan DPC [Mon, 5 Oct 2020 00:29:25 +0000 (02:29 +0200)]
Rollup merge of #75928 - JulianKnodt:non_utf8, r=estebank

Remove trait_selection error message in specific case

In the case that a trait is not implemented for an ADT with type errors, cancel the error.

Fixes #75627

3 years agoRollup merge of #75853 - LeSeulArtichaut:core-intra-docs-3, r=jyn514
Dylan DPC [Mon, 5 Oct 2020 00:29:23 +0000 (02:29 +0200)]
Rollup merge of #75853 - LeSeulArtichaut:core-intra-docs-3, r=jyn514

Use more intra-doc-links in `core::fmt`

This is a follow-up to #75819, which encountered some broken links due to #75176, so this PR contains the links that are blocked on #75176.

r? @jyn514

3 years agoRemove `DefId` from `MirBorrowckCtxt`
Dylan MacKenzie [Mon, 5 Oct 2020 00:23:02 +0000 (17:23 -0700)]
Remove `DefId` from `MirBorrowckCtxt`

3 years agonll: solve
Dylan MacKenzie [Mon, 5 Oct 2020 00:22:40 +0000 (17:22 -0700)]
nll: solve

3 years agoReplace `(Body, WithOptConstParam)` with `Body` where possible
Dylan MacKenzie [Sun, 4 Oct 2020 23:59:19 +0000 (16:59 -0700)]
Replace `(Body, WithOptConstParam)` with `Body` where possible

3 years agoAllow anyone to set regression labels
Camelid [Sun, 4 Oct 2020 23:57:32 +0000 (16:57 -0700)]
Allow anyone to set regression labels

3 years agoclippy: `(Body, DefId)` -> `Body`
Dylan MacKenzie [Sun, 4 Oct 2020 22:23:20 +0000 (15:23 -0700)]
clippy: `(Body, DefId)` -> `Body`

3 years agoReplace `(Body, DefId)` with `Body` where possible
Dylan MacKenzie [Sun, 4 Oct 2020 22:22:23 +0000 (15:22 -0700)]
Replace `(Body, DefId)` with `Body` where possible

A `Body` now contains its `MirSource`, which in turn contains the
`DefId` of the item associated with the `Body`.

3 years agoChange clippy's Constant back to refcount clone byte strings
Robin Schoonover [Sun, 4 Oct 2020 21:53:37 +0000 (15:53 -0600)]
Change clippy's Constant back to refcount clone byte strings

3 years agoRemove extra indirection in LitKind::ByteStr
Robin Schoonover [Thu, 17 Sep 2020 01:41:22 +0000 (19:41 -0600)]
Remove extra indirection in LitKind::ByteStr

3 years agoAuto merge of #77023 - HeroicKatora:len-missed-optimization, r=Mark-Simulacrum
bors [Sun, 4 Oct 2020 21:08:06 +0000 (21:08 +0000)]
Auto merge of #77023 - HeroicKatora:len-missed-optimization, r=Mark-Simulacrum

Hint the maximum length permitted by invariant of slices

One of the safety invariants of references, and in particular of references to slices, is that they may not cover more than `isize::MAX` bytes. The unsafe `from_raw_parts` constructors of slices explicitly requires the caller to guarantee this fact. Violating it would also be UB with regards to the semantics of generated llvm code.

This effectively bounds the length of a (non-ZST) slice from above by a compile time constant. But when the length is loaded from a function argument it appears llvm is not aware of this requirement. The additional value range assertions allow some further elision of code branches, including overflow checks, especially in the presence of artithmetic on the indices.

This may have a performance impact, adding more code to a common method but allowing more optimization. I'm not quite sure, is the Rust side of const-prop strong enough to elide the irrelevant match branches?

Fixes: #67186
3 years agoUse more intra-doc-links in `core::fmt`
LeSeulArtichaut [Sun, 23 Aug 2020 22:16:19 +0000 (00:16 +0200)]
Use more intra-doc-links in `core::fmt`

3 years agoBut whatever
ecstatic-morse [Sun, 4 Oct 2020 20:25:45 +0000 (13:25 -0700)]
But whatever

3 years agoAdd comment to `Abort` match arm
ecstatic-morse [Sun, 4 Oct 2020 20:02:54 +0000 (13:02 -0700)]
Add comment to `Abort` match arm

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoBless more test output
Aaron Hill [Sun, 4 Oct 2020 11:57:53 +0000 (07:57 -0400)]
Bless more test output

3 years agoAssume slice len is bounded by allocation size
Andreas Molzer [Sun, 20 Sep 2020 15:22:17 +0000 (17:22 +0200)]
Assume slice len is bounded by allocation size

Uses assume to check the length against a constant upper bound. The
inlined result then informs the optimizer of the sound value range.

This was tried with unreachable_unchecked before which introduces a
branch. This has the advantage of not being executed in sound code but
complicates basic blocks. It resulted in ~2% increased compile time in
some worst cases.

Add a codegen test for the assumption, testing the issue from #67186

3 years agoAuto merge of #77430 - ecstatic-morse:mir-source-in-body, r=lcnr
bors [Sun, 4 Oct 2020 18:24:02 +0000 (18:24 +0000)]
Auto merge of #77430 - ecstatic-morse:mir-source-in-body, r=lcnr

Store a `MirSource` inside every `Body`

Resolves #77427.

r? `@ghost`

3 years agoHACK: Overwrite the MIR's source with the correct const param
Dylan MacKenzie [Fri, 2 Oct 2020 01:47:36 +0000 (18:47 -0700)]
HACK: Overwrite the MIR's source with the correct const param

There's a cleaner way of doing this, but it involves passing
`WithOptConstParam` around in more places. We're going to try to explore
different approaches before committing to that.

3 years agoRemember the `MirSource` for each `Body`
Dylan MacKenzie [Sun, 4 Oct 2020 18:01:38 +0000 (11:01 -0700)]
Remember the `MirSource` for each `Body`

3 years agoMove `MirSource` to `rustc_middle`
Dylan MacKenzie [Sun, 4 Oct 2020 18:01:13 +0000 (11:01 -0700)]
Move `MirSource` to `rustc_middle`

3 years agoMiscellaneous import formatting
Dylan MacKenzie [Sun, 4 Oct 2020 17:59:11 +0000 (10:59 -0700)]
Miscellaneous import formatting

3 years agoDiscuss cleanup blocks and `span_bug` on `Abort`
Dylan MacKenzie [Sun, 4 Oct 2020 17:39:12 +0000 (10:39 -0700)]
Discuss cleanup blocks and `span_bug` on `Abort`

3 years agoPrevent forbid from being ignored if overriden at the same level.
Felix S. Klock II [Mon, 15 Jun 2020 18:17:35 +0000 (14:17 -0400)]
Prevent forbid from being ignored if overriden at the same level.

That is, this changes `#[forbid(foo)] #[allow(foo)]` from allowing foo to
forbidding foo.

3 years agoInline "eof" methods
Tamir Duberstein [Sun, 4 Oct 2020 17:07:30 +0000 (17:07 +0000)]
Inline "eof" methods

3 years agoAvoid unchecked casts in net parser
Tamir Duberstein [Sun, 4 Oct 2020 12:39:39 +0000 (12:39 +0000)]
Avoid unchecked casts in net parser

3 years agorewrite old test so that its attributes are consistent with what we want in the language.
Felix S. Klock II [Mon, 15 Jun 2020 15:50:58 +0000 (11:50 -0400)]
rewrite old test so that its attributes are consistent with what we want in the language.

(Note that the fact this test existed is a slight sign that we may need a crater
run on this bugfix...)

3 years agoAuto merge of #77527 - jonas-schievink:rollup-szgq5he, r=jonas-schievink
bors [Sun, 4 Oct 2020 13:49:36 +0000 (13:49 +0000)]
Auto merge of #77527 - jonas-schievink:rollup-szgq5he, r=jonas-schievink

Rollup of 8 pull requests

Successful merges:

 - #77072 (Minor `hash_map` doc adjustments + item attribute orderings)
 - #77368 (Backport LLVM apfloat commit to rustc_apfloat)
 - #77445 (BTreeMap: complete the compile-time test_variance test case)
 - #77504 (Support vectors with fewer than 8 elements for simd_select_bitmask)
 - #77513 (Change DocFragments from enum variant fields to structs with a nested enum)
 - #77518 (Only use Fira Sans for the first `td` in item lists)
 - #77521 (Move target feature whitelist from cg_llvm to cg_ssa)
 - #77525 (Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink
Jonas Schievink [Sun, 4 Oct 2020 13:45:50 +0000 (15:45 +0200)]
Rollup merge of #77525 - tmiasko:nrvo-2, r=jonas-schievink

Enable RenameReturnPlace MIR optimization on mir-opt-level >= 2

The destination propagation as currently implemented does not supersede the NRVO, e.g., the destination propagation never applies if either local has an address taken, while NRVO might.

Additionally, the issue with failing assertions had been already resolved.

Continue running both optimizations at mir-opt-level >= 2.

3 years agoRollup merge of #77521 - bjorn3:target_feature_whitelist, r=lcnr
Jonas Schievink [Sun, 4 Oct 2020 13:45:48 +0000 (15:45 +0200)]
Rollup merge of #77521 - bjorn3:target_feature_whitelist, r=lcnr

Move target feature whitelist from cg_llvm to cg_ssa

These target features have to be supported or at least emulated by alternative codegen backends anyway as they are used by common crates. By moving this list to cg_ssa, other codegen backends don't have to copy
this code.

3 years agoRollup merge of #77518 - camelid:rustdoc-use-correct-link-font, r=GuillaumeGomez
Jonas Schievink [Sun, 4 Oct 2020 13:45:46 +0000 (15:45 +0200)]
Rollup merge of #77518 - camelid:rustdoc-use-correct-link-font, r=GuillaumeGomez

Only use Fira Sans for the first `td` in item lists

Fixes #77516.

Fixes an issue where links in the one-line version of an item's docs
would be in Fira Sans, while the rest would be in a serifed font.

3 years agoRollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomez
Jonas Schievink [Sun, 4 Oct 2020 13:45:44 +0000 (15:45 +0200)]
Rollup merge of #77513 - jyn514:refactor-doc-fragments, r=GuillaumeGomez

Change DocFragments from enum variant fields to structs with a nested enum

This makes the code a lot easier to work with. It also makes it easier
to add new fields without updating each variant and `match`
individually.

- Name the `Kind` variant after `DocFragmentKind` from `collapse_docs`
- Remove unneeded impls

Progress towards https://github.com/rust-lang/rust/issues/77254.
r? @GuillaumeGomez

3 years agoRollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse
Jonas Schievink [Sun, 4 Oct 2020 13:45:43 +0000 (15:45 +0200)]
Rollup merge of #77504 - Amanieu:select_simd_bitmask, r=ecstatic-morse

Support vectors with fewer than 8 elements for simd_select_bitmask

Resolves the issue raised here: https://github.com/rust-lang/stdarch/issues/310#issuecomment-693730094

3 years agoRollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum
Jonas Schievink [Sun, 4 Oct 2020 13:45:41 +0000 (15:45 +0200)]
Rollup merge of #77445 - ssomers:btree_cleanup_7, r=Mark-Simulacrum

BTreeMap: complete the compile-time test_variance test case

Some of the items added to the new `test_sync` belonged in the old `test_variance` as well. And fixed inconsistent paths to nearby modules.
r? @Mark-Simulacrum

3 years agoRollup merge of #77368 - est31:apfloat_fix, r=varkor
Jonas Schievink [Sun, 4 Oct 2020 13:45:39 +0000 (15:45 +0200)]
Rollup merge of #77368 - est31:apfloat_fix, r=varkor

Backport LLVM apfloat commit to rustc_apfloat

Backports LLVM commit: https://github.com/llvm/llvm-project/commit/e34bd1e0b03d20a506ada156d87e1b3a96d82fa2

Fixes #69532

3 years agoRollup merge of #77072 - sharnoff:hash-docs, r=LukasKalbertodt
Jonas Schievink [Sun, 4 Oct 2020 13:45:33 +0000 (15:45 +0200)]
Rollup merge of #77072 - sharnoff:hash-docs, r=LukasKalbertodt

Minor `hash_map` doc adjustments + item attribute orderings

This PR is really a couple visual changes glued together:
1. Some of the doc comments for items in `std::collections::hash_map` referenced the names of types without escaping their formatting (e.g. using "VacantEntry" instead of "`VacantEntry`") - the ones I could find were changed to the latter
2. The vast majority of pre-item attributes seem to place doc comments as the first attribute (instead of things like `#[feature(...)]`), so the few that had the other order were changed.
3. Also ordering related: the general trend seems to be that `#[feature]` attributes follow `#[inline]`, so I swapped the two lines in places where that ordering was reversed. This is primarily a change based on stylistic continuity and aesthetics - I'm not sure how important that actually is / should be.

I figured this would be pretty uncontroversial, but some of these might have been intentional for reasons I don't know about - if so, I'd be happy to remove the relevant changes. Of these, the final set of changes is probably the most unnecessary, so it also might be better to leave those out (in favor of reducing code churn).

3 years agoInclude scope id in SocketAddrV6::Display
Tamir Duberstein [Thu, 1 Oct 2020 20:40:05 +0000 (20:40 +0000)]
Include scope id in SocketAddrV6::Display

3 years agoApply suggestions from review
Aaron Hill [Sat, 3 Oct 2020 15:49:05 +0000 (11:49 -0400)]
Apply suggestions from review

Co-authored-by: matthewjasper <20113453+matthewjasper@users.noreply.github.com>
3 years agoBless mir-opt tests
Aaron Hill [Fri, 2 Oct 2020 20:11:24 +0000 (16:11 -0400)]
Bless mir-opt tests

3 years agoFix broken link
Aaron Hill [Fri, 2 Oct 2020 21:24:54 +0000 (17:24 -0400)]
Fix broken link

3 years agoAdd regression test for issue #72470
Aaron Hill [Fri, 2 Oct 2020 20:30:36 +0000 (16:30 -0400)]
Add regression test for issue #72470

This was fixed with the upgrade to LLVM 11 in #73526.
It seems extremely unlikey that this exact issue will ever reoccur,
since slight modifications to the code caused the crash to stop
happening. However, it can't hurt to have a test for it.

3 years agoFix rebase fallout
Aaron Hill [Fri, 2 Oct 2020 19:40:24 +0000 (15:40 -0400)]
Fix rebase fallout

3 years agoAddress review comments
Matthew Jasper [Fri, 8 May 2020 19:00:32 +0000 (20:00 +0100)]
Address review comments

3 years agoAdd some more comments
Matthew Jasper [Sat, 29 Feb 2020 17:48:09 +0000 (17:48 +0000)]
Add some more comments

3 years agoReduce the number of drop-flag assignments in unwind paths
Matthew Jasper [Sun, 17 Nov 2019 11:30:48 +0000 (11:30 +0000)]
Reduce the number of drop-flag assignments in unwind paths

3 years agoDefer creating drop trees in MIR lowering until leaving that scope
Matthew Jasper [Sat, 16 Nov 2019 13:23:31 +0000 (13:23 +0000)]
Defer creating drop trees in MIR lowering until leaving that scope

3 years agoAuto merge of #76610 - hch12907:master, r=LukasKalbertodt
bors [Sun, 4 Oct 2020 11:48:50 +0000 (11:48 +0000)]
Auto merge of #76610 - hch12907:master, r=LukasKalbertodt

Implement as_ne_bytes() for integers and floats

This is related to issue #64464.

I am pretty sure that these functions are actually const-ify-able, and technically as_bits() can also be implemented for floats, but I might need some comments on both.

3 years agoEnforce crate level attributes checks
Guillaume Gomez [Sat, 3 Oct 2020 18:45:39 +0000 (20:45 +0200)]
Enforce crate level attributes checks

3 years agoMove target feature whitelist from cg_llvm to cg_ssa
bjorn3 [Sun, 4 Oct 2020 09:12:56 +0000 (11:12 +0200)]
Move target feature whitelist from cg_llvm to cg_ssa

These target features have to be supported or at least emulated by
alternative codegen backends anyway as they are used by common crates.
By moving this list to cg_ssa, other codegen backends don't have to copy
this code.

3 years agoAuto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu
bors [Sun, 4 Oct 2020 08:56:05 +0000 (08:56 +0000)]
Auto merge of #76448 - haraldh:default_alloc_error_handler_reduced, r=Amanieu

Implement Make `handle_alloc_error` default to panic (for no_std + liballoc)

Related: https://github.com/rust-lang/rust/issues/66741

Guarded with `#![feature(default_alloc_error_handler)]` a default
`alloc_error_handler` is called, if a custom allocator is used and no
other custom `#[alloc_error_handler]` is defined.

3 years agoAuto merge of #77380 - fusion-engineering-forks:unbox-the-mutex, r=dtolnay
bors [Sun, 4 Oct 2020 06:48:17 +0000 (06:48 +0000)]
Auto merge of #77380 - fusion-engineering-forks:unbox-the-mutex, r=dtolnay

Unbox mutexes and condvars on some platforms

Both mutexes and condition variables contained a Box containing the actual os-specific object. This was done because moving these objects may cause undefined behaviour on some platforms.

However, this is not needed on Windows[1], Wasm[2], cloudabi[2], and 'unsupported'[3], were the box was only needlessly making them less efficient.

This change gets rid of the box on those platforms.

On those platforms, `Condvar` can no longer verify it is only used with one `Mutex`, as mutexes no longer have a stable address. This was addressed and considered acceptable in #76932.

[1]\: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-initializesrwlock
[2]\: These are just a single atomic integer together with futex wait/wake calls/instructions.
[3]\: The `unsupported` platform doesn't support multiple threads at all.