Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup #13639

Merged
merged 53 commits into from
Nov 7, 2024
Merged

Rustup #13639

Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
b95aa31
Stabilize `isqrt` feature
ChaiTRex Oct 8, 2024
fea5e77
Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into clippy-s…
flip1995 Oct 18, 2024
91a458f
Hotfix TRAIT_METHODS static->const
flip1995 Oct 18, 2024
6983631
Do not run lints that cannot emit
blyxyas Nov 13, 2023
8f8aa46
Follow review comments (optimize the filtering)
blyxyas Jun 18, 2024
e427a4e
Remove module passes filtering
blyxyas Sep 7, 2024
e518d66
Apply review comments + use `shallow_lint_levels_on`
blyxyas Oct 15, 2024
69b0886
Fix tests
compiler-errors Sep 27, 2024
aab0eee
make unsupported_calling_conventions a hard error
RalfJung Sep 3, 2024
d8b2f93
Rip out old effects var handling code from traits
compiler-errors Oct 20, 2024
1d0dad5
Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgr
bors Oct 21, 2024
3773534
Move COGNITIVE_COMPLEXITY to use macro again
blyxyas Oct 19, 2024
f03f7c6
Auto merge of #129935 - RalfJung:unsupported_calling_conventions, r=c…
bors Oct 22, 2024
2fd8222
terminology: #[feature] *enables* a feature (instead of "declaring" o…
RalfJung Oct 8, 2024
78fc7bb
Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
bors Oct 22, 2024
088f07a
Represent TraitBoundModifiers as distinct parts in HIR
compiler-errors Oct 20, 2024
54f9bc4
nightly feature tracking: get rid of the per-feature bool fields
RalfJung Oct 9, 2024
eb6026a
Remove associated type based effects logic
compiler-errors Oct 20, 2024
5d681cf
Pass Ident by reference in ast Visitor
maxcabrajac Oct 24, 2024
a1ff955
Rollup merge of #132106 - maxcabrajac:ident_ref, r=petrochenkov
matthiaskrgr Oct 25, 2024
cd21594
tcx.is_const_fn doesn't work the way it is described, remove it
RalfJung Oct 12, 2024
8b9376a
Auto merge of #131349 - RalfJung:const-stability-checks, r=compiler-e…
bors Oct 25, 2024
350d1c4
Effects cleanup
fee1-dead Oct 26, 2024
b75d511
Rollup merge of #132168 - fee1-dead-contrib:fxclean, r=compiler-errors
matthiaskrgr Oct 26, 2024
9e36f89
Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillot
bors Oct 26, 2024
303ab51
Rollup merge of #131391 - ChaiTRex:isqrt, r=scottmcm,tgross35
matthiaskrgr Oct 28, 2024
f286174
New lint: `dangling_pointers_from_temporaries`
GrigorenkoPV Oct 16, 2024
149665a
Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgau
bors Oct 29, 2024
353868a
Remove region from adjustments
compiler-errors Oct 29, 2024
8d190cc
update tools
lcnr Oct 24, 2024
ae82c75
Remove `Analysis::into_engine`.
nnethercote Oct 29, 2024
297f28c
Rollup merge of #132338 - nnethercote:rm-Engine, r=nnethercote
matthiaskrgr Oct 30, 2024
d9a0fec
Remap impl-trait lifetimes on HIR instead of AST lowering.
cjgillot Aug 20, 2024
9f89421
Auto merge of #132301 - compiler-errors:adjust, r=lcnr
bors Oct 31, 2024
d30a0b2
`ConstCx` stop using `ParamEnv::reveal`
lcnr Oct 31, 2024
bad3edd
clippy: we've got a `LateContext` use it for `TypingMode`
lcnr Oct 31, 2024
d7850ec
stop using `ParamEnv::reveal` while handling MIR
lcnr Oct 31, 2024
c2db7fa
Rollup merge of #132403 - lcnr:typing-mode, r=compiler-errors
workingjubilee Nov 1, 2024
f0cf996
Rename the FIXMEs, remove a few that dont matter anymore
compiler-errors Nov 1, 2024
b14362f
ty::KContainer -> ty::AssocItemContainer::K
compiler-errors Nov 3, 2024
efeed55
Remove BorrowKind glob, make names longer
compiler-errors Nov 3, 2024
63d0ba9
Move two attribute lints to be early pass (post expansion)
jdonszelmann Nov 4, 2024
d8a3fcc
Auto merge of #132580 - compiler-errors:globs, r=Noratrieb
bors Nov 5, 2024
626406f
Do not filter empty passes & Make CTFE Clippy into lintless pass
blyxyas Nov 5, 2024
4847c40
Rollup merge of #132637 - blyxyas:lint-less-passes, r=flip1995
matthiaskrgr Nov 5, 2024
b816d4e
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 7, 2024
03daf7c
Fix author lint and move it back to tests/ui
flip1995 Nov 7, 2024
4f12b98
Clean up declare_clippy_lint
flip1995 Nov 3, 2024
c64f1e3
Fix lint_without_lint_pass internal lint
flip1995 Nov 3, 2024
b27570b
Fix cargo dev update_lints
flip1995 Nov 3, 2024
a5d6100
Bump nightly version -> 2024-11-07
flip1995 Nov 7, 2024
d583df0
Remove ui/no_lints.rs test
flip1995 Nov 7, 2024
b116696
Remove CI badge from README and book
flip1995 Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ rm -rf out/master/ || exit 0
echo "Making the docs for master"
mkdir out/master/
cp util/gh-pages/index.html out/master
cp util/gh-pages/theme.js out/master
cp util/gh-pages/script.js out/master
cp util/gh-pages/lints.json out/master
cp util/gh-pages/style.css out/master

