Commit Graph

141169 Commits

Author SHA1 Message Date
Yusuke Tanaka 0d7dd00860 Move useless_transmute to its own module 2021-03-02 10:37:30 +01:00
Yusuke Tanaka 4ac438bfed Add transmute/utils.rs 2021-03-02 10:37:30 +01:00
Yusuke Tanaka 306545ff96 Create transmute directory 2021-03-02 10:37:30 +01:00
Yoshitomo Nakanishi 74bd806b05 Simplify check_for_loop_arg 2021-03-02 18:14:20 +09:00
Yoshitomo Nakanishi eaf63d6df7 Unify names of lint entry functions in loops to 'check' 2021-03-02 18:14:20 +09:00
nahuakang 845a3a061c Include loops.rs changes from PR#6698 2021-03-02 18:14:20 +09:00
nahuakang 2229a0839e Clean up: Rename some files to be consistent with lint names; import lints to each file 2021-03-02 18:14:20 +09:00
nahuakang ecebfe0c9c Move check_for_loop_arg back to mod; split into 4 lint files 2021-03-02 18:14:20 +09:00
nahuakang 7cfdef6de1 Move MinifyingSugg into manual_memcpy 2021-03-02 18:14:20 +09:00
nahuakang 7158c944a4 Refactor while let loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang 287a4f8ab1 Refactor empty loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang d0b657c0b7 Refactor while let on iterator lint to its module; rename for loop explicit counter to explicit counter loop 2021-03-02 18:14:20 +09:00
nahuakang 455d0476b1 Refactor never loop to its own module 2021-03-02 18:14:20 +09:00
nahuakang 5b870e1b36 Move detect_manual_memcpy to its module; split up utils structs 2021-03-02 18:14:20 +09:00
nahuakang 2c1f676bfe Add detect_same_item_push to its own module 2021-03-02 18:14:20 +09:00
nahuakang 453e6b97ac Add check_needless_collect to its own module 2021-03-02 18:14:20 +09:00
nahuakang 9520cba554 Add check_infinite_loop to its own module 2021-03-02 18:13:32 +09:00
nahuakang 1e5e541ac5 Refactor check_for_single_element_loop to its own module 2021-03-02 18:13:32 +09:00
nahuakang 71026cad54 Refactor check_for_loop_explicit_counter to its own module 2021-03-02 18:13:32 +09:00
nahuakang 71c9fdf8b1 Refactor check_for_loop_range into its module 2021-03-02 18:13:32 +09:00
nahuakang 6e4663dedf Refactor check_for_mut_range_bound to its own module 2021-03-02 18:13:32 +09:00
nahuakang 7b0f588b77 Refactor check_for_loop_over_map_kv to its own module 2021-03-02 18:13:32 +09:00
nahuakang 408368a82c Refactor check_for_loop_arg; rename manual_flatten's lint back to check_manual_flatten 2021-03-02 18:13:32 +09:00
nahuakang 62ac4bd1b2 create loops dir; arrange manual_flatten lint and utils 2021-03-02 18:13:32 +09:00
bors e50afa43d0 Auto merge of #6822 - camsteffen:rustfmt, r=llogiq
Rustfmt version "Two"

changelog: none

This enables some ~bug fixes~ changes from rustfmt. This is more consistent with rustc's config, and should be more forward-compatible. Also, the changes look good IMO. 😃
2021-03-02 08:57:11 +00:00
Erin Power 79c5fa1f0c Revert non-power-of-two vector restriction 2021-03-02 09:41:41 +01:00
bors ef0d5924c2 Auto merge of #82688 - GuillaumeGomez:rollup-b754t11, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #80734 (check that first arg to `panic!()` in const is `&str`)
 - #81932 (Always compile rustdoc with debug logging enabled when `download-rustc` is set)
 - #82018 (Remove the dummy cache in `DocContext`; delete RenderInfo)
 - #82598 (Check stability and feature attributes in rustdoc)
 - #82655 (Highlight identifier span instead of whole pattern span in `unused` lint)
 - #82662 (Warn about unknown doc attributes)
 - #82676 (Change twice used large const table to static)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-02 05:21:25 +00:00
