Commit graph

139228 commits

Author SHA1 Message Date
Amanieu d'Antras
2451f124c9 Address review comments 2021-02-25 00:09:33 +00:00
katelyn martin
f06896ca7a
fix typo in pre-commit.sh 2021-02-24 18:37:13 -05:00
Esteban Küber
e655941241 Account for associated consts in the "unstable assoc item name colission" lint
Fix #81663.
2021-02-24 15:35:16 -08:00
Joshua Nelson
97ab01219c Only look for tidy when running rustdoc tests
This avoids printing lots of unnecessary errors, as well as making the
test suite slightly faster.
2021-02-24 18:14:43 -05:00
Matthias Krüger
913c71018c upper_case_acronyms: add io-toml tests and bless previous tests 2021-02-24 23:50:55 +01:00
Matthias Krüger
59750dceb8 upper_case_acronyms: add optional aggressive mode and relax default
Moves the lint back from pedantic to style group.
The lint default now only warns on names that are completely capitalized, like "WORD"
and only if the name is longer than 2 chars (so that names where each of the letter represents a word are still distinguishable).
For example: FP (false positive) would still be "valid" and not warned about (but EOF would warn).

A "upper_case_acronyms_aggressive: true/false" config option was added that restores the original lint behaviour to warn
on any kind of camel case name that had more than one capital letter following another capital letter.
2021-02-24 23:50:53 +01:00
avitex
b0d18e93d6
add test coverage for all doc-valid-idents 2021-02-25 09:30:33 +11:00
avitex
72e3335684
Add OpenDNS to doc-valid-idents 2021-02-25 09:30:33 +11:00
bors
1fdadbf13a Auto merge of #82159 - BoxyUwU:uwu, r=varkor
Use correct param_env in conservative_is_privately_uninhabited

cc `@lcnr`
r? `@varkor` since this is your FIXME that was removed ^^
2021-02-24 21:54:52 +00:00
Esteban Küber
5ad6088827 Substitute erased lifetimes on bad placeholder type
Fix #82455.
2021-02-24 12:22:50 -08:00
Dan Gohman
7d5242a03a x.py fmt 2021-02-24 10:58:21 -08:00
Dan Gohman
94e75acf1f Mention "wasi" in the comment about "main modules". 2021-02-24 10:47:26 -08:00
Dan Gohman
e66e263544 Make the main wasi module cfg(not(doc)). 2021-02-24 10:43:50 -08:00
Dan Gohman
0208fca342 Use super:: to refer to WASI-specific names.
This ensures that these names resolve to the right place even when
building the WASI support on other platforms for generating the
documentation.
2021-02-24 10:37:05 -08:00
Dan Gohman
9ce567efc2 Cast libc::STDIN_FILENO to RawFd.
WASI's `RawFd` is a `u32`, while `libc` uses `c_int`.
2021-02-24 10:35:40 -08:00
Eric Huss
ce80f280ba Update cargo 2021-02-24 10:29:23 -08:00
Dániel Buga
d3f75ebf60 Add test 2021-02-24 18:14:31 +01:00
Dániel Buga
3be69b100f Remove duplicate string 2021-02-24 17:44:37 +01:00
Joshua Nelson
8fb272c8e3 Remove ENABLE_DOWNLOAD_RUSTC constant
This was introduced as part of the MVP for `download-rustc`.
Unfortunately, it doesn't work very well:

- Steps are ignored by default, which makes it easy to leave out a step
that should be built. For example, the MVP forgot to enable any tests,
so it was *only* possible to build locally.
- It didn't work correctly even when it was enabled: calling
  `builder.ensure()` would completely ignore the constant and rebuild the
  step anyway. This has no obvious fix since `ensure()` has to return a
  `Step::Output`.

Instead, this handles `download-rustc` in `impl Step for Rustc` and
`impl Step for Std`, which to my knowledge are the only build steps that
don't first go through `impl Step for Sysroot` (`Rustc` is used for
the `rustc-dev` component).

