Skip to content

Commit 2b05f79

Browse files
committed
Auto merge of rust-lang#10602 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 26e245d + fa42506 commit 2b05f79

19 files changed

+63
-36
lines changed

clippy_dev/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
#![feature(lazy_cell)]
12
#![feature(let_chains)]
2-
#![feature(once_cell)]
33
#![feature(rustc_private)]
44
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
55
// warn on lints, that are included in `rust-lang/rust`s bootstrap

clippy_lints/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![feature(let_chains)]
88
#![feature(lint_reasons)]
99
#![feature(never_type)]
10-
#![feature(once_cell)]
1110
#![feature(rustc_private)]
1211
#![feature(stmt_expr_attributes)]
1312
#![recursion_limit = "512"]

clippy_lints/src/needless_pass_by_value.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
124124

125125
let preds = traits::elaborate_predicates(cx.tcx, cx.param_env.caller_bounds().iter())
126126
.filter(|p| !p.is_global())
127-
.filter_map(|obligation| {
127+
.filter_map(|pred| {
128128
// Note that we do not want to deal with qualified predicates here.
129-
match obligation.predicate.kind().no_bound_vars() {
129+
match pred.kind().no_bound_vars() {
130130
Some(ty::PredicateKind::Clause(ty::Clause::Trait(pred))) if pred.def_id() != sized_trait => {
131131
Some(pred)
132132
},

clippy_lints/src/redundant_static_lifetimes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::msrvs::{self, Msrv};
33
use clippy_utils::source::snippet;
4-
use rustc_ast::ast::{Item, ItemKind, Ty, TyKind};
4+
use rustc_ast::ast::{ConstItem, Item, ItemKind, StaticItem, Ty, TyKind};
55
use rustc_errors::Applicability;
66
use rustc_lint::{EarlyContext, EarlyLintPass};
77
use rustc_session::{declare_tool_lint, impl_lint_pass};
@@ -100,13 +100,13 @@ impl EarlyLintPass for RedundantStaticLifetimes {
100100
}
101101

102102
if !item.span.from_expansion() {
103-
if let ItemKind::Const(_, ref var_type, _) = item.kind {
103+
if let ItemKind::Const(box ConstItem { ty: ref var_type, .. }) = item.kind {
104104
Self::visit_type(var_type, cx, "constants have by default a `'static` lifetime");
105105
// Don't check associated consts because `'static` cannot be elided on those (issue
106106
// #2438)
107107
}
108108

109-
if let ItemKind::Static(ref var_type, _, _) = item.kind {
109+
if let ItemKind::Static(box StaticItem { ty: ref var_type, .. }) = item.kind {
110110
Self::visit_type(var_type, cx, "statics have by default a `'static` lifetime");
111111
}
112112
}

clippy_lints/src/ref_option_ref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::last_path_segment;
33
use clippy_utils::source::snippet;
44
use if_chain::if_chain;
55
use rustc_errors::Applicability;
6-
use rustc_hir::{GenericArg, Mutability, Ty, TyKind};
6+
use rustc_hir::{GenericArg, GenericArgsParentheses, Mutability, Ty, TyKind};
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::symbol::sym;
@@ -47,7 +47,7 @@ impl<'tcx> LateLintPass<'tcx> for RefOptionRef {
4747

4848
if cx.tcx.is_diagnostic_item(sym::Option, def_id);
4949
if let Some(params) = last_path_segment(qpath).args ;
50-
if !params.parenthesized;
50+
if params.parenthesized == GenericArgsParentheses::No;
5151
if let Some(inner_ty) = params.args.iter().find_map(|arg| match arg {
5252
GenericArg::Type(inner_ty) => Some(inner_ty),
5353
_ => None,

clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ fn ident_difference_expr_with_base_location(
578578
| (Assign(_, _, _), Assign(_, _, _))
579579
| (TryBlock(_), TryBlock(_))
580580
| (Await(_), Await(_))
581-
| (Async(_, _, _), Async(_, _, _))
581+
| (Async(_, _), Async(_, _))
582582
| (Block(_, _), Block(_, _))
583583
| (Closure(_), Closure(_))
584584
| (Match(_, _), Match(_, _))

clippy_lints/src/types/borrowed_box.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) fn check(cx: &LateContext<'_>, hir_ty: &hir::Ty<'_>, lt: &Lifetime, m
2020
if let QPath::Resolved(None, path) = *qpath;
2121
if let [ref bx] = *path.segments;
2222
if let Some(params) = bx.args;
23-
if !params.parenthesized;
23+
if params.parenthesized == hir::GenericArgsParentheses::No;
2424
if let Some(inner) = params.args.iter().find_map(|arg| match arg {
2525
GenericArg::Type(ty) => Some(ty),
2626
_ => None,

clippy_lints/src/types/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use clippy_utils::last_path_segment;
22
use if_chain::if_chain;
3-
use rustc_hir::{GenericArg, QPath, TyKind};
3+
use rustc_hir::{GenericArg, GenericArgsParentheses, QPath, TyKind};
44
use rustc_lint::LateContext;
55
use rustc_span::source_map::Span;
66

77
pub(super) fn match_borrows_parameter(_cx: &LateContext<'_>, qpath: &QPath<'_>) -> Option<Span> {
88
let last = last_path_segment(qpath);
99
if_chain! {
1010
if let Some(params) = last.args;
11-
if !params.parenthesized;
11+
if params.parenthesized == GenericArgsParentheses::No;
1212
if let Some(ty) = params.args.iter().find_map(|arg| match arg {
1313
GenericArg::Type(ty) => Some(ty),
1414
_ => None,

clippy_lints/src/use_self.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_hir::{
1010
def::{CtorOf, DefKind, Res},
1111
def_id::LocalDefId,
1212
intravisit::{walk_inf, walk_ty, Visitor},
13-
Expr, ExprKind, FnRetTy, FnSig, GenericArg, GenericParam, GenericParamKind, HirId, Impl, ImplItemKind, Item,
14-
ItemKind, Pat, PatKind, Path, QPath, Ty, TyKind,
13+
Expr, ExprKind, FnRetTy, FnSig, GenericArg, GenericArgsParentheses, GenericParam, GenericParamKind, HirId, Impl,
14+
ImplItemKind, Item, ItemKind, Pat, PatKind, Path, QPath, Ty, TyKind,
1515
};
1616
use rustc_hir_analysis::hir_ty_to_ty;
1717
use rustc_lint::{LateContext, LateLintPass};
@@ -100,7 +100,8 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
100100
if let TyKind::Path(QPath::Resolved(_, item_path)) = self_ty.kind;
101101
let parameters = &item_path.segments.last().expect(SEGMENTS_MSG).args;
102102
if parameters.as_ref().map_or(true, |params| {
103-
!params.parenthesized && !params.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)))
103+
params.parenthesized == GenericArgsParentheses::No
104+
&& !params.args.iter().any(|arg| matches!(arg, GenericArg::Lifetime(_)))
104105
});
105106
if !item.span.from_expansion();
106107
if !is_from_proc_macro(cx, item); // expensive, should be last check

clippy_utils/src/ast_utils.rs

+37-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
209209
&& eq_fn_decl(lf, rf)
210210
&& eq_expr(le, re)
211211
},
212-
(Async(lc, _, lb), Async(rc, _, rb)) => lc == rc && eq_block(lb, rb),
212+
(Async(lc, lb), Async(rc, rb)) => lc == rc && eq_block(lb, rb),
213213
(Range(lf, lt, ll), Range(rf, rt, rl)) => ll == rl && eq_expr_opt(lf, rf) && eq_expr_opt(lt, rt),
214214
(AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
215215
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),
@@ -286,8 +286,30 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
286286
match (l, r) {
287287
(ExternCrate(l), ExternCrate(r)) => l == r,
288288
(Use(l), Use(r)) => eq_use_tree(l, r),
289-
(Static(lt, lm, le), Static(rt, rm, re)) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
290-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
289+
(
290+
Static(box ast::StaticItem {
291+
ty: lt,
292+
mutability: lm,
293+
expr: le,
294+
}),
295+
Static(box ast::StaticItem {
296+
ty: rt,
297+
mutability: rm,
298+
expr: re,
299+
}),
300+
) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le, re),
301+
(
302+
Const(box ast::ConstItem {
303+
defaultness: ld,
304+
ty: lt,
305+
expr: le,
306+
}),
307+
Const(box ast::ConstItem {
308+
defaultness: rd,
309+
ty: rt,
310+
expr: re,
311+
}),
312+
) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
291313
(
292314
Fn(box ast::Fn {
293315
defaultness: ld,
@@ -451,7 +473,18 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
451473
pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
452474
use AssocItemKind::*;
453475
match (l, r) {
454-
(Const(ld, lt, le), Const(rd, rt, re)) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
476+
(
477+
Const(box ast::ConstItem {
478+
defaultness: ld,
479+
ty: lt,
480+
expr: le,
481+
}),
482+
Const(box ast::ConstItem {
483+
defaultness: rd,
484+
ty: rt,
485+
expr: re,
486+
}),
487+
) => eq_defaultness(*ld, *rd) && eq_ty(lt, rt) && eq_expr_opt(le, re),
455488
(
456489
Fn(box ast::Fn {
457490
defaultness: ld,

clippy_utils/src/hir_utils.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,9 @@ impl HirEqInterExpr<'_, '_, '_> {
401401
}
402402

403403
fn eq_path_parameters(&mut self, left: &GenericArgs<'_>, right: &GenericArgs<'_>) -> bool {
404-
if !(left.parenthesized || right.parenthesized) {
404+
if left.parenthesized == right.parenthesized {
405405
over(left.args, right.args, |l, r| self.eq_generic_arg(l, r)) // FIXME(flip1995): may not work
406406
&& over(left.bindings, right.bindings, |l, r| self.eq_type_binding(l, r))
407-
} else if left.parenthesized && right.parenthesized {
408-
over(left.inputs(), right.inputs(), |l, r| self.eq_ty(l, r))
409-
&& both(&Some(&left.bindings[0].ty()), &Some(&right.bindings[0].ty()), |l, r| {
410-
self.eq_ty(l, r)
411-
})
412407
} else {
413408
false
414409
}

clippy_utils/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(let_chains)]
44
#![feature(lint_reasons)]
55
#![feature(never_type)]
6-
#![feature(once_cell)]
76
#![feature(rustc_private)]
87
#![recursion_limit = "512"]
98
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
@@ -2168,9 +2167,7 @@ pub fn fn_has_unsatisfiable_preds(cx: &LateContext<'_>, did: DefId) -> bool {
21682167
.filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None });
21692168
traits::impossible_predicates(
21702169
cx.tcx,
2171-
traits::elaborate_predicates(cx.tcx, predicates)
2172-
.map(|o| o.predicate)
2173-
.collect::<Vec<_>>(),
2170+
traits::elaborate_predicates(cx.tcx, predicates).collect::<Vec<_>>(),
21742171
)
21752172
}
21762173

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-03-24"
2+
channel = "nightly-2023-04-06"
33
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]

src/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![feature(rustc_private)]
22
#![feature(let_chains)]
3-
#![feature(once_cell)]
3+
#![feature(lazy_cell)]
44
#![feature(lint_reasons)]
55
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
66
// warn on lints, that are included in `rust-lang/rust`s bootstrap

tests/compile-test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![feature(test)] // compiletest_rs requires this attribute
2-
#![feature(once_cell)]
2+
#![feature(lazy_cell)]
33
#![feature(is_sorted)]
44
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
55
#![warn(rust_2018_idioms, unused_lifetimes)]

tests/dogfood.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//!
44
//! See [Eating your own dog food](https://en.wikipedia.org/wiki/Eating_your_own_dog_food) for context
55
6-
#![feature(once_cell)]
6+
#![feature(lazy_cell)]
77
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
88
#![warn(rust_2018_idioms, unused_lifetimes)]
99

tests/lint_message_convention.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(once_cell)]
1+
#![feature(lazy_cell)]
22
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
33
#![warn(rust_2018_idioms, unused_lifetimes)]
44

tests/ui/crashes/ice-6254.stderr

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ LL | FOO_REF_REF => {},
66
|
77
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
88
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
9+
= note: the traits must be derived, manual `impl`s are not sufficient
10+
= note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
911
= note: `-D indirect-structural-match` implied by `-D warnings`
1012

1113
error: aborting due to previous error

tests/workspace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(once_cell)]
1+
#![feature(lazy_cell)]
22

33
use std::path::PathBuf;
44
use std::process::Command;

0 commit comments

Comments
 (0)