]> git.lizzy.rs Git - rust.git/log
rust.git
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 #79734 - ethanboxx:inferred_const_note, r=varkor
bors [Sun, 6 Dec 2020 08:08:05 +0000 (08:08 +0000)]
Auto merge of #79734 - ethanboxx:inferred_const_note, r=varkor

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

This should close: #79557

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

error: aborting due to previous error

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

r? `@lcnr`

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

Added a lint-fraction-readability flag to the configuration

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

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

---

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

---

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

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

Update RLS and Rustfmt

Fixes #79406 Fixes #79407

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

r? `@calebcartwright`

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

remove redundant clones

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

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

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

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

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

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

A slightly clearer diagnostic when misusing const

Fixes #79598

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

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

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

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

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

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

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

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

Ping me when nomicon's toolstate is broken

So that I can notice the breakage easily.

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

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

check the recursion limit when finding a struct's tail

fixes #79437

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

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

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

Small improvement. Thanks varkor

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

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

Don't leak return value after panic in drop

Closes #47949

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

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

update Miri

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

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

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

Turn unnecessary_wraps applicability to MaybeIncorrect

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

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

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

Cleanup: move format! ui tests to where they belong

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

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

Provide IntoInnerError::into_parts

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix a style of texts in `size_of_in_element_count`