See https://github.com/rust-lang/rust/pull/79540#discussion_r563350075
and https://github.com/rust-lang/rust/issues/81930 for further context.

Here are some example runs with these changes and `download-rustc`
enabled:

```
$ x.py build src/tools/clippy
Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 1m 09s
Building stage1 tool cargo-clippy (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.11s
$ x.py test src/tools/clippy
Updating only changed submodules
Submodules updated in 0.01 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.09s
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.28s
    Finished release [optimized] target(s) in 15.26s
     Running build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/clippy_driver-8b407b140e0aa91c
test result: ok. 592 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out
$ x.py build src/tools/rustdoc
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 41.28s
Build completed successfully in 0:00:41
$ x.py test src/test/rustdoc-ui
Building stage0 tool compiletest (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.12s
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.10s
test result: ok. 105 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.15s
$ x.py build compiler/rustc
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Build completed successfully in 0:00:00
```

Note a few things:

- Clippy depends on stage1 rustc-dev artifacts, but rustc didn't have to
  be recompiled. Instead, the artifacts were copied automatically.
- All steps are always enabled. There is no danger of forgetting a step,
  since only the entrypoints have to handle `download-rustc`.
- Building the compiler (`compiler/rustc`) automatically does no work.
2021-02-24 10:14:19 -05:00
bors
454515040a Auto merge of #6786 - smoelius:move-conf-rs-back-into-clippy-lints, r=flip1995
Move conf.rs back into clippy_lints

This is an alternative solution to #6785 to fix the CI break caused by #6756.

changelog: none
2021-02-24 14:51:14 +00:00
bors
a8486b64b0 Auto merge of #80914 - GuillaumeGomez:remove-is_spotlight, r=jyn514
Remove is_spotlight field from `Trait`

Small PR, only the last commit is relevant here. The rest is coming from #80883 because I need the `TyCtxt` stored inside `Cache`.

The point is to make ItemKind looks as close as possible to the compiler type so that it makes the switch simpler (which is why I make all these "small" PRs).

r? `@jyn514`
2021-02-24 14:46:18 +00:00
Ivan Tham
e56364fa99
Use Oxform comma
Co-authored-by: Nathan Nguyen <43092380+nhwn@users.noreply.github.com>
2021-02-24 22:35:03 +08:00
Maarten de Vries
f291131f2e Bump minimum libc version to 0.2.85 for std. 2021-02-24 12:47:28 +01:00
Maarten de Vries
3ac62cafa3 Use libc::accept4 on Android instead of raw syscall. 2021-02-24 12:24:36 +01:00
Samuel E. Moelius III
8047458f40 Move conf.rs back into clippy_lints 2021-02-24 06:21:46 -05:00
bors
489c4f00f9 Auto merge of #6756 - smoelius:clippy_utils, r=flip1995,obi-obk
Factor out `clippy_utils` crate

As discussed in https://github.com/rust-lang/rust-clippy/pull/6746, this PR factors out `clippy_lints::utils` as its own crate, `clippy_utils` .

This change will allow `clippy_utils` to be used in lints outside of Clippy.

