Auto merge of #13492 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
This commit is contained in:
commit
aa0d551351
|
@ -385,8 +385,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
|
|||
&& cx
|
||||
.tcx
|
||||
.inherent_impls(def.did())
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.iter()
|
||||
.map(|imp_did| cx.tcx.hir().expect_item(imp_did.expect_local()))
|
||||
.any(|imp| has_unsafe(cx, imp))
|
||||
{
|
||||
|
|
|
@ -51,9 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
|||
// List of spans to lint. (lint_span, first_span)
|
||||
let mut lint_spans = Vec::new();
|
||||
|
||||
let Ok(impls) = cx.tcx.crate_inherent_impls(()) else {
|
||||
return;
|
||||
};
|
||||
let (impls, _) = cx.tcx.crate_inherent_impls(());
|
||||
|
||||
for (&id, impl_ids) in &impls.inherent_impls {
|
||||
if impl_ids.len() < 2
|
||||
|
|
|
@ -460,8 +460,7 @@ fn check_for_is_empty(
|
|||
let is_empty = cx
|
||||
.tcx
|
||||
.inherent_impls(impl_ty)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.iter()
|
||||
.flat_map(|&id| cx.tcx.associated_items(id).filter_by_name_unhygienic(is_empty))
|
||||
.find(|item| item.kind == AssocKind::Fn);
|
||||
|
||||
|
@ -629,7 +628,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
|
|||
/// Checks the inherent impl's items for an `is_empty(self)` method.
|
||||
fn has_is_empty_impl(cx: &LateContext<'_>, id: DefId) -> bool {
|
||||
let is_empty = sym!(is_empty);
|
||||
cx.tcx.inherent_impls(id).into_iter().flatten().any(|imp| {
|
||||
cx.tcx.inherent_impls(id).iter().any(|imp| {
|
||||
cx.tcx
|
||||
.associated_items(*imp)
|
||||
.filter_by_name_unhygienic(is_empty)
|
||||
|
|
|
@ -77,8 +77,7 @@ pub(super) fn check<'tcx>(
|
|||
let Some(suggested_method_def_id) = receiver_ty.ty_adt_def().and_then(|adt_def| {
|
||||
cx.tcx
|
||||
.inherent_impls(adt_def.did())
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.iter()
|
||||
.flat_map(|impl_id| cx.tcx.associated_items(impl_id).filter_by_name_unhygienic(sugg))
|
||||
.find_map(|assoc| {
|
||||
if assoc.fn_has_self_parameter
|
||||
|
|
|
@ -80,7 +80,7 @@ impl<'tcx> LateLintPass<'tcx> for InterningDefinedSymbol {
|
|||
&& let ty = cx.tcx.type_of(item_def_id).instantiate_identity()
|
||||
&& match_type(cx, ty, &paths::SYMBOL)
|
||||
&& let Ok(ConstValue::Scalar(value)) = cx.tcx.const_eval_poly(item_def_id)
|
||||
&& let Ok(value) = value.to_u32()
|
||||
&& let Some(value) = value.to_u32().discard_err()
|
||||
{
|
||||
self.symbol_map.insert(value, item_def_id);
|
||||
}
|
||||
|
|
|
@ -72,8 +72,7 @@ pub fn check_path(cx: &LateContext<'_>, path: &[&str]) -> bool {
|
|||
SimplifiedType::Bool,
|
||||
]
|
||||
.iter()
|
||||
.flat_map(|&ty| cx.tcx.incoherent_impls(ty).into_iter())
|
||||
.flatten()
|
||||
.flat_map(|&ty| cx.tcx.incoherent_impls(ty).iter())
|
||||
.copied();
|
||||
for item_def_id in lang_items.iter().map(|(_, def_id)| def_id).chain(incoherent_impls) {
|
||||
let lang_item_path = cx.get_def_path(item_def_id);
|
||||
|
|
|
@ -870,10 +870,10 @@ pub fn mir_to_const<'tcx>(tcx: TyCtxt<'tcx>, result: mir::Const<'tcx>) -> Option
|
|||
let range = alloc_range(offset + size * idx, size);
|
||||
let val = alloc.read_scalar(&tcx, range, /* read_provenance */ false).ok()?;
|
||||
res.push(match flt {
|
||||
FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().ok()?)),
|
||||
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().ok()?)),
|
||||
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().ok()?)),
|
||||
FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().ok()?)),
|
||||
FloatTy::F16 => Constant::F16(f16::from_bits(val.to_u16().discard_err()?)),
|
||||
FloatTy::F32 => Constant::F32(f32::from_bits(val.to_u32().discard_err()?)),
|
||||
FloatTy::F64 => Constant::F64(f64::from_bits(val.to_u64().discard_err()?)),
|
||||
FloatTy::F128 => Constant::F128(f128::from_bits(val.to_u128().discard_err()?)),
|
||||
});
|
||||
}
|
||||
Some(Constant::Vec(res))
|
||||
|
@ -903,7 +903,7 @@ fn mir_is_empty<'tcx>(tcx: TyCtxt<'tcx>, result: mir::Const<'tcx>) -> Option<boo
|
|||
.read_scalar(&tcx, alloc_range(offset + ptr_size, ptr_size), false)
|
||||
.ok()?
|
||||
.to_target_usize(&tcx)
|
||||
.ok()?;
|
||||
.discard_err()?;
|
||||
Some(len == 0)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -593,14 +593,11 @@ fn find_primitive_impls<'tcx>(tcx: TyCtxt<'tcx>, name: &str) -> impl Iterator<It
|
|||
"f32" => SimplifiedType::Float(FloatTy::F32),
|
||||
"f64" => SimplifiedType::Float(FloatTy::F64),
|
||||
_ => {
|
||||
return Result::<&[_], rustc_errors::ErrorGuaranteed>::Ok(&[])
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.copied();
|
||||
return [].iter().copied();
|
||||
},
|
||||
};
|
||||
|
||||
tcx.incoherent_impls(ty).into_iter().flatten().copied()
|
||||
tcx.incoherent_impls(ty).iter().copied()
|
||||
}
|
||||
|
||||
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: &[&
|
|||
// `impl S { ... }`
|
||||
let inherent_impl_children = tcx
|
||||
.inherent_impls(def_id)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.iter()
|
||||
.flat_map(|&impl_def_id| item_children_by_name(tcx, impl_def_id, segment));
|
||||
|
||||
let direct_children = item_children_by_name(tcx, def_id, segment);
|
||||
|
|
|
@ -123,7 +123,7 @@ fn check_rvalue<'tcx>(
|
|||
| CastKind::FloatToFloat
|
||||
| CastKind::FnPtrToPtr
|
||||
| CastKind::PtrToPtr
|
||||
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer),
|
||||
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer, _),
|
||||
operand,
|
||||
_,
|
||||
) => check_operand(tcx, operand, span, body, msrv),
|
||||
|
@ -132,11 +132,12 @@ fn check_rvalue<'tcx>(
|
|||
PointerCoercion::UnsafeFnPointer
|
||||
| PointerCoercion::ClosureFnPointer(_)
|
||||
| PointerCoercion::ReifyFnPointer,
|
||||
_,
|
||||
),
|
||||
_,
|
||||
_,
|
||||
) => Err((span, "function pointer casts are not allowed in const fn".into())),
|
||||
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), op, cast_ty) => {
|
||||
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize, _), op, cast_ty) => {
|
||||
let Some(pointee_ty) = cast_ty.builtin_deref(true) else {
|
||||
// We cannot allow this for now.
|
||||
return Err((span, "unsizing casts are only allowed for references right now".into()));
|
||||
|
@ -154,7 +155,7 @@ fn check_rvalue<'tcx>(
|
|||
Rvalue::Cast(CastKind::PointerExposeProvenance, _, _) => {
|
||||
Err((span, "casting pointers to ints is unstable in const fn".into()))
|
||||
},
|
||||
Rvalue::Cast(CastKind::DynStar, _, _) => {
|
||||
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::DynStar, _), _, _) => {
|
||||
// FIXME(dyn-star)
|
||||
unimplemented!()
|
||||
},
|
||||
|
|
|
@ -1319,7 +1319,7 @@ pub fn deref_chain<'cx, 'tcx>(cx: &'cx LateContext<'tcx>, ty: Ty<'tcx>) -> impl
|
|||
/// If you need this, you should wrap this call in `clippy_utils::ty::deref_chain().any(...)`.
|
||||
pub fn get_adt_inherent_method<'a>(cx: &'a LateContext<'_>, ty: Ty<'_>, method_name: Symbol) -> Option<&'a AssocItem> {
|
||||
if let Some(ty_did) = ty.ty_adt_def().map(AdtDef::did) {
|
||||
cx.tcx.inherent_impls(ty_did).into_iter().flatten().find_map(|&did| {
|
||||
cx.tcx.inherent_impls(ty_did).iter().find_map(|&did| {
|
||||
cx.tcx
|
||||
.associated_items(did)
|
||||
.filter_by_name_unhygienic(method_name)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-09-22"
|
||||
channel = "nightly-2024-10-03"
|
||||
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
|
||||
profile = "minimal"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
|
||||
--> tests/ui/crashes/ice-6251.rs:4:45
|
||||
--> tests/ui/crashes/ice-6251.rs:4:48
|
||||
|
|
||||
LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
|
||||
| ^ doesn't have a size known at compile-time
|
||||
| ^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
|
||||
= help: unsized fn params are gated as an unstable feature
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
from string import Template
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
Loading…
Reference in New Issue