Skip to content

Commit aa0d551

Browse files
committed
Auto merge of #13492 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 398be8c + c994a60 commit aa0d551

File tree

13 files changed

+23
-33
lines changed

13 files changed

+23
-33
lines changed

Diff for: clippy_lints/src/derive.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
385385
&& cx
386386
.tcx
387387
.inherent_impls(def.did())
388-
.into_iter()
389-
.flatten()
388+
.iter()
390389
.map(|imp_did| cx.tcx.hir().expect_item(imp_did.expect_local()))
391390
.any(|imp| has_unsafe(cx, imp))
392391
{

Diff for: clippy_lints/src/inherent_impl.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
5151
// List of spans to lint. (lint_span, first_span)
5252
let mut lint_spans = Vec::new();
5353

54-
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
55-
return;
56-
};
54+
let (impls, _) = cx.tcx.crate_inherent_impls(());
5755

5856
for (&id, impl_ids) in &impls.inherent_impls {
5957
if impl_ids.len() < 2

Diff for: clippy_lints/src/len_zero.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ fn check_for_is_empty(
460460
let is_empty = cx
461461
.tcx
462462
.inherent_impls(impl_ty)
463-
.into_iter()
464-
.flatten()
463+
.iter()
465464
.flat_map(|&id| cx.tcx.associated_items(id).filter_by_name_unhygienic(is_empty))
466465
.find(|item| item.kind == AssocKind::Fn);
467466

@@ -629,7 +628,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
629628
/// Checks the inherent impl's items for an `is_empty(self)` method.
630629
fn has_is_empty_impl(cx: &LateContext<'_>, id: DefId) -> bool {
631630
let is_empty = sym!(is_empty);
632-
cx.tcx.inherent_impls(id).into_iter().flatten().any(|imp| {
631+
cx.tcx.inherent_impls(id).iter().any(|imp| {
633632
cx.tcx
634633
.associated_items(*imp)
635634
.filter_by_name_unhygienic(is_empty)

Diff for: clippy_lints/src/methods/or_fun_call.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ pub(super) fn check<'tcx>(
7777
let Some(suggested_method_def_id) = receiver_ty.ty_adt_def().and_then(|adt_def| {
7878
cx.tcx
7979
.inherent_impls(adt_def.did())
80-
.into_iter()
81-
.flatten()
80+
.iter()
8281
.flat_map(|impl_id| cx.tcx.associated_items(impl_id).filter_by_name_unhygienic(sugg))
8382
.find_map(|assoc| {
8483
if assoc.fn_has_self_parameter

Diff for: clippy_lints/src/utils/internal_lints/interning_defined_symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for InterningDefinedSymbol {
8080
&& let ty = cx.tcx.type_of(item_def_id).instantiate_identity()
8181
&& match_type(cx, ty, &paths::SYMBOL)
8282
&& let Ok(ConstValue::Scalar(value)) = cx.tcx.const_eval_poly(item_def_id)
83-
&& let Ok(value) = value.to_u32()
83+
&& let Some(value) = value.to_u32().discard_err()
8484
{
8585
self.symbol_map.insert(value, item_def_id);
8686
}

Diff for: clippy_lints/src/utils/internal_lints/invalid_paths.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ pub fn check_path(cx: &LateContext<'_>, path: &[&str]) -> bool {
7272
SimplifiedType::Bool,
7373
]
7474
.iter()
75-
.flat_map(|&ty| cx.tcx.incoherent_impls(ty).into_iter())
76-
.flatten()
75+
.flat_map(|&ty| cx.tcx.incoherent_impls(ty).iter())
7776
.copied();
7877
for item_def_id in lang_items.iter().map(|(_, def_id)| def_id).chain(incoherent_impls) {
7978
let lang_item_path = cx.get_def_path(item_def_id);

Diff for: clippy_utils/src/consts.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,10 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::Const<'tcx>) -> Option
870870
let range = alloc_range(offset + size * idx, size);
871871
let val = alloc.read_scalar(&tcx, range, /* read_provenance */ false).ok()?;
872872
res.push(match flt {
873-
FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().ok()?)),
874-
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
875-
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
876-
FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().ok()?)),
873+
FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().discard_err()?)),
874+
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().discard_err()?)),
875+
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().discard_err()?)),
876+
FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().discard_err()?)),
877877
});
878878
}
879879
Some(Constant::Vec(res))
@@ -903,7 +903,7 @@ fn mir_is_empty<'tcx>(tcx: TyCtxt<'tcx>, result: mir::Const<'tcx>) -> Option<boo
903903
.read_scalar(&tcx, alloc_range(offset + ptr_size, ptr_size), false)
904904
.ok()?
905905
.to_target_usize(&tcx)
906-
.ok()?;
906+
.discard_err()?;
907907
Some(len == 0)
908908
} else {
909909
None

Diff for: clippy_utils/src/lib.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,11 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It
593593
"f32" => SimplifiedType::Float(FloatTy::F32),
594594
"f64" => SimplifiedType::Float(FloatTy::F64),
595595
_ => {
596-
return Result::<&[_], rustc_errors::ErrorGuaranteed>::Ok(&[])
597-
.into_iter()
598-
.flatten()
599-
.copied();
596+
return [].iter().copied();
600597
},
601598
};
602599