There is no plan to publish this crate on `crates.io` (see https://github.com/rust-lang/rust-clippy/pull/6746#issuecomment-780747522). Dependent crates should obtain it from GitHub.

changelog: Factor out `clippy_utils` so it can be used by external tools (not published)
2021-02-24 09:43:23 +00:00
bors
045d3f34f8 Auto merge of #6782 - ojeda:readme-as-wrapper, r=flip1995
README: Add subsection on running Clippy as a rustc wrapper

This is useful for projects that do not use cargo.

changelog: README: Add subsection on running Clippy as a rustc wrapper
2021-02-24 09:31:26 +00:00
Guillaume Gomez
cc0d531463 Make DocContext &mut for clean 2021-02-24 10:16:33 +01:00
Guillaume Gomez
f24eac5e64 Prevent to compute Item attributes twice 2021-02-24 10:05:19 +01:00
Ömer Sinan Ağacan
9c5f684e83 Turn Pick field comments into documentation 2021-02-24 10:37:53 +03:00
bors
6b56603e35 Auto merge of #80475 - simonvandel:fix-77355, r=oli-obk
New mir-opt pass to simplify gotos with const values (reopening #77486)

Reopening PR #77486

Fixes #77355

This pass optimizes the following sequence
```rust
bb2: {
    _2 = const true;
    goto -> bb3;
}

bb3: {
    switchInt(_2) -> [false: bb4, otherwise: bb5];
}
```
into
```rust
bb2: {
    _2 = const true;
    goto -> bb5;
}
```
2021-02-24 07:23:54 +00:00
Amanieu d'Antras
00eca69bff Properly reject non-const arguments 2021-02-24 06:46:30 +00:00
Ömer Sinan Ağacan
5ac6935974 Move pick_by_value_method docs above function header
- Currently style triggers #81183 so we can't add `#[instrument]` to
  this function.

- Having docs above the header is more consistent with the rest of the
  code base.
2021-02-24 09:36:10 +03:00
Miguel Ojeda
eefec8abda library: Normalize safety-for-unsafe-block comments
Almost all safety comments are of the form `// SAFETY:`,
so normalize the rest and fix a few of them that should
have been a `/// # Safety` section instead.

Furthermore, make `tidy` only allow the uppercase form. While
currently `tidy` only checks `core`, it is a good idea to prevent
`core` from drifting to non-uppercase comments, so that later
we can start checking `alloc` etc. too.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-24 06:13:42 +01:00
Camelid
a03950bc88 rustdoc: Name fields of ResolutionFailure::WrongNamespace
It makes it clearer that the `Namespace` is the one requested by the
disambiguator, rather than the actual namespace of the item. It said
that in the docs before, but now you can tell in the code so it reduces
the potential for confusion.
2021-02-23 20:58:08 -08:00
Eric Huss
476c6c27e7 Update outdated comment in unix Command. 2021-02-23 20:19:15 -08:00
Jeff Muizelaar
010a6f9556 panic_bounds_checks should be panic_bounds_check 2021-02-23 22:29:47 -05:00
bors
301ad8a4fa Auto merge of #80891 - cjgillot:noq, r=Mark-Simulacrum
Make the `Query` enum a simple struct.

A lot of code in `rustc_query_system` is generic over it, only to encode an exceptional error case: query cycles.
The delayed computations are now done at cycle detection.
2021-02-24 03:29:00 +00:00
Amanieu d'Antras
69cde44390 TODO -> FIXME 2021-02-24 02:36:45 +00:00
Miguel Ojeda
6b8b43c0d1 README: Add subsection on running Clippy as a rustc wrapper
This is useful for projects that do not use cargo.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-24 01:54:42 +01:00
Tomasz Miąsko
55626eda08 Use log level to control partitioning debug output 2021-02-24 00:00:00 +00:00
Tomasz Miąsko
ef731b31db Use small hash set in mir_inliner_callees
Use small hash set in `mir_inliner_callees` to avoid temporary
allocation when possible and quadratic behaviour for large number of
callees.
2021-02-24 00:00:00 +00:00
Tomasz Miąsko
6d5c0c1bcb Consider inexpensive inlining criteria first
Refactor inlining decisions so that inexpensive criteria are considered first:

1. Based on code generation attributes.
2. Based on MIR availability (examines call graph).
3. Based on MIR body.
2021-02-24 00:00:00 +00:00
Samuel E. Moelius III
ab7381f085 Move declare_clippy_lint back into clippy_lints 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
c7869b82a2 Update references in doc directory 2021-02-23 18:50:30 -05:00
Samuel E. Moelius
33ee598a9f Update clippy_utils/Cargo.toml
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
8500ad5d19 Typo 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
50e3ef9eb5 Remove file accidentally re-added during rebase 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
2c26c0f621 Update custom_ice_message.stderr 2021-02-23 18:50:30 -05:00
Samuel E. Moelius III
ce76fb3d09 Fix update_lints 2021-02-23 18:50:30 -05:00