Jason Newcomb f21320fd74 Use diagnostic or language items instead of paths 2021-03-01 23:10:51 -05:00
Camelid 59ee872548 meta: Notify Zulip for rustdoc nominated issues
The rustdoc team does not currently use the `I-nominated` label, unlike
the libs and compiler teams (and maybe others). One reason for this is
that the other teams discuss their nominated issues in meetings, while
rustdoc is an async-only team.

However, it might be helpful to start using the `I-nominated` label for
rustdoc. The team currently uses a `cc @rust-lang/rustdoc` ping as the
equivalent, but it's easier to track issues when they use `I-nominated`.
Also we'd be more consistent with the other teams' procedures.

Since rustdoc doesn't have meetings, I propose we instead use the
triagebot notify Zulip functionality to create a topic in `#rustdoc` on
Zulip and ping the team. So it would look a bit like the procedure for
WG-prioritization when an issue acquires the `I-prioritize` label.
2021-03-01 18:10:30 -08:00
Eric Huss b840304d8b Update books 2021-03-01 18:00:56 -08:00
Joshua Nelson 75efb6efa3 Test that using the previous lint names still applies the lint 2021-03-01 20:26:15 -05:00
Joshua Nelson c7535d1361 Update comments
Note that the FIXME was removed because this can't be fixed,
`register_renamed` calls LintId::of and there's no LintId for rustdoc
lints when rustc is running.
2021-03-01 19:29:15 -05:00
Joshua Nelson 0517ea7cdc Address review comments
- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly
- Update documentation

This also takes the opportunity to make the `no-crate-level-doc-lint`
test more specific.
2021-03-01 19:29:15 -05:00
Joshua Nelson e8ddfda813 Improve error messages
- Use `register_renamed` when rustdoc is running so the lint will still
  be active and use a structured suggestion
- Test the behavior for rustc, not just for rustdoc (because it differs)
2021-03-01 19:29:15 -05:00
Joshua Nelson 7195355767 Add declare_rustdoc_lint! macro 2021-03-01 19:29:15 -05:00
Joshua Nelson 37e4cfe512 Move lint machinery into a separate file 2021-03-01 19:29:15 -05:00
Joshua Nelson cc62018e61 Rename rustdoc lints to be a tool lint instead of built-in.
- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests

  Otherwise, all `rustdoc::` lints would be ignored.

- Register all existing lints as removed

  This unfortunately doesn't work with `register_renamed` because tool
  lints have not yet been registered when rustc is running. For similar
  reasons, `check_backwards_compat` doesn't work either. Call
  `register_removed` directly instead.

- Fix fallout

  + Rustdoc lints for compiler/
  + Rustdoc lints for library/

Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.
2021-03-01 19:29:15 -05:00
Guillaume Gomez 9a0ac7cb5f Rollup merge of #82676 - dtolnay:powers, r=Mark-Simulacrum
Change twice used large const table to static

This table is used twice in core::num::dec2flt::algorithm::power_of_ten. According to the semantics of const, a separate huge definition of the table is inlined at both places.

https://github.com/rust-lang/rust/blob/5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d/library/core/src/num/dec2flt/algorithm.rs#L16-L22

Theoretically this gets cleaned up by optimization passes, but in practice I am experiencing a miscompile from LTO on this code. Making the table a static, which would only be defined a single time and not require attention from LTO, eliminates the miscompile and seems semantically more appropriate anyway. A separate bug report on the LTO bug is forthcoming.

Original addition of `const` is from #27307.
2021-03-02 00:50:11 +01:00
Guillaume Gomez 0c6b69aa70 Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514
Warn about unknown doc attributes

Fixes #82652.

For the text error, I decided to go for "invalid" instead of "unknown". What do you think?

r? `@jyn514`
2021-03-02 00:50:10 +01:00
Guillaume Gomez d259d1d98a Rollup merge of #82655 - SkiFire13:fix-issue-81314, r=estebank
Highlight identifier span instead of whole pattern span in `unused` lint

Fixes #81314