if [[ -n $TAG_NAME ]]; then
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ out

# gh pages docs
util/gh-pages/lints.json
util/gh-pages/index.html

# rustfmt backups
*.rs.bk
Expand Down
42 changes: 40 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,46 @@ document.

## Unreleased / Beta / In Rust Nightly

[b794b8e0...master](https://github.com/rust-lang/rust-clippy/compare/b794b8e0...master)
[0f8eabd6...master](https://github.com/rust-lang/rust-clippy/compare/0f8eabd6...master)

## Rust 1.82

Current stable, released 2024-10-17

[View all 108 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2024-07-11T20%3A12%3A07Z..2024-08-24T20%3A55%3A35Z+base%3Amaster)

### New Lints

* Added [`too_long_first_doc_paragraph`] to `nursery`
[#12993](https://github.com/rust-lang/rust-clippy/pull/12993)
* Added [`unused_result_ok`] to `restriction`
[#12150](https://github.com/rust-lang/rust-clippy/pull/12150)
* Added [`pathbuf_init_then_push`] to `restriction`
[#11700](https://github.com/rust-lang/rust-clippy/pull/11700)

### Enhancements

* [`explicit_iter_loop`]: Now respects the `msrv` configuration
[#13288](https://github.com/rust-lang/rust-clippy/pull/13288)
* [`assigning_clones`]: No longer lints in test code
[#13273](https://github.com/rust-lang/rust-clippy/pull/13273)
* [`inconsistent_struct_constructor`]: Lint attributes now work on the struct definition
[#13211](https://github.com/rust-lang/rust-clippy/pull/13211)
* [`set_contains_or_insert`]: Now also checks for `BTreeSet`
[#13053](https://github.com/rust-lang/rust-clippy/pull/13053)
* [`doc_markdown`]: Added the following identifiers to [`doc-valid-idents`]: AccessKit,
CoreFoundation, CoreGraphics, CoreText, Direct2D, Direct3D, DirectWrite, PostScript,
OpenAL, OpenType, WebRTC, WebSocket, WebTransport, NetBSD, and OpenBSD
[#13093](https://github.com/rust-lang/rust-clippy/pull/13093)

### ICE Fixes

* [`uninit_vec`]
[rust#128720](https://github.com/rust-lang/rust/pull/128720)

## Rust 1.81

Current stable, released 2024-09-05
Released 2024-09-05

### New Lints

Expand Down Expand Up @@ -5621,6 +5656,7 @@ Released 2018-09-13
[`manual_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find_map
[`manual_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
[`manual_hash_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one
[`manual_ignore_case_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ignore_case_cmp
[`manual_inspect`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
[`manual_instant_elapsed`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_instant_elapsed
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
Expand Down Expand Up @@ -5874,6 +5910,7 @@ Released 2018-09-13
[`ref_option`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
[`ref_option_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_option_ref
[`ref_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ref_patterns
[`regex_creation_in_loops`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_creation_in_loops
[`regex_macro`]: https://rust-lang.github.io/rust-clippy/master/index.html#regex_macro
[`renamed_function_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#renamed_function_params
[`repeat_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#repeat_once
Expand Down Expand Up @@ -6027,6 +6064,7 @@ Released 2018-09-13
[`unnecessary_get_then_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
[`unnecessary_join`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_join
[`unnecessary_lazy_evaluations`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
[`unnecessary_literal_bound`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_bound
[`unnecessary_literal_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
[`unnecessary_map_on_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_on_constructor
[`unnecessary_min_or_max`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_min_or_max
Expand Down
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.83"
version = "0.1.84"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -23,7 +23,7 @@ path = "src/driver.rs"
[dependencies]
clippy_config = { path = "clippy_config" }
clippy_lints = { path = "clippy_lints" }
rustc_tools_util = "0.3.0"
rustc_tools_util = "0.4.0"
tempfile = { version = "3.3", optional = true }
termize = "0.1"
color-print = "0.3.4"
Expand All @@ -39,6 +39,8 @@ toml = "0.7.3"
walkdir = "2.3"
filetime = "0.2.9"
itertools = "0.12"
pulldown-cmark = "0.11"
rinja = { version = "0.3", default-features = false, features = ["config"] }

# UI test dependencies
clippy_utils = { path = "clippy_utils" }
Expand All @@ -50,7 +52,7 @@ parking_lot = "0.12"
tokio = { version = "1", features = ["io-util"] }

[build-dependencies]
rustc_tools_util = "0.3.0"
rustc_tools_util = "0.4.0"

[features]
integration = ["tempfile"]
Expand Down
2 changes: 1 addition & 1 deletion book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ arithmetic-side-effects-allowed-unary = ["SomeType", "AnotherType"]
## `array-size-threshold`
The maximum allowed size for arrays on the stack

**Default Value:** `512000`
**Default Value:** `16384`

---
**Affected lints:**
Expand Down
2 changes: 1 addition & 1 deletion clippy_config/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_config"
version = "0.1.83"
version = "0.1.84"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
26 changes: 25 additions & 1 deletion clippy_config/src/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ impl ConfError {
}
}

// Remove code tags and code behind '# 's, as they are not needed for the lint docs and --explain
pub fn sanitize_explanation(raw_docs: &str) -> String {
// Remove tags and hidden code:
let mut explanation = String::with_capacity(128);
let mut in_code = false;
for line in raw_docs.lines().map(str::trim) {
if let Some(lang) = line.strip_prefix("```") {
let tag = lang.split_once(',').map_or(lang, |(left, _)| left);
if !in_code && matches!(tag, "" | "rust" | "ignore" | "should_panic" | "no_run" | "compile_fail") {
explanation += "```rust\n";
} else {
explanation += line;
explanation.push('\n');
}
in_code = !in_code;
} else if !(in_code && line.starts_with("# ")) {
explanation += line;
explanation.push('\n');
}
}

explanation
}

macro_rules! wrap_option {
() => {
None
Expand Down Expand Up @@ -366,7 +390,7 @@ define_Conf! {
arithmetic_side_effects_allowed_unary: Vec<String> = <_>::default(),
/// The maximum allowed size for arrays on the stack
#[lints(large_const_arrays, large_stack_arrays)]
array_size_threshold: u64 = 512_000,
array_size_threshold: u64 = 16 * 1024,
/// Suppress lints whenever the suggested change would cause breakage for other crates.
#[lints(
box_collection,
Expand Down
2 changes: 1 addition & 1 deletion clippy_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ mod metadata;
pub mod msrvs;
pub mod types;

pub use conf::{Conf, get_configuration_metadata, lookup_conf_file};
pub use conf::{Conf, get_configuration_metadata, lookup_conf_file, sanitize_explanation};
pub use metadata::ClippyConfiguration;
3 changes: 1 addition & 2 deletions clippy_config/src/msrvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ macro_rules! msrv_aliases {

// names may refer to stabilized feature flags or library items
msrv_aliases! {
1,83,0 { CONST_EXTERN_FN }
1,83,0 { CONST_FLOAT_BITS_CONV }
1,83,0 { CONST_EXTERN_FN, CONST_FLOAT_BITS_CONV, CONST_FLOAT_CLASSIFY }
1,82,0 { IS_NONE_OR }
1,81,0 { LINT_REASONS_STABILIZATION }
1,80,0 { BOX_INTO_ITER}
Expand Down
2 changes: 1 addition & 1 deletion clippy_dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ aho-corasick = "1.0"
clap = { version = "4.4", features = ["derive"] }
indoc = "1.0"
itertools = "0.12"
opener = "0.6"
opener = "0.7"
shell-escape = "0.1"
walkdir = "2.3"

Expand Down
24 changes: 12 additions & 12 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ pub(crate) fn get_stabilization_version() -> String {

fn get_test_file_contents(lint_name: &str, msrv: bool) -> String {
let mut test = formatdoc!(
r#"
r"
#![warn(clippy::{lint_name})]

fn main() {{
// test code goes here
}}
"#
"
);

if msrv {
Expand Down Expand Up @@ -272,31 +272,31 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {

result.push_str(&if enable_msrv {
formatdoc!(
r#"
r"
use clippy_config::msrvs::{{self, Msrv}};
use clippy_config::Conf;
{pass_import}
use rustc_lint::{{{context_import}, {pass_type}, LintContext}};
use rustc_session::impl_lint_pass;

"#
"
)
} else {
formatdoc!(
r#"
r"
{pass_import}
use rustc_lint::{{{context_import}, {pass_type}}};
use rustc_session::declare_lint_pass;

"#
"
)
});

let _: fmt::Result = writeln!(result, "{}", get_lint_declaration(&name_upper, category));

result.push_str(&if enable_msrv {
formatdoc!(
r#"
r"
pub struct {name_camel} {{
msrv: Msrv,
}}
Expand All @@ -315,15 +315,15 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {

// TODO: Add MSRV level to `clippy_config/src/msrvs.rs` if needed.
// TODO: Update msrv config comment in `clippy_config/src/conf.rs`
"#
"
)
} else {
formatdoc!(
r#"
r"
declare_lint_pass!({name_camel} => [{name_upper}]);

impl {pass_type}{pass_lifetimes} for {name_camel} {{}}
"#
"
)
});

Expand Down Expand Up @@ -416,7 +416,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
} else {
let _: fmt::Result = writedoc!(
lint_file_contents,
r#"
r"
use rustc_lint::{{{context_import}, LintContext}};

use super::{name_upper};
Expand All @@ -425,7 +425,7 @@ fn create_lint_for_ty(lint: &LintData<'_>, enable_msrv: bool, ty: &str) -> io::R
pub(super) fn check(cx: &{context_import}{pass_lifetimes}) {{
todo!();
}}
"#
"
);
}

Expand Down
4 changes: 3 additions & 1 deletion clippy_dev/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ pub fn run(port: u16, lint: Option<String>) -> ! {
});

loop {
if mtime("util/gh-pages/lints.json") < mtime("clippy_lints/src") {
let index_time = mtime("util/gh-pages/index.html");

if index_time < mtime("clippy_lints/src") || index_time < mtime("util/gh-pages/index_template.html") {
Command::new(env::var("CARGO").unwrap_or("cargo".into()))
.arg("collect-metadata")
.spawn()
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.83"
version = "0.1.84"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -13,7 +13,6 @@ arrayvec = { version = "0.7", default-features = false }
cargo_metadata = "0.18"
clippy_config = { path = "../clippy_config" }
clippy_utils = { path = "../clippy_utils" }
declare_clippy_lint = { path = "../declare_clippy_lint" }
itertools = "0.12"
quine-mc_cluskey = "0.2"
regex-syntax = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/box_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl LateLintPass<'_> for BoxDefault {
// And the call is that of a `Box` method
&& path_def_id(cx, ty).map_or(false, |id| Some(id) == cx.tcx.lang_items().owned_box())
// And the single argument to the call is another function call
// This is the `T::default()` of `Box::new(T::default())`
// This is the `T::default()` (or default equivalent) of `Box::new(T::default())`
&& let ExprKind::Call(arg_path, _) = arg.kind
// And we are not in a foreign crate's macro
&& !in_external_macro(cx.sess(), expr.span)
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/byte_char_slices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl EarlyLintPass for ByteCharSlice {
"can be more succinctly written as a byte str",
"try",
format!("b\"{slice}\""),
Applicability::MaybeIncorrect,
Applicability::MachineApplicable,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/cast_abs_to_unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) fn check(
if msrv.meets(msrvs::UNSIGNED_ABS)
&& let ty::Int(from) = cast_from.kind()
&& let ty::Uint(to) = cast_to.kind()
&& let ExprKind::MethodCall(method_path, receiver, ..) = cast_expr.kind
&& let ExprKind::MethodCall(method_path, receiver, [], _) = cast_expr.kind
&& method_path.ident.name.as_str() == "abs"
{
let span = if from.bit_width() == to.bit_width() {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/cast_ptr_alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
cx.typeck_results().expr_ty(expr),
);
lint_cast_ptr_alignment(cx, expr, cast_from, cast_to);
} else if let ExprKind::MethodCall(method_path, self_arg, ..) = &expr.kind {
} else if let ExprKind::MethodCall(method_path, self_arg, [], _) = &expr.kind {
if method_path.ident.name == sym!(cast)
&& let Some(generic_args) = method_path.args
&& let [GenericArg::Type(cast_to)] = generic_args.args
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/create_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare_lint_pass!(CreateDir => [CREATE_DIR]);

impl LateLintPass<'_> for CreateDir {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
if let ExprKind::Call(func, [arg, ..]) = expr.kind
if let ExprKind::Call(func, [arg]) = expr.kind
&& let ExprKind::Path(ref path) = func.kind
&& let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id()
&& cx.tcx.is_diagnostic_item(sym::fs_create_dir, def_id)
Expand Down
Loading