Add missing ` to texts

changelog: none

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

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

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

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

Fix perf regression caused by #79284

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

r? `@Mark-Simulacrum`

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

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

3 years agoTurn unnecessary_wraps applicability to MaybeIncorrect
flip1995 [Fri, 4 Dec 2020 09:01:09 +0000 (10:01 +0100)]
Turn unnecessary_wraps applicability to MaybeIncorrect

3 years agoAuto merge of #78177 - benjaminp:cleanups, r=jyn514
bors [Fri, 4 Dec 2020 07:11:41 +0000 (07:11 +0000)]
Auto merge of #78177 - benjaminp:cleanups, r=jyn514

A few miscellaneous comment fixes and a tiny code clarification.

3 years agoWriteback walks the HIR not the AST.
Benjamin Peterson [Wed, 21 Oct 2020 04:22:43 +0000 (23:22 -0500)]
Writeback walks the HIR not the AST.

3 years agoThe details of higher-rank sub are in the rustc book not a doc module.
Benjamin Peterson [Wed, 21 Oct 2020 04:22:34 +0000 (23:22 -0500)]
The details of higher-rank sub are in the rustc book not a doc module.

3 years agoUnnest some .chain calls, so it's clearer what's going on.
Benjamin Peterson [Wed, 21 Oct 2020 04:10:47 +0000 (23:10 -0500)]
Unnest some .chain calls, so it's clearer what's going on.

3 years agoFix comment that refers to dead enforce_object_limitations function.
Benjamin Peterson [Sun, 20 Sep 2020 15:40:30 +0000 (10:40 -0500)]
Fix comment that refers to dead enforce_object_limitations function.

3 years agoAuto merge of #79686 - Dylan-DPC:rollup-leama5f, r=Dylan-DPC
bors [Fri, 4 Dec 2020 04:51:49 +0000 (04:51 +0000)]
Auto merge of #79686 - Dylan-DPC:rollup-leama5f, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #77686 (Render Markdown in search results)
 - #79541 (Doc keyword lint pass)
 - #79602 (Fix SGX CI)
 - #79611 (Use more std:: instead of core:: in docs for consistency)
 - #79623 (Pass around Symbols instead of Idents in doctree)
 - #79627 (Update cargo)
 - #79631 (disable a ptr equality test on Miri)
 - #79638 (Use `item_name` instead of pretty printing for resolving `Self` on intra-doc links)
 - #79646 (rustc_metadata: Remove some dead code)
 - #79664 (move interpret::MemoryKind::Heap to const eval)
 - #79678 (Fix some clippy lints)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoAuto merge of #79109 - richkadel:llvm-coverage-counters-2.0.5, r=tmandry
bors [Fri, 4 Dec 2020 02:31:11 +0000 (02:31 +0000)]
Auto merge of #79109 - richkadel:llvm-coverage-counters-2.0.5, r=tmandry

Coverage tests for remaining TerminatorKinds and async, improve Assert

Tested and validate results for panic unwind, panic abort, assert!()
macro, TerminatorKind::Assert (for example, numeric overflow), and
async/await.

Implemented a previous documented idea to change Assert handling to be
the same as FalseUnwind and Goto, so it doesn't get its own
BasicCoverageBlock anymore. This changed a couple of coverage regions,
but I validated those changes are not any worse than the prior results,
and probably help assure some consistency (even if some people might
disagree with how the code region is consistently computed).

Fixed issue with async/await. AggregateKind::Generator needs to be
handled like AggregateKind::Closure; coverage span for the outer async
function should not "cover" the async body, which is actually executed
in a separate "closure" MIR.

3 years agoRollup merge of #79678 - jyn514:THE-PAPERCLIP-COMETH, r=varkor
Dylan DPC [Fri, 4 Dec 2020 02:30:39 +0000 (03:30 +0100)]
Rollup merge of #79678 - jyn514:THE-PAPERCLIP-COMETH, r=varkor

Fix some clippy lints

Happy to revert these if you think they're less readable, but personally I like them better now (especially the `else { if { ... } }` to `else if { ... }` change).

3 years agoRollup merge of #79664 - vn-ki:move-memkind-heap, r=oli-obk
Dylan DPC [Fri, 4 Dec 2020 02:30:37 +0000 (03:30 +0100)]
Rollup merge of #79664 - vn-ki:move-memkind-heap, r=oli-obk

move interpret::MemoryKind::Heap to const eval

r? ``@oli-obk``

3 years agoRollup merge of #79646 - petrochenkov:inclean, r=davidtwco
Dylan DPC [Fri, 4 Dec 2020 02:30:36 +0000 (03:30 +0100)]
Rollup merge of #79646 - petrochenkov:inclean, r=davidtwco

rustc_metadata: Remove some dead code

Follow up to https://github.com/rust-lang/rust/pull/74967

3 years agoRollup merge of #79638 - jyn514:intra-link-self-raw, r=Manishearth
Dylan DPC [Fri, 4 Dec 2020 02:30:34 +0000 (03:30 +0100)]
Rollup merge of #79638 - jyn514:intra-link-self-raw, r=Manishearth

Use `item_name` instead of pretty printing for resolving `Self` on intra-doc links

Pretty printing would add a `r#` prefix to raw identifiers, which was
not correct. In general I think this change makes sense -
pretty-printing is for showing to the *user*, `item_name` is suitable to
pass to resolve.

Fixes https://github.com/rust-lang/rust/issues/79633.

r? `@Manishearth`

3 years agoRollup merge of #79631 - RalfJung:miri-const_str_ptr, r=oli-obk
Dylan DPC [Fri, 4 Dec 2020 02:30:32 +0000 (03:30 +0100)]
Rollup merge of #79631 - RalfJung:miri-const_str_ptr, r=oli-obk

disable a ptr equality test on Miri

This test relies on deduplication of constants. I do not think that this is a *guarantee* that Rust currently makes, and indeed Miri does not deduplicate constants the same way that rustc does, leading to different behavior in this test.

For now, I propose we simply disable this test in Miri.

3 years agoRollup merge of #79627 - ehuss:update-cargo, r=ehuss
Dylan DPC [Fri, 4 Dec 2020 02:30:30 +0000 (03:30 +0100)]
Rollup merge of #79627 - ehuss:update-cargo, r=ehuss

Update cargo

