]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoDeduplicate some code
Matthew Jasper [Mon, 5 Oct 2020 16:19:24 +0000 (17:19 +0100)]
Deduplicate some code

3 years agoFix tests from rebase
Matthew Jasper [Mon, 7 Sep 2020 09:01:45 +0000 (10:01 +0100)]
Fix tests from rebase

3 years agoAvoid creating useless projection predicate
Matthew Jasper [Mon, 7 Sep 2020 08:38:09 +0000 (09:38 +0100)]
Avoid creating useless projection predicate

3 years agoFix rebase
Matthew Jasper [Sun, 6 Sep 2020 19:04:52 +0000 (20:04 +0100)]
Fix rebase

3 years agoDeduplicate item bounds after normalization
Matthew Jasper [Sat, 15 Aug 2020 19:31:07 +0000 (20:31 +0100)]
Deduplicate item bounds after normalization

3 years agoDon't require lifetime super-bounds on traits apply to trait objects of that trait
Matthew Jasper [Sat, 15 Aug 2020 11:29:23 +0000 (12:29 +0100)]
Don't require lifetime super-bounds on traits apply to trait objects of that trait

3 years agoNormalize super trait bounds when confirming object candidates
Matthew Jasper [Fri, 14 Aug 2020 20:51:28 +0000 (21:51 +0100)]
Normalize super trait bounds when confirming object candidates

3 years agoFix rebase
Matthew Jasper [Fri, 14 Aug 2020 20:41:20 +0000 (21:41 +0100)]
Fix rebase

3 years agoDon't immediately error for recursive projections
Matthew Jasper [Sat, 25 Jul 2020 20:27:34 +0000 (21:27 +0100)]
Don't immediately error for recursive projections

3 years agoFix bootstrap
Matthew Jasper [Sat, 25 Jul 2020 14:14:12 +0000 (15:14 +0100)]
Fix bootstrap

3 years agoHandle multiple trait-def projection candidates
Matthew Jasper [Sat, 25 Jul 2020 13:00:13 +0000 (14:00 +0100)]
Handle multiple trait-def projection candidates

3 years agoAvoid cycles from projection bounds
Matthew Jasper [Sat, 25 Jul 2020 12:41:53 +0000 (13:41 +0100)]
Avoid cycles from projection bounds

Only check the own predicates of associated types when confirming
projection candidates.
Also consider implied bounds when comparing trait and impl methods.

3 years agoAvoid cycle with projections from object types
Matthew Jasper [Fri, 24 Jul 2020 20:59:43 +0000 (21:59 +0100)]
Avoid cycle with projections from object types

Normalizing `<dyn Iterator<Item = ()> as Iterator>::Item` no longer
requires selecting `dyn Iterator<Item = ()>: Iterator`. This was
previously worked around by using a special type-folder to normalize
things.

3 years agoNormalize projection bounds when considering candidates
Matthew Jasper [Fri, 24 Jul 2020 18:10:22 +0000 (19:10 +0100)]
Normalize projection bounds when considering candidates

This unfortunately requires some winnowing hacks to avoid
now ambiguous candidates.

3 years agoHandle multiple applicable projection candidates
Matthew Jasper [Thu, 23 Jul 2020 20:59:20 +0000 (21:59 +0100)]
Handle multiple applicable projection candidates

3 years agoFix bugs in evaluating WellFormed predicates
Matthew Jasper [Wed, 22 Jul 2020 21:43:18 +0000 (22:43 +0100)]
Fix bugs in evaluating WellFormed predicates

- List the nestsed obligations in an order that works with the
  single pass used by evaluation
- Propagate recursion depth correctly

3 years agoAvoid cycle in nested obligations for object candidate
Matthew Jasper [Sun, 5 Jul 2020 11:16:25 +0000 (12:16 +0100)]
Avoid cycle in nested obligations for object candidate

Bounds of the form `type Future: Future<Result=Self::Result>` exist in
some ecosystem crates. To validate these bounds for trait objects we
need to normalize `Self::Result` in a way that doesn't cause a cycle.

3 years agoRemove predicates on associated types from traits
Matthew Jasper [Sat, 4 Jul 2020 11:15:04 +0000 (12:15 +0100)]
Remove predicates on associated types from traits

These need to only be bounds to avoid cycle errors in trait checking.

3 years agoAddress review comments
Matthew Jasper [Thu, 2 Jul 2020 20:45:28 +0000 (21:45 +0100)]
Address review comments

3 years agoFix ICE
Matthew Jasper [Wed, 1 Jul 2020 20:56:35 +0000 (21:56 +0100)]
Fix ICE

3 years agoFix tools
Matthew Jasper [Tue, 30 Jun 2020 21:41:57 +0000 (22:41 +0100)]
Fix tools

3 years agoFix tests and bootstrap
Matthew Jasper [Mon, 29 Jun 2020 21:15:11 +0000 (22:15 +0100)]
Fix tests and bootstrap

3 years agoEnsure that associated types for trait objects satisfy their bounds
Matthew Jasper [Sun, 28 Jun 2020 19:34:56 +0000 (20:34 +0100)]
Ensure that associated types for trait objects satisfy their bounds

3 years agoMove some code from rustc_typeck to rustc_trait_selection
Matthew Jasper [Sun, 28 Jun 2020 19:29:08 +0000 (20:29 +0100)]
Move some code from rustc_typeck to rustc_trait_selection

3 years agoRemove unused part of return value from `replace_bound_vars_with_placeholders`
Matthew Jasper [Sun, 28 Jun 2020 19:27:59 +0000 (20:27 +0100)]
Remove unused part of return value from `replace_bound_vars_with_placeholders`

3 years agoCheck associated type bounds for object safety violations
Matthew Jasper [Sun, 28 Jun 2020 16:36:41 +0000 (17:36 +0100)]
Check associated type bounds for object safety violations

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