Commit graph

135918 commits

Author SHA1 Message Date
Guillaume Gomez 539c435b50
Rollup merge of #80646 - bugadani:meta, r=petrochenkov
Clean up in `each_child_of_item`

This PR hopes to eliminate some of the surprising elements I encountered while reading the function.
- `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway
- only query `span` when relevant
- no need to allocate attribute vector
2021-01-03 17:09:13 +01:00
Guillaume Gomez ff1f21a8fd
Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor
reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
2021-01-03 17:09:11 +01:00
Guillaume Gomez fd0dbac943
Rollup merge of #80617 - GuillaumeGomez:detect-invalid-rustdoc-test-commands, r=jyn514
Detect invalid rustdoc test commands

Fixes #80570.

There are now errors displayed in case of bad command syntax:

```
---- [rustdoc] rustdoc/remove-url-from-headings.rs stdout ----

error: htmldocck failed!
status: exit code: 1
command: "/usr/bin/python" "/home/imperio/rust/rust/src/etc/htmldocck.py" "/home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc/remove-url-from-headings" "/home/imperio/rust/rust/src/test/rustdoc/remove-url-from-headings.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
3: Invalid command: `!`@has`,` (try with ``@!has`)`
	// !`@has` - '//a[`@href="http://a.a"]'`

Encountered 1 errors
```

r? `@camelid`
2021-01-03 17:09:09 +01:00
Guillaume Gomez 2072e11730
Rollup merge of #80591 - lcnr:incomplete-features, r=RalfJung
remove allow(incomplete_features) from std

cc https://github.com/rust-lang/rust/pull/80349#issuecomment-753357123

> Now I am somewhat concerned that the standard library uses some of these features...

I think it is theoretically ok to use incomplete features in the standard library or the compiler if we know that there is an already working subset and we explicitly document what we have to be careful about. Though at that point it is probably better to try and split the incomplete feature into two separate ones, similar to `min_specialization`.

Will be interesting once `feature(const_evaluatable_checked)` works well enough to imo be used in the compiler but not yet well enough to be removed from `INCOMPLETE_FEATURES`.

r? `@RalfJung`
2021-01-03 17:09:08 +01:00
Guillaume Gomez 2686daa779
Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514
Add suggestion for "ignore" doc code block

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

This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.

r? `@jyn514`
2021-01-03 17:09:01 +01:00
Guillaume Gomez 7bc1eb4506 Create a "is_ignore" variable instead of doing the comparison multiple times 2021-01-03 14:56:56 +01:00
Dániel Buga 4d3227fe1c Move variable into condition where it's used 2021-01-03 13:55:43 +01:00
Dániel Buga 250fb72d1b No need to collect result of get_item_attrs 2021-01-03 13:55:40 +01:00
Guillaume Gomez da3eef61f5 Detect invalid rustdoc test commands 2021-01-03 13:53:11 +01:00
bors bcd6975079 Auto merge of #80590 - camelid:bool-never-docs, r=nagisa
Update `bool` and `!` docs
2021-01-03 12:21:12 +00:00
Dániel Buga 675059a9eb Clean up convoluted macros_only logic 2021-01-03 12:47:38 +01:00
bors 18cb4ad3b9 Auto merge of #80247 - tmiasko:indent, r=bjorn3
Fix indentation of -Z meta-stats output
2021-01-03 09:16:24 +00:00
bors e821a6ef78 Auto merge of #80261 - GuillaumeGomez:attr-rework, r=jyn514
rustdoc DocFragment rework

Kind of a follow-up of #80119.

A few things are happening in this PR. I'm not sure about the impact on perf though so I'm very interested about that too (if the perf is worse, then we can just close this PR).

The idea here is mostly about reducing the memory usage by relying even more on `Symbol` instead of `String`. The only issue is that `DocFragment` has 3 modifications performed on it:
 1. Unindenting
 2. Collapsing similar comments into one
 3. "Beautifying" (weird JS-like comments handling).

To do so, I saved the information about unindent and the "collapse" is now on-demand (which is why I'm not sure the perf will be better, it has to be run multiple times...).

r? `@jyn514`
2021-01-03 06:29:42 +00:00
bors 05dfaba442 Auto merge of #79827 - tmiasko:size-align, r=kennytm
Describe why `size_align` have not been inlined so far

although it is used only in one place.
2021-01-03 03:43:29 +00:00
bors 18d855b8f6 Auto merge of #80623 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update.

This includes a Cargo.lock update for the recent Clippy version bump.

r? `@Manishearth`
2021-01-03 00:55:26 +00:00
bors c7d6c3dfdc Auto merge of #80592 - Skynoodle:snake-case-lint-reserved-identifier, r=davidtwco
Suggest renaming or escaping when fixing non-snake-case identifiers which would conflict with keywords

Fixes #80575
2021-01-02 22:06:17 +00:00
Matthias Krüger 8a90626a46 reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats) 2021-01-02 20:09:17 +01:00
Guillaume Gomez df2df14424 Simplify docfragment transformation in unindent tests 2021-01-02 19:16:27 +01:00
Guillaume Gomez d0e7523a32 Remove unused collapse pass 2021-01-02 19:16:27 +01:00
Guillaume Gomez 4ba1928fa2 Improve code for DocFragment rework 2021-01-02 19:16:27 +01:00
bors fde6927395 Auto merge of #80412 - GuillaumeGomez:fix-search-section-pos, r=jyn514
Fix search section position on small devices

Fixes #79526.

This is exactly the same issue fixed in 9c36491538 (in https://github.com/rust-lang/rust/pull/79936) but applied to the search section. When the width becomes too small, the search input goes on its own line to get more space, making it go "under" the section following (so either "main" or "search"). The fix is to simply make the section go more under so that it doesn't go over the search input.

r? `@jyn514`
2021-01-02 18:13:48 +00:00
flip1995 5dd64b3cd6
Use bootstrap rustc for versioncheck in Clippy 2021-01-02 18:12:28 +01:00
Guillaume Gomez 0ab6c90699 Update rustdoc-ui test output 2021-01-02 16:55:12 +01:00
Guillaume Gomez 122b141f58 End of rework of Attributes struct 2021-01-02 16:55:12 +01:00
Guillaume Gomez c4739bc920 Rework DocFragment 2021-01-02 16:55:12 +01:00
flip1995 d35d827bc8
Update Cargo.lock 2021-01-02 16:47:58 +01:00
Skynoodle 750c52af73 Add snake case lint note about keyword identifiers which cannot be raw 2021-01-02 15:46:41 +00:00
bors fd85ca02f6 Auto merge of #80550 - bugadani:markdown-refactor, r=jyn514
Cleanup markdown span handling, take 2

This PR includes the cleanups made in #80244 except for the removal of `locate()`.

While the biggest conceptual part in #80244 was the removal of `locate()`, it introduced a diagnostic regression.

Additional cleanup:
 - Use `RefCell` to avoid building two separate vectors for the links

Work to do:
- [ ] Decide if `locate()` can be simplified by assuming `s` is always in `md`
- [ ] Should probably add some tests that still provide the undesired diagnostics causing #80381

cc `@jyn514` This is the best I can do without patching Pulldown to provide multiple ranges for reference-style links. Also, since `locate` is probably more efficient than `rfind` (at least it's constant time), I decided to not check the link type and just cover every &str as it was before.
2021-01-02 15:31:53 +00:00
flip1995 100c7935bd
Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup 2021-01-02 16:29:43 +01:00
bors 1fcc74cc9e Auto merge of #6536 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2021-01-02 15:28:08 +00:00
flip1995 e4fbc5f423
Bump Clippy version to 0.1.51 2021-01-02 16:26:10 +01:00
flip1995 106ca96653
Use rustc --version in versioncheck 2021-01-02 16:20:43 +01:00
flip1995 db268f8ef8
Bump nightly version to 2021-01-02 2021-01-02 16:05:54 +01:00
flip1995 d93692efa2
Merge remote-tracking branch 'upstream/master' into rustup 2021-01-02 16:03:26 +01:00
bors b1965283fd Auto merge of #6530 - m-ou-se:2021, r=phansch
Initial support for Rust 2021.

Clippy treated Rust 2021 as Rust 2015, because 2018 was checked with `==` instead of `>=`. This fixes that, such that 2018-specific things are also enabled for 2021.

changelog: Added support for Rust 2021.
2021-01-02 13:12:15 +00:00
bors 90ccf4f5ad Auto merge of #80615 - m-ou-se:rollup-xz67at2, r=m-ou-se
Rollup of 6 pull requests

Successful merges:

 - #80546 (clippy fixes for librustdoc)
 - #80555 (Improve library tracking issue template)
 - #80574 (Clean bootstrap artifacts on `x.py clean`)
 - #80578 (improve unconditional_panic description)
 - #80599 (`const_generics_defaults`: don't ICE in the unimplemented parts)
 - #80613 (Diag: print enum variant instead of enum type)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-02 12:40:32 +00:00
Mara Bos 4172756c80
Rollup merge of #80613 - bugadani:issue-80607, r=matthewjasper
Diag: print enum variant instead of enum type

Closes #80607
2021-01-02 11:29:15 +00:00
Mara Bos 7a1b01ec02
Rollup merge of #80599 - lqd:issue_805889, r=varkor
`const_generics_defaults`: don't ICE in the unimplemented parts

The thought was that we could use `todo!`s to ensure we wouldn't forget to implement parts of the experimental gate.

However, that can also lead to a suboptimal experience for users as shown in #80589 having both the error/warning about the experimental feature, and the ICE.

Fixes #80589

r? `@varkor`
2021-01-02 11:29:14 +00:00
Mara Bos bb703058b7
Rollup merge of #80578 - RalfJung:panic-lint-description, r=lcnr
improve unconditional_panic description

The fact that the lint is triggered by the ConstProp pass is an implementation detail, I do not think that this should be mentioned in the description.

Cc `@oli-obk` `@ehuss`
2021-01-02 11:29:12 +00:00
Mara Bos 4890c06fc4
Rollup merge of #80574 - jyn514:clean-bootstrap, r=Mark-Simulacrum
Clean bootstrap artifacts on `x.py clean`

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

r? `@Mark-Simulacrum`
2021-01-02 11:29:10 +00:00
Mara Bos 1ab3466fe9
Rollup merge of #80555 - rust-lang:libs-tracking-issue, r=KodrAus
Improve library tracking issue template

r? `@KodrAus`
2021-01-02 11:29:09 +00:00
Mara Bos 29c1bc9723
Rollup merge of #80546 - matthiaskrgr:rustdoclippy, r=LingMan
clippy fixes for librustdoc

fixes clippy warnings of type:
match_like_matches_macro
or_fun_call
op_ref
needless_return
let_and_return
single_char_add_str
useless_format
unnecessary_sort_by
match_ref_pats
redundant_field_names
2021-01-02 11:29:07 +00:00
Dániel Buga e0300716ef Print actual enum variant 2021-01-02 11:06:30 +01:00
Dániel Buga eb0d5be441 Add test for #80607 with undesired output 2021-01-02 10:59:21 +01:00
bors 929f66af9b Auto merge of #80115 - tgnottingham:specialize_opaque_u8_sequences, r=oli-obk
rustc_serialize: specialize opaque encoding and decoding of some u8 sequences

This specializes encoding and decoding of some contiguous u8 sequences to use a more efficient implementation. The default implementations process each u8 individually, but that isn't necessary for the opaque encoder and decoder. The opaque encoding for u8s is a no-op, so we can just copy entire sequences as-is, rather than process them byte by byte.

This also changes some encode and decode implementations for contiguous sequences to forward to the slice and vector implementations, so that they can take advantage of the new specialization when applicable.
2021-01-02 09:52:26 +00:00
Dániel Buga f07354333f Only use locate for borrowed strings 2021-01-02 10:39:16 +01:00
bors 5986dd878f Auto merge of #79883 - frewsxcv:frewsxcv-san, r=shepmaster
Enable ASan, TSan, UBSan for aarch64-apple-darwin.

I confirmed ASan, TSan, UBSan all work for me locally with `clang` on my new Macbook Air.

~This requires https://github.com/rust-lang/llvm-project/pull/86~
2021-01-02 06:58:59 +00:00
Tyson Nottingham be79f493fb rustc_serialize: specialize opaque decoding of some u8 sequences 2021-01-01 22:49:16 -08:00
Tyson Nottingham 7c6274d464 rustc_serialize: have read_raw_bytes take MaybeUninit<u8> slice 2021-01-01 22:49:16 -08:00
Tyson Nottingham a4daa63a90 rustc_serialize: specialize opaque encoding of some u8 sequences 2021-01-01 22:49:14 -08:00