12 commits in bfca1cd22bf514d5f2b6c1089b0ded0ba7dfaa6e..63d0fe43449adcb316d34d98a982b597faca4178
2020-11-24 16:33:21 +0000 to 2020-12-02 01:44:30 +0000
- Add "--workspace" to update command (rust-lang/cargo#8725)
- Add an FAQ for "Why is my crate rebuilt?" (rust-lang/cargo#8927)
- Set docs.rs as the default extern-map for crates.io (rust-lang/cargo#8877)
- remove extra whitespace when running cargo -Z help (rust-lang/cargo#8924)
- Remove version from dev-dependencies to make it easier to publish. (rust-lang/cargo#8920)
- update dependency queue to consider cost for each node (rust-lang/cargo#8908)
- Fix some rustdoc warnings. (rust-lang/cargo#8911)
- Bump miow dependency to not invalidly assume memory layout (rust-lang/cargo#8909)
- Remove unnecessary trailing semicolons (rust-lang/cargo#8906)
- Fix custom_target_dependency test. (rust-lang/cargo#8907)
- fix: we don't ignore `version` for `git`/`path` deps now (rust-lang/cargo#8900)
- doc (book): add "Getting Started" subsection: "Essential Terminology" (rust-lang/cargo#8855)

3 years agoRollup merge of #79623 - jyn514:ident, r=GuillaumeGomez
Dylan DPC [Fri, 4 Dec 2020 02:30:29 +0000 (03:30 +0100)]
Rollup merge of #79623 - jyn514:ident, r=GuillaumeGomez

Pass around Symbols instead of Idents in doctree

The span was unused.

Vaguely related to https://github.com/rust-lang/rust/pull/78082 - currently working on converting `visit_ast` to use `hir::intravisit` and this makes that a little easier.

r? ``@GuillaumeGomez``

3 years agoRollup merge of #79611 - poliorcetics:use-std-in-docs, r=jyn514
Dylan DPC [Fri, 4 Dec 2020 02:30:27 +0000 (03:30 +0100)]
Rollup merge of #79611 - poliorcetics:use-std-in-docs, r=jyn514

Use more std:: instead of core:: in docs for consistency

``@rustbot`` label T-doc

Some cleanup work to use `std::` instead of `core::` in docs as much as possible. This helps with terminology and consistency, especially for newcomers from other languages that have often heard of `std` to describe the standard library but not of `core`.

Edit: I also added more intra doc links when I saw the opportunity.

3 years agoRollup merge of #79602 - jethrogb:sgx-fix-79038, r=Mark-Simulacrum
Dylan DPC [Fri, 4 Dec 2020 02:30:25 +0000 (03:30 +0100)]
Rollup merge of #79602 - jethrogb:sgx-fix-79038, r=Mark-Simulacrum

Fix SGX CI

Broken in #79038

3 years agoRollup merge of #79541 - GuillaumeGomez:doc-keyword-lint-pass, r=lcnr
Dylan DPC [Fri, 4 Dec 2020 02:30:19 +0000 (03:30 +0100)]
Rollup merge of #79541 - GuillaumeGomez:doc-keyword-lint-pass, r=lcnr

Doc keyword lint pass

`x.py test` doesn't seem to work locally for multiple reasons so simpler to just run CI...

3 years agoRollup merge of #77686 - camelid:rustdoc-render-search-results, r=GuillaumeGomez
Dylan DPC [Fri, 4 Dec 2020 02:30:17 +0000 (03:30 +0100)]
Rollup merge of #77686 - camelid:rustdoc-render-search-results, r=GuillaumeGomez

Render Markdown in search results

Fixes #32040.

Previously Markdown documentation was not rendered to HTML for search results,
which led to the output not being very readable, particularly for inline code.
This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark
(the library rustdoc uses to parse Markdown for the main text of documentation).
However, the text for the title attribute (the text shown when you hover over an
element) still uses the plain-text rendering since it is displayed in browsers
as plain-text.

Only these styles will be rendered; everything else is stripped away:

* *italics*
* **bold**
* `inline code`

3 years agoFix src/test/ui/env-vars.rs on 128-core machines on Windows
Arlie Davis [Fri, 4 Dec 2020 02:07:29 +0000 (18:07 -0800)]
Fix src/test/ui/env-vars.rs on 128-core machines on Windows

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

3 years agoInline `is_covered_by`
Nadrieril [Thu, 3 Dec 2020 22:22:57 +0000 (22:22 +0000)]
Inline `is_covered_by`

3 years agoAuto merge of #6416 - deg4uss3r:map_err_restricted, r=ebroto
bors [Fri, 4 Dec 2020 01:04:48 +0000 (01:04 +0000)]
Auto merge of #6416 - deg4uss3r:map_err_restricted, r=ebroto

Moved map_err_ignore to restriction and updated help message

This MR moves map_err_ignore lint from `pedantic` to the `restriction` category of lints and updates the help message to give the user an option to ignore the lint by naming the closure variable e.g. `.map_err(|_ignored| ...`

---

changelog: move map_err_ignore to restriction category

3 years agoAuto merge of #6394 - nico-abram:unsafe_sizeof_count_copies, r=ebroto
bors [Fri, 4 Dec 2020 00:43:00 +0000 (00:43 +0000)]
Auto merge of #6394 - nico-abram:unsafe_sizeof_count_copies, r=ebroto

Add lint size_of_in_element_count

Fixes #6381
changelog: Add lint to check for using size_of::<T> or size_of_val::<T> in the count parameter to ptr::copy or ptr::copy_nonoverlapping, which take a count of Ts (And not a count of bytes)

- \[X] Followed [lint naming conventions][lint_naming]
- \[X] Added passing UI tests (including committed `.stderr` file)
- \[ ] `cargo test` passes locally
- \[X] Executed `cargo dev update_lints`
- \[X] Added lint documentation
- \[X] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

Running `cargo test` locally fails with this error:

```
running 1 test
test fmt ... FAILED

failures:

---- fmt stdout ----
status: exit code: 1
stdout:
stderr: error: unable to unlink old fallback exe
error: caused by: Access is denied. (os error 5)

thread 'fmt' panicked at 'Formatting check failed. Run `cargo dev fmt` to update formatting.', tests\fmt.rs:32:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    fmt

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
```

But I did run `cargo dev fmt`

3 years agoAdded test to make sure ignoring the error with a named wildcard value works
Ricky [Fri, 4 Dec 2020 00:41:44 +0000 (19:41 -0500)]
Added test to make sure ignoring the error with a named wildcard value works

3 years agoAdd more functions to size_of_in_element_count
unknown [Tue, 1 Dec 2020 00:54:50 +0000 (21:54 -0300)]
Add more functions to size_of_in_element_count
Specifically ptr::{sub, wrapping_sub, add, wrapping_add, offset, wrapping_offset} and slice::{from_raw_parts, from_raw_parts_mut}
The lint now also looks for size_of calls through casts (Since offset takes an isize)

3 years agoRename unsafe_sizeof_count_copies to size_of_in_element_count
unknown [Thu, 3 Dec 2020 23:55:38 +0000 (20:55 -0300)]
Rename unsafe_sizeof_count_copies to size_of_in_element_count

Also fix review comments:
 - Use const arrays and iterate them for the method/function names
 - merge 2 if_chain's into one using a rest pattern
 - remove unnecessary unsafe block in test

And make the lint only point to the count expression instead of the entire function call

3 years agoRemove unnecessary unsafe_size_count_copies tests
unknown [Sun, 29 Nov 2020 17:32:11 +0000 (14:32 -0300)]
Remove unnecessary unsafe_size_count_copies tests

3 years agoMake the unsafe_sizeof_count_copies lint work with more functions
unknown [Sun, 29 Nov 2020 17:23:59 +0000 (14:23 -0300)]
Make the unsafe_sizeof_count_copies lint work with more functions
Specifically:
 - find std::ptr::write_bytes
 - find std::ptr::swap_nonoverlapping
 - find std::ptr::slice_from_raw_parts
 - find std::ptr::slice_from_raw_parts_mut
 - pointer_primitive::write_bytes

3 years agoMake the unsafe_sizeof_count_copies lint find copy_{from,to} method calls
unknown [Sun, 29 Nov 2020 04:47:32 +0000 (01:47 -0300)]
Make the unsafe_sizeof_count_copies lint find copy_{from,to} method calls

3 years agoAdd lint unsafe_sizeof_count_copies
unknown [Sat, 28 Nov 2020 01:44:02 +0000 (22:44 -0300)]
Add lint unsafe_sizeof_count_copies

3 years agoUpdate the stderr message in ui tests
Ricky [Thu, 3 Dec 2020 22:49:27 +0000 (17:49 -0500)]
Update the stderr message in ui tests

3 years agoApply suggestions from code review
Ricky [Thu, 3 Dec 2020 22:44:50 +0000 (17:44 -0500)]
Apply suggestions from code review

updated help message for the user

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
3 years agodidn't update lint correctly
Ricky [Thu, 3 Dec 2020 22:22:03 +0000 (17:22 -0500)]
didn't update lint correctly

3 years agoAdd missing feature flag
Camelid [Thu, 3 Dec 2020 21:08:40 +0000 (13:08 -0800)]
Add missing feature flag

Accidentally removed in rebase.

3 years agoAdd more rustdoc-js test cases
Camelid [Tue, 24 Nov 2020 19:18:45 +0000 (11:18 -0800)]
Add more rustdoc-js test cases

3 years agoAdd rustdoc-js test
Camelid [Tue, 24 Nov 2020 04:33:41 +0000 (20:33 -0800)]
Add rustdoc-js test

Finally!

3 years agoMake `length_limit` a `usize`
Camelid [Tue, 24 Nov 2020 03:26:15 +0000 (19:26 -0800)]
Make `length_limit` a `usize`

3 years agoUse `createElement` and `innerHTML` instead of `DOMParser`
Camelid [Tue, 17 Nov 2020 20:24:16 +0000 (12:24 -0800)]
Use `createElement` and `innerHTML` instead of `DOMParser`

@GuillaumeGomez was concerned about browser compatibility.

3 years agoRender Markdown in search results
Camelid [Mon, 5 Oct 2020 03:42:34 +0000 (20:42 -0700)]
Render Markdown in search results

Previously Markdown documentation was not rendered to HTML for search results,
which led to the output not being very readable, particularly for inline code.
This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark
(the library rustdoc uses to parse Markdown for the main text of documentation).
However, the text for the title attribute (the text shown when you hover over an
element) still uses the plain-text rendering since it is displayed in browsers
as plain-text.

Only these styles will be rendered; everything else is stripped away:

* *italics*
* **bold**
* `inline code`

3 years agoFix some clippy lints
Joshua Nelson [Thu, 3 Dec 2020 22:06:58 +0000 (17:06 -0500)]
Fix some clippy lints

3 years agoMoved map_err_ignore to restriction and updated help message
Ricky [Thu, 3 Dec 2020 21:11:52 +0000 (16:11 -0500)]
Moved map_err_ignore to restriction and updated help message

3 years agoTweak to Makefile to overcome MacOS make corruption bug
Rich Kadel [Thu, 3 Dec 2020 20:00:33 +0000 (12:00 -0800)]
Tweak to Makefile to overcome MacOS make corruption bug

3 years agoAuto merge of #79620 - JohnTitor:label-name-sugg, r=davidtwco
bors [Thu, 3 Dec 2020 18:55:01 +0000 (18:55 +0000)]
Auto merge of #79620 - JohnTitor:label-name-sugg, r=davidtwco

Tweak diagnostics on shadowing lifetimes/labels

Fixes #79610

Skip adding a new test assuming we have already sufficient tests.

3 years agoFixed cross-crate generic call test to compile lib and bin separately
Rich Kadel [Wed, 2 Dec 2020 23:39:40 +0000 (15:39 -0800)]
Fixed cross-crate generic call test to compile lib and bin separately

The original test produced a single crate with two mods, which was not
the goal of the test.

3 years agoWorkaround for inconsistent order of llvm-cov results on Windows
Rich Kadel [Wed, 2 Dec 2020 17:43:46 +0000 (09:43 -0800)]
Workaround for inconsistent order of llvm-cov results on Windows

3 years agoAddressed feedback from 2020-12-01
Rich Kadel [Wed, 2 Dec 2020 07:01:26 +0000 (23:01 -0800)]
Addressed feedback from 2020-12-01

Added one more test (two files) showing coverage of generics and unused
functions across crates.

Created and referenced new Issues, as requested.

Added comments.

Added a note about the possible effects of compiler options on LLVM
coverage maps.

3 years agoCombination of commits
Rich Kadel [Tue, 1 Dec 2020 07:58:08 +0000 (23:58 -0800)]
Combination of commits

Fixes multiple issue with counters, with simplification

  Includes a change to the implicit else span in ast_lowering, so coverage
  of the implicit else no longer spans the `then` block.

  Adds coverage for unused closures and async function bodies.

Fixes: #78542
Adding unreachable regions for known MIR missing from coverage map

Cleaned up PR commits, and removed link-dead-code requirement and tests

  Coverage no longer depends on Issue #76038 (`-C link-dead-code` is
  no longer needed or enforced, so MSVC can use the same tests as
  Linux and MacOS now)

Restrict adding unreachable regions to covered files

  Improved the code that adds coverage for uncalled functions (with MIR
  but not-codegenned) to avoid generating coverage in files not already
  included in the files with covered functions.

Resolved last known issue requiring --emit llvm-ir workaround

  Fixed bugs in how unreachable code spans were added.

3 years agoRemoved -base from run-make-fulldeps/coverage-*-base
Rich Kadel [Tue, 1 Dec 2020 07:37:49 +0000 (23:37 -0800)]
Removed -base from run-make-fulldeps/coverage-*-base

In preparation for removing the -deadcode variants

3 years agoCoverage tests for remaining TerminatorKinds and async, improve Assert
Rich Kadel [Mon, 16 Nov 2020 17:14:28 +0000 (09:14 -0800)]
Coverage tests for remaining TerminatorKinds and async, improve Assert

Tested and validate results for panic unwind, panic abort, assert!()
macro, TerminatorKind::Assert (for example, numeric overflow), and
async/await.

Implemented a previous documented idea to change Assert handling to be
the same as FalseUnwind and Goto, so it doesn't get its own
BasicCoverageBlock anymore. This changed a couple of coverage regions,
but I validated those changes are not any worse than the prior results,
and probably help assure some consistency (even if some people might
disagree with how the code region is consistently computed).

Fixed issue with async/await. AggregateKind::Generator needs to be
handled like AggregateKind::Closure; coverage span for the outer async
function should not "cover" the async body, which is actually executed
in a separate "closure" MIR.

3 years agomove interpret::MemoryKind::Heap to const eval
Vishnunarayan K I [Thu, 3 Dec 2020 15:39:39 +0000 (21:09 +0530)]
move interpret::MemoryKind::Heap to const eval

3 years agoOnly deny doc_keyword in std and set it as "allow" by default
Guillaume Gomez [Thu, 3 Dec 2020 14:32:41 +0000 (15:32 +0100)]
Only deny doc_keyword in std and set it as "allow" by default

3 years agoAuto merge of #79613 - GuillaumeGomez:doc-keyword-checks, r=oli-obk
bors [Thu, 3 Dec 2020 14:34:20 +0000 (14:34 +0000)]
Auto merge of #79613 - GuillaumeGomez:doc-keyword-checks, r=oli-obk

Add checks for #[doc(keyword = "...")] attribute

The goal here is to extend check for `#[doc(keyword = "...")]`.

cc `@jyn514`
r? `@oli-obk`

3 years agoAdd test for EXISTING_DOC_KEYWORD internal lint
Guillaume Gomez [Thu, 3 Dec 2020 13:05:58 +0000 (14:05 +0100)]
Add test for EXISTING_DOC_KEYWORD internal lint

3 years agoAuto merge of #79586 - jyn514:crate-name, r=davidtwco
bors [Thu, 3 Dec 2020 12:14:29 +0000 (12:14 +0000)]
Auto merge of #79586 - jyn514:crate-name, r=davidtwco

Fix `unknown-crate` when using -Z self-profile with rustdoc

... by removing a duplicate `crate_name` field in `interface::Config`,
making it clear that rustdoc should be passing it to `config::Options` instead.

Unblocks https://github.com/rust-lang/rustc-perf/issues/797.

3 years agoAuto merge of #79594 - vn-ki:const-eval-intrinsic, r=oli-obk
bors [Thu, 3 Dec 2020 09:44:07 +0000 (09:44 +0000)]
Auto merge of #79594 - vn-ki:const-eval-intrinsic, r=oli-obk

add const_allocate intrinsic

r? `@oli-obk`

fixes #75390

3 years agoAdd lint pass for doc keyword
Guillaume Gomez [Sun, 29 Nov 2020 21:34:41 +0000 (22:34 +0100)]
Add lint pass for doc keyword

3 years agoAuto merge of #6415 - flip1995:rollup-fz7872l, r=flip1995
bors [Thu, 3 Dec 2020 09:23:48 +0000 (09:23 +0000)]
Auto merge of #6415 - flip1995:rollup-fz7872l, r=flip1995

Rollup of 4 pull requests

Successful merges:

 - #6308 (add `internal-lints` feature to enable clippys internal lints (off by default))
 - #6395 (switch Version/VersionReq usages to RustcVersion )
 - #6402 (Add Collapsible match lint)
 - #6407 (CONTRIBUTING: update bors queue url from buildbot2.rlo to bors.rlo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

changelog: rollup

3 years agoRollup merge of #6407 - matthiaskrgr:bors_website, r=Manishearth
Philipp Krones [Thu, 3 Dec 2020 09:21:34 +0000 (10:21 +0100)]
Rollup merge of #6407 - matthiaskrgr:bors_website, r=Manishearth

CONTRIBUTING: update bors queue url from buildbot2.rlo to bors.rlo

changelog: CONTRIBUTING: update homu links to bors.rust-lang.org

3 years agoRollup merge of #6402 - camsteffen:collapsible-match, r=llogiq
Philipp Krones [Thu, 3 Dec 2020 09:21:33 +0000 (10:21 +0100)]
Rollup merge of #6402 - camsteffen:collapsible-match, r=llogiq

Add Collapsible match lint

changelog: Add collapsible_match lint

Closes #1252
Closes #2521

This lint finds nested `match` or `if let` patterns that can be squashed together. It is designed to be very conservative to only find cases where merging the patterns would most likely reduce cognitive complexity.

Example:

```rust
match result {
    Ok(opt) => match opt {
        Some(x) => x,
        _ => return,
    }
    _ => return,
}
```
to
```rust
match result {
    Ok(Some(x)) => x,
    _ => return,
}
```

These criteria must be met for the lint to fire:

* The inner match has exactly 2 branches.
* Both the outer and inner match have a "wild" branch like `_ => ..`. There is a special case for `None => ..` to also be considered "wild-like".
* The contents of the wild branches are identical.
* The binding which "links" the matches is never used elsewhere.

Thanks to the hir, `if let`'s are easily included with this lint since they are desugared into equivalent `match`'es.

I think this would fit into the style category, but I would also understand changing it to pedantic.

3 years agoRollup merge of #6395 - Suyash458:master, r=flip1995
Philipp Krones [Thu, 3 Dec 2020 09:21:32 +0000 (10:21 +0100)]
Rollup merge of #6395 - Suyash458:master, r=flip1995

switch Version/VersionReq usages to RustcVersion

add `rustc-semver` to dependencies
switch `Version/VersionReq` usages to `RustcVersion`
changelog: none