This pretty much just changes the span highlighted in the lint from `pat_sp` to `ident.span`. There's however an exception, which is in patterns with shorthands like `Point { y, ref mut x }`, where a suggestion to change just `x` would be invalid; in those cases I had to keep the pattern span. Another option would be suggesting something like `Point { y, x: ref mut _x }`.

I also added a new test since there weren't any test that checked the `unused` lint with optional patterns.
2021-03-02 00:50:09 +01:00
Guillaume Gomez 5a82251e92 Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514
Check stability and feature attributes in rustdoc

Fixes #82588.

cc `@Nemo157` `@camelid`
r? `@jyn514`
2021-03-02 00:50:08 +01:00
Guillaume Gomez b51272edfe Rollup merge of #82018 - jyn514:no-dummy-cache, r=camelid,GuillaumeGomez
Remove the dummy cache in `DocContext`; delete RenderInfo

The same information is available everywhere; the only reason the dummy
cache was needed is because it was previously stored in three different
places. This consolidates the info a bit so the cache in `DocContext` is
used throughout. As a bonus, it also completely removes `RenderInfo`.

- Return a `Cache` from `run_global_ctxt`, not `RenderInfo`
- Remove the unused `render_info` from `run_renderer`
- Remove RenderInfo altogether

Helps with https://github.com/rust-lang/rust/pull/82014. The next step is to move the `populate()` call before the `collect_intra_doc_links` pass, which currently breaks because a) lots of the cache is populated in early passes, and b) intra_doc_links itself sets some info with `register_res`. I'm working on separate PR for that to avoid making too many big changes at once.

r? `@GuillaumeGomez`
2021-03-02 00:50:07 +01:00
Guillaume Gomez 22ebb867f7 Rollup merge of #81932 - jyn514:rustdoc-logging, r=Mark-Simulacrum
Always compile rustdoc with debug logging enabled when `download-rustc` is set

Previously, logging at DEBUG or below would always be silenced, because
rustc compiles tracing with the `static_max_level_info` feature. That
makes sense for release artifacts, but not for developing rustdoc.

Instead, this compiles two different versions of tracing: one in the
release artifacts, distributed in the sysroot, and a new version
compiled by rustdoc. Since `rustc_driver` is always linked to the
version of sysroot, this copy/pastes `init_env_logging` into rustdoc.

To avoid compiling an unnecessary version of tracing when
`download-rustc` isn't set, this adds a new `using-ci-artifacts`
feature for rustdoc and passes that feature in bootstrap.

Addresses https://github.com/rust-lang/rust/issues/81930. This builds on https://github.com/rust-lang/rust/pull/79540.

r? `@Mark-Simulacrum`
2021-03-02 00:50:06 +01:00
Guillaume Gomez 865cf0c3b6 Rollup merge of #80734 - abonander:ab/issue-66693, r=oli-obk
check that first arg to `panic!()` in const is `&str`

closes #66693

~~TODO: regression test~~

cc `@RalfJung` for error message wording
2021-03-02 00:50:04 +01:00
Christiaan Dirkx 7539626c4a Move std::sys::unix::platform to std::sys::unix::ext 2021-03-02 00:00:04 +01:00
Nikita Popov ea0aa8def3 Build cmake earlier on dist-x86_64-musl
musl-toolchain.sh is called with REPLACE_CC=1, so it will replace
the host compiler and the subsequent cmake build will fail because
it cannot find the openssl headers.

Move the cmake build earlier, so it happens before the compiler
is replaced.
2021-03-01 23:35:35 +01:00
Nikita Popov 34352d441a Set CMAKE_SYSTEM_NAME for solaris/illumos
When cross-compiling to solaris/illumos targets, set
CMAKE_SYSTEM_NAME to SunOS.
2021-03-01 23:35:35 +01:00
Nikita Popov bc96516a28 Mark pure asm as willreturn 2021-03-01 23:35:35 +01:00
Nikita Popov 41b81584e2 Build newly added InstrProfilingVersionVar.c file 2021-03-01 23:35:35 +01:00
Nikita Popov 1d280b012d Don't directly expose coverage::CounterMappingRegion via FFI
The definition of this struct changes in LLVM 12 due to the addition
of branch coverage support. To avoid future mismatches, declare our
own struct and then convert between them.
2021-03-01 23:35:35 +01:00