603-
tcx.incoherent_impls(ty).into_iter().flatten().copied()
600+
tcx.incoherent_impls(ty).iter().copied()
604601
}
605602

606603
fn non_local_item_children_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Vec<Res> {
@@ -734,8 +731,7 @@ pub fn def_path_res_with_base(tcx: TyCtxt<'_>, mut base: Vec<Res>, mut path: &[&
734731
// `impl S { ... }`
735732
let inherent_impl_children = tcx
736733
.inherent_impls(def_id)
737-
.into_iter()
738-
.flatten()
734+
.iter()
739735
.flat_map(|&impl_def_id| item_children_by_name(tcx, impl_def_id, segment));
740736

741737
let direct_children = item_children_by_name(tcx, def_id, segment);

Diff for: clippy_utils/src/qualify_min_const_fn.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ fn check_rvalue<'tcx>(
123123
| CastKind::FloatToFloat
124124
| CastKind::FnPtrToPtr
125125
| CastKind::PtrToPtr
126-
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer),
126+
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer, _),
127127
operand,
128128
_,
129129
) => check_operand(tcx, operand, span, body, msrv),
@@ -132,11 +132,12 @@ fn check_rvalue<'tcx>(
132132
PointerCoercion::UnsafeFnPointer
133133
| PointerCoercion::ClosureFnPointer(_)
134134
| PointerCoercion::ReifyFnPointer,
135+
_,
135136
),
136137
_,
137138
_,
138139
) => Err((span, "function pointer casts are not allowed in const fn".into())),
139-
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), op, cast_ty) => {
140+
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize, _), op, cast_ty) => {
140141
let Some(pointee_ty) = cast_ty.builtin_deref(true) else {
141142
// We cannot allow this for now.
142143
return Err((span, "unsizing casts are only allowed for references right now".into()));
@@ -154,7 +155,7 @@ fn check_rvalue<'tcx>(
154155
Rvalue::Cast(CastKind::PointerExposeProvenance, _, _) => {
155156
Err((span, "casting pointers to ints is unstable in const fn".into()))
156157
},
157-
Rvalue::Cast(CastKind::DynStar, _, _) => {
158+
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::DynStar, _), _, _) => {
158159
// FIXME(dyn-star)
159160
unimplemented!()
160161
},

Diff for: clippy_utils/src/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ pub fn deref_chain<'cx, 'tcx>(cx: &'cx LateContext<'tcx>, ty: Ty<'tcx>) -> impl
13191319
/// If you need this, you should wrap this call in `clippy_utils::ty::deref_chain().any(...)`.
13201320
pub fn get_adt_inherent_method<'a>(cx: &'a LateContext<'_>, ty: Ty<'_>, method_name: Symbol) -> Option<&'a AssocItem> {
13211321
if let Some(ty_did) = ty.ty_adt_def().map(AdtDef::did) {
1322-
cx.tcx.inherent_impls(ty_did).into_iter().flatten().find_map(|&did| {
1322+
cx.tcx.inherent_impls(ty_did).iter().find_map(|&did| {
13231323
cx.tcx
13241324
.associated_items(did)
13251325
.filter_by_name_unhygienic(method_name)

Diff for: rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2024-09-22"
2+
channel = "nightly-2024-10-03"
33
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
44
profile = "minimal"

Diff for: tests/ui/crashes/ice-6251.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2-
--> tests/ui/crashes/ice-6251.rs:4:45
2+
--> tests/ui/crashes/ice-6251.rs:4:48
33
|
44
LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
5-
| ^ doesn't have a size known at compile-time
5+
| ^^^^ doesn't have a size known at compile-time
66
|
77
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
88
= help: unsized fn params are gated as an unstable feature

Diff for: util/versions.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from string import Template
44
import argparse
5-
import json
65
import os
76
import sys
87

0 commit comments

Comments
 (0)