Skip to content

Commit 09a5b1e

Browse files
authored
Rustup (#16939)
r? @ghost changelog: none
2 parents 6e0c7d6 + 8fe8c68 commit 09a5b1e

125 files changed

Lines changed: 633 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

clippy_dev/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ chrono = { version = "0.4.38", default-features = false, features = ["clock"] }
99
clap = { version = "4.4", features = ["derive"] }
1010
indoc = "1.0"
1111
itertools = "0.12"
12-
opener = "0.7"
12+
opener = "0.8"
1313
rustc-literal-escaper = "0.0.7"
1414
walkdir = "2.3"
1515

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,16 +306,16 @@ impl<'tcx> LateLintPass<'tcx> for ArbitrarySourceItemOrdering {
306306
cur_f = Some(field);
307307
}
308308
},
309-
ItemKind::Trait(
310-
_constness,
309+
ItemKind::Trait {
310+
impl_restriction: _,
311+
constness: _,
311312
is_auto,
312-
_safety,
313-
_impl_restriction,
314-
_ident,
315-
_generics,
316-
_generic_bounds,
317-
item_ref,
318-
) if self.enable_ordering_for_trait && *is_auto == IsAuto::No => {
313+
safety: _,
314+
ident: _,
315+
generics: _,
316+
bounds: _,
317+
items: item_ref,
318+
} if self.enable_ordering_for_trait && *is_auto == IsAuto::No => {
319319
let mut cur_t: Option<(TraitItemId, Ident)> = None;
320320

321321
for &item in *item_ref {
@@ -510,7 +510,7 @@ fn convert_module_item_kind(value: &ItemKind<'_>) -> SourceItemOrderingModuleIte
510510
ItemKind::Enum(..) => Enum,
511511
ItemKind::Struct(..) => Struct,
512512
ItemKind::Union(..) => Union,
513-
ItemKind::Trait(..) => Trait,
513+
ItemKind::Trait { .. } => Trait,
514514
ItemKind::TraitAlias(..) => TraitAlias,
515515
ItemKind::Impl(..) => Impl,
516516
}

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_ast::ast::LitKind;
88
use rustc_errors::Applicability;
99
use rustc_hir::{Expr, ExprKind, Lit};
1010
use rustc_lint::{LateContext, LateLintPass, LintContext};
11-
use rustc_middle::ty::{self, Ty};
11+
use rustc_middle::ty::{self, Ty, Unnormalized};
1212
use rustc_session::declare_lint_pass;
1313
use rustc_span::symbol::Ident;
1414

@@ -64,7 +64,9 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
6464
})
6565
.is_some_and(|assoc_item| {
6666
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
67-
let nty = cx.tcx.normalize_erasing_regions(cx.typing_env(), proj);
67+
let nty = cx
68+
.tcx
69+
.normalize_erasing_regions(cx.typing_env(), Unnormalized::new_wip(proj));
6870

6971
nty.is_bool()
7072
})

clippy_lints/src/casts/as_ptr_cast_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, cast_expr: &Expr<'_>,
1717
&& let Some(as_ptr_did) = cx
1818
.typeck_results()
1919
.type_dependent_def_id(cast_expr.peel_blocks().hir_id)
20-
&& let as_ptr_sig = cx.tcx.fn_sig(as_ptr_did).instantiate_identity()
20+
&& let as_ptr_sig = cx.tcx.fn_sig(as_ptr_did).instantiate_identity().skip_norm_wip()
2121
&& let Some(first_param_ty) = as_ptr_sig.skip_binder().inputs().iter().next()
2222
&& let ty::Ref(_, _, Mutability::Not) = first_param_ty.kind()
2323
&& let Some(recv) = receiver.span.get_source_text(cx)

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
5959
if matches!(name.ident.name, sym::read_unaligned | sym::write_unaligned)
6060
&& let Some(def_id) = cx.typeck_results().type_dependent_def_id(parent.hir_id)
6161
&& let Some(def_id) = cx.tcx.impl_of_assoc(def_id)
62-
&& cx.tcx.type_of(def_id).instantiate_identity().is_raw_ptr()
62+
&& cx
63+
.tcx
64+
.type_of(def_id)
65+
.instantiate_identity()
66+
.skip_norm_wip()
67+
.is_raw_ptr()
6368
{
6469
true
6570
} else {

clippy_lints/src/casts/confusing_method_to_numeric_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn get_const_name_and_ty_name(
3838
return None;
3939
}
4040
} else if let Some(impl_id) = cx.tcx.impl_of_assoc(method_def_id)
41-
&& let Some(ty_name) = get_primitive_ty_name(cx.tcx.type_of(impl_id).instantiate_identity())
41+
&& let Some(ty_name) = get_primitive_ty_name(cx.tcx.type_of(impl_id).instantiate_identity().skip_norm_wip())
4242
&& matches!(
4343
method_name,
4444
sym::min | sym::max | sym::minimum | sym::maximum | sym::min_value | sym::max_value

clippy_lints/src/casts/needless_type_cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn has_generic_return_type(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
158158
.is_some(),
159159
ExprKind::MethodCall(..) => {
160160
if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) {
161-
let sig = cx.tcx.fn_sig(def_id).instantiate_identity();
161+
let sig = cx.tcx.fn_sig(def_id).instantiate_identity().skip_norm_wip();
162162
let ret_ty = sig.output().skip_binder();
163163
return ret_ty.has_param();
164164
}
@@ -168,7 +168,7 @@ fn has_generic_return_type(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
168168
if let ExprKind::Path(qpath) = &callee.kind {
169169
let res = cx.qpath_res(qpath, callee.hir_id);
170170
if let Res::Def(DefKind::Fn | DefKind::AssocFn, def_id) = res {
171-
let sig = cx.tcx.fn_sig(def_id).instantiate_identity();
171+
let sig = cx.tcx.fn_sig(def_id).instantiate_identity().skip_norm_wip();
172172
let ret_ty = sig.output().skip_binder();
173173
return ret_ty.has_param();
174174
}

clippy_lints/src/copy_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<'tcx> LateLintPass<'tcx> for CopyIterator {
4040
of_trait: Some(of_trait),
4141
..
4242
}) = item.kind
43-
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
43+
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip()
4444
&& is_copy(cx, ty)
4545
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
4646
&& cx.tcx.is_diagnostic_item(sym::Iterator, trait_id)

clippy_lints/src/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
143143
.fields
144144
.iter()
145145
.all(|field| {
146-
is_copy(cx, cx.tcx.type_of(field.did).instantiate(cx.tcx, args))
146+
is_copy(cx, cx.tcx.type_of(field.did).instantiate(cx.tcx, args).skip_norm_wip())
147147
})
148148
&& (!has_drop(cx, binding_type) || all_fields_are_copy)
149149
{

clippy_lints/src/default_numeric_fallback.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ impl<'tcx> Visitor<'tcx> for NumericFallbackVisitor<'_, 'tcx> {
166166

167167
ExprKind::MethodCall(_, receiver, args, _) => {
168168
if let Some(def_id) = self.cx.typeck_results().type_dependent_def_id(expr.hir_id) {
169-
let fn_sig = self.cx.tcx.fn_sig(def_id).instantiate_identity().skip_binder();
169+
let fn_sig = self
170+
.cx
171+
.tcx
172+
.fn_sig(def_id)
173+
.instantiate_identity()
174+
.skip_norm_wip()
175+
.skip_binder();
170176
for (expr, bound) in iter::zip(iter::once(*receiver).chain(args.iter()), fn_sig.inputs()) {
171177
self.ty_bounds.push((*bound).into());
172178
self.visit_expr(expr);
@@ -188,7 +194,7 @@ impl<'tcx> Visitor<'tcx> for NumericFallbackVisitor<'_, 'tcx> {
188194
for field in *fields {
189195
let bound = fields_def.iter().find_map(|f_def| {
190196
if f_def.ident(self.cx.tcx) == field.ident {
191-
Some(self.cx.tcx.type_of(f_def.did).instantiate_identity())
197+
Some(self.cx.tcx.type_of(f_def.did).instantiate_identity().skip_norm_wip())
192198
} else {
193199
None
194200
}
@@ -251,7 +257,7 @@ fn fn_sig_opt<'tcx>(cx: &LateContext<'tcx>, hir_id: HirId) -> Option<PolyFnSig<'
251257
let node_ty = cx.typeck_results().node_type_opt(hir_id)?;
252258
// We can't use `Ty::fn_sig` because it automatically performs args, this may result in FNs.
253259
match node_ty.kind() {
254-
ty::FnDef(def_id, _) => Some(cx.tcx.fn_sig(*def_id).instantiate_identity()),
260+
ty::FnDef(def_id, _) => Some(cx.tcx.fn_sig(*def_id).instantiate_identity().skip_norm_wip()),
255261
ty::FnPtr(sig_tys, hdr) => Some(sig_tys.with(*hdr)),
256262
_ => None,
257263
}

0 commit comments

Comments
 (0)