Merge from rustc
This commit is contained in:
commit
fa6ecc9f67
329 changed files with 4728 additions and 3772 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 71cd3a926f0cf41eeaf9f2a7f2194b2aff85b0f6
|
||||
Subproject commit 9b13310ca596020a737aaa47daa4ed9ff8898a2f
|
||||
|
|
@ -255,7 +255,7 @@ fn check_hash_peq<'tcx>(
|
|||
"you are deriving `Hash` but have implemented `PartialEq` explicitly",
|
||||
|diag| {
|
||||
if let Some(local_def_id) = impl_id.as_local() {
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
|
||||
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialEq` implemented here");
|
||||
}
|
||||
},
|
||||
|
|
@ -299,7 +299,7 @@ fn check_ord_partial_ord<'tcx>(
|
|||
|
||||
span_lint_and_then(cx, DERIVE_ORD_XOR_PARTIAL_ORD, span, mess, |diag| {
|
||||
if let Some(local_def_id) = impl_id.as_local() {
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id);
|
||||
diag.span_note(cx.tcx.hir().span(hir_id), "`PartialOrd` implemented here");
|
||||
}
|
||||
});
|
||||
|
|
@ -381,7 +381,7 @@ fn check_unsafe_derive_deserialize<'tcx>(
|
|||
&& match_def_path(cx, trait_def_id, &paths::SERDE_DESERIALIZE)
|
||||
&& let ty::Adt(def, _) = ty.kind()
|
||||
&& let Some(local_def_id) = def.did().as_local()
|
||||
&& let adt_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_def_id)
|
||||
&& let adt_hir_id = cx.tcx.local_def_id_to_hir_id(local_def_id)
|
||||
&& !is_lint_allowed(cx, UNSAFE_DERIVE_DESERIALIZE, adt_hir_id)
|
||||
&& cx
|
||||
.tcx
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
|
|||
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
|
||||
&& error_def_id == trait_def_id
|
||||
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)
|
||||
&& let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id)
|
||||
&& let hir_id = cx.tcx.local_def_id_to_hir_id(def_id)
|
||||
&& let Some(ident) = cx.tcx.opt_item_ident(def_id.to_def_id())
|
||||
&& ident.name == sym::Error
|
||||
&& is_visible_outside_module(cx, def_id) =>
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
|
|||
let parent_id = cx
|
||||
.tcx
|
||||
.hir()
|
||||
.get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(fn_def_id))
|
||||
.get_parent_item(cx.tcx.local_def_id_to_hir_id(fn_def_id))
|
||||
.def_id;
|
||||
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ impl<'tcx> LateLintPass<'tcx> for ExcessiveBools {
|
|||
span: Span,
|
||||
def_id: LocalDefId,
|
||||
) {
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
if let Some(fn_header) = fn_kind.header()
|
||||
&& fn_header.abi == Abi::Rust
|
||||
&& get_parent_as_impl(cx.tcx, hir_id).map_or(true, |impl_item| impl_item.of_trait.is_none())
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ impl<'tcx> LateLintPass<'tcx> for Functions {
|
|||
span: Span,
|
||||
def_id: LocalDefId,
|
||||
) {
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
too_many_arguments::check_fn(cx, kind, decl, span, hir_id, self.too_many_arguments_threshold);
|
||||
too_many_lines::check_fn(cx, kind, span, body, self.too_many_lines_threshold);
|
||||
not_unsafe_ptr_arg_deref::check_fn(cx, kind, decl, body, def_id);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|
|||
if let FnKind::Closure = kind {
|
||||
return;
|
||||
}
|
||||
let ret_ty = return_ty(cx, cx.tcx.hir().local_def_id_to_hir_id(fn_def_id).expect_owner());
|
||||
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
|
||||
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
|
||||
let preds = cx.tcx.explicit_item_bounds(def_id);
|
||||
let mut is_future = false;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
|||
&& !is_lint_allowed(
|
||||
cx,
|
||||
MULTIPLE_INHERENT_IMPL,
|
||||
cx.tcx.hir().local_def_id_to_hir_id(id),
|
||||
cx.tcx.local_def_id_to_hir_id(id),
|
||||
)
|
||||
}) {
|
||||
for impl_id in impl_ids.iter().map(|id| id.expect_local()) {
|
||||
|
|
@ -117,7 +117,7 @@ impl<'tcx> LateLintPass<'tcx> for MultipleInherentImpl {
|
|||
|
||||
/// Gets the span for the given impl block unless it's not being considered by the lint.
|
||||
fn get_impl_span(cx: &LateContext<'_>, id: LocalDefId) -> Option<Span> {
|
||||
let id = cx.tcx.hir().local_def_id_to_hir_id(id);
|
||||
let id = cx.tcx.local_def_id_to_hir_id(id);
|
||||
if let Node::Item(&Item {
|
||||
kind: ItemKind::Impl(impl_item),
|
||||
span,
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
|
|||
&& let TyKind::Path(ty_path) = &imp.self_ty.kind
|
||||
&& let Some(ty_id) = cx.qpath_res(ty_path, imp.self_ty.hir_id).opt_def_id()
|
||||
&& let Some(local_id) = ty_id.as_local()
|
||||
&& let ty_hir_id = cx.tcx.hir().local_def_id_to_hir_id(local_id)
|
||||
&& let ty_hir_id = cx.tcx.local_def_id_to_hir_id(local_id)
|
||||
&& !is_lint_allowed(cx, LEN_WITHOUT_IS_EMPTY, ty_hir_id)
|
||||
&& let Some(output) =
|
||||
parse_len_output(cx, cx.tcx.fn_sig(item.owner_id).instantiate_identity().skip_binder())
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualNonExhaustiveEnum {
|
|||
.contains(&(enum_id.to_def_id(), variant_id.to_def_id()))
|
||||
})
|
||||
{
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(enum_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(enum_id);
|
||||
span_lint_hir_and_then(
|
||||
cx,
|
||||
MANUAL_NON_EXHAUSTIVE,
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ pub(super) fn check(
|
|||
// ? is a Call, makes sure not to rec *x?, but rather (*x)?
|
||||
ExprKind::Call(hir_callee, _) => matches!(
|
||||
hir_callee.kind,
|
||||
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, _, _))
|
||||
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, ..))
|
||||
),
|
||||
ExprKind::MethodCall(_, self_arg, ..) if expr.hir_id == self_arg.hir_id => true,
|
||||
ExprKind::Match(_, _, MatchSource::TryDesugar(_) | MatchSource::AwaitDesugar)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, arg: &
|
|||
closure.def_id.to_def_id(),
|
||||
Binder::bind_with_vars(
|
||||
cx.typeck_results().node_type(param_ty.hir_id),
|
||||
cx.tcx.late_bound_vars(cx.tcx.hir().local_def_id_to_hir_id(closure.def_id)),
|
||||
cx.tcx.late_bound_vars(cx.tcx.local_def_id_to_hir_id(closure.def_id)),
|
||||
),
|
||||
)
|
||||
&& is_copy(cx, param_ty)
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingConstForFn {
|
|||
FnKind::Closure => return,
|
||||
}
|
||||
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
|
||||
// Const fns are not allowed as methods in a trait.
|
||||
{
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);
|
||||
let is_async = match kind {
|
||||
FnKind::ItemFn(.., header) => {
|
||||
if header.is_unsafe() {
|
||||
|
|
@ -256,7 +256,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
|
|||
span_lint_hir_and_then(
|
||||
cx,
|
||||
NEEDLESS_PASS_BY_REF_MUT,
|
||||
cx.tcx.hir().local_def_id_to_hir_id(*fn_def_id),
|
||||
cx.tcx.local_def_id_to_hir_id(*fn_def_id),
|
||||
sp,
|
||||
"this argument is a mutable reference, but not used mutably",
|
||||
|diag| {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
|
|||
return;
|
||||
}
|
||||
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def_id);
|
||||
|
||||
match kind {
|
||||
FnKind::ItemFn(.., header) => {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
|
|||
let ty = cx.tcx.type_of(d).instantiate_identity();
|
||||
if let Some(ty_def) = ty.ty_adt_def() {
|
||||
if let Some(local_def_id) = ty_def.did().as_local() {
|
||||
impls.insert(cx.tcx.hir().local_def_id_to_hir_id(local_def_id));
|
||||
impls.insert(cx.tcx.local_def_id_to_hir_id(local_def_id));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -119,7 +119,7 @@ impl<'tcx> LateLintPass<'tcx> for NewWithoutDefault {
|
|||
&& let self_def = cx.tcx.type_of(self_def_id).instantiate_identity()
|
||||
&& let Some(self_def) = self_def.ty_adt_def()
|
||||
&& let Some(self_local_did) = self_def.did().as_local()
|
||||
&& let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_local_did)
|
||||
&& let self_id = cx.tcx.local_def_id_to_hir_id(self_local_did)
|
||||
&& impling_types.contains(&self_id)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy {
|
|||
if let Some(field_hir_id) = field
|
||||
.did
|
||||
.as_local()
|
||||
.map(|local_def_id| hir_map.local_def_id_to_hir_id(local_def_id))
|
||||
.map(|local_def_id| cx.tcx.local_def_id_to_hir_id(local_def_id))
|
||||
&& !is_lint_allowed(cx, NON_SEND_FIELDS_IN_SEND_TY, field_hir_id)
|
||||
&& let field_ty = field.ty(cx.tcx, impl_trait_args)
|
||||
&& !ty_allowed_in_send(cx, field_ty, send_trait)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ impl<'tcx> LateLintPass<'tcx> for PanicInResultFn {
|
|||
if matches!(fn_kind, FnKind::Closure) {
|
||||
return;
|
||||
}
|
||||
let owner = cx.tcx.hir().local_def_id_to_hir_id(def_id).expect_owner();
|
||||
let owner = cx.tcx.local_def_id_to_hir_id(def_id).expect_owner();
|
||||
if is_type_diagnostic_item(cx, return_ty(cx, owner), sym::Result) {
|
||||
lint_impl_body(cx, span, body);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ impl<'tcx> LateLintPass<'tcx> for PassByRefOrValue {
|
|||
return;
|
||||
}
|
||||
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
match kind {
|
||||
FnKind::ItemFn(.., header) => {
|
||||
if header.abi != Abi::Rust {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ impl<'tcx> LateLintPass<'tcx> for ReturnSelfNotMustUse {
|
|||
// `#[must_use]` should be put on the trait definition directly.
|
||||
&& cx.tcx.trait_id_of_impl(impl_def).is_none()
|
||||
{
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(fn_def);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(fn_def);
|
||||
check_method(cx, decl, fn_def, span, hir_id.expect_owner());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ fn check_final_expr<'tcx>(
|
|||
let replacement = if let Some(inner_expr) = inner {
|
||||
// if desugar of `do yeet`, don't lint
|
||||
if let ExprKind::Call(path_expr, _) = inner_expr.kind
|
||||
&& let ExprKind::Path(QPath::LangItem(LangItem::TryTraitFromYeet, _, _)) = path_expr.kind
|
||||
&& let ExprKind::Path(QPath::LangItem(LangItem::TryTraitFromYeet, ..)) = path_expr.kind
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
|
|||
|
||||
if let Some(self_def) = self_ty.ty_adt_def()
|
||||
&& let Some(self_local_did) = self_def.did().as_local()
|
||||
&& let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_local_did)
|
||||
&& let self_id = cx.tcx.local_def_id_to_hir_id(self_local_did)
|
||||
&& let Some(Node::Item(x)) = cx.tcx.hir().find(self_id)
|
||||
&& let type_name = x.ident.name.as_str().to_lowercase()
|
||||
&& (impl_item.ident.name.as_str() == type_name
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
|
|||
let is_in_trait_impl = if let Some(hir::Node::Item(item)) = cx.tcx.hir().find_by_def_id(
|
||||
cx.tcx
|
||||
.hir()
|
||||
.get_parent_item(cx.tcx.hir().local_def_id_to_hir_id(def_id))
|
||||
.get_parent_item(cx.tcx.local_def_id_to_hir_id(def_id))
|
||||
.def_id,
|
||||
) {
|
||||
matches!(item.kind, ItemKind::Impl(hir::Impl { of_trait: Some(_), .. }))
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ fn block_parents_have_safety_comment(
|
|||
span,
|
||||
owner_id,
|
||||
..
|
||||
})) => (*span, cx.tcx.hir().local_def_id_to_hir_id(owner_id.def_id)),
|
||||
})) => (*span, cx.tcx.local_def_id_to_hir_id(owner_id.def_id)),
|
||||
_ => {
|
||||
if is_branchy(expr) {
|
||||
return false;
|
||||
|
|
@ -370,7 +370,7 @@ fn block_parents_have_safety_comment(
|
|||
span,
|
||||
owner_id,
|
||||
..
|
||||
}) => (*span, cx.tcx.hir().local_def_id_to_hir_id(owner_id.def_id)),
|
||||
}) => (*span, cx.tcx.local_def_id_to_hir_id(owner_id.def_id)),
|
||||
_ => return false,
|
||||
};
|
||||
// if unsafe block is part of a let/const/static statement,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMapOnConstructor {
|
|||
}
|
||||
},
|
||||
hir::QPath::TypeRelative(_, path) => path.ident.name,
|
||||
hir::QPath::LangItem(_, _, _) => return,
|
||||
hir::QPath::LangItem(..) => return,
|
||||
};
|
||||
match constructor_symbol {
|
||||
sym::Some | sym::Ok if path.ident.name == rustc_span::sym::map => (),
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryWraps {
|
|||
}
|
||||
|
||||
// Abort if the method is implementing a trait or of it a trait method.
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
if let Some(Node::Item(item)) = cx.tcx.hir().find_parent(hir_id) {
|
||||
if matches!(
|
||||
item.kind,
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAsync {
|
|||
// statements, so don't lint at all if there are any such paths.
|
||||
if let Some(def_id) = path.res.opt_def_id()
|
||||
&& let Some(local_def_id) = def_id.as_local()
|
||||
&& let Some(DefKind::Fn) = cx.tcx.opt_def_kind(def_id)
|
||||
&& cx.tcx.def_kind(def_id) == DefKind::Fn
|
||||
&& cx.tcx.asyncness(def_id).is_async()
|
||||
&& !is_node_func_call(cx.tcx.hir().get_parent(hir_id), path.span)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ use clippy_utils::sugg::Sugg;
|
|||
use clippy_utils::ty::{is_copy, is_type_diagnostic_item, same_type_and_consts};
|
||||
use clippy_utils::{get_parent_expr, is_trait_method, is_ty_alias, path_to_local};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{BindingAnnotation, Expr, ExprKind, HirId, MatchSource, Node, PatKind};
|
||||
use rustc_infer::infer::TyCtxtInferExt;
|
||||
|
|
@ -208,7 +207,7 @@ impl<'tcx> LateLintPass<'tcx> for UselessConversion {
|
|||
&& let Some(did) = cx.qpath_res(qpath, recv.hir_id).opt_def_id()
|
||||
// make sure that the path indeed points to a fn-like item, so that
|
||||
// `fn_sig` does not ICE. (see #11065)
|
||||
&& cx.tcx.opt_def_kind(did).is_some_and(DefKind::is_fn_like) =>
|
||||
&& cx.tcx.def_kind(did).is_fn_like() =>
|
||||
{
|
||||
Some((
|
||||
did,
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ pub fn get_trait_def_id(cx: &LateContext<'_>, path: &[&str]) -> Option<DefId> {
|
|||
/// ```
|
||||
pub fn trait_ref_of_method<'tcx>(cx: &LateContext<'tcx>, def_id: LocalDefId) -> Option<&'tcx TraitRef<'tcx>> {
|
||||
// Get the implemented trait for the current function
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(def_id);
|
||||
let parent_impl = cx.tcx.hir().get_parent_item(hir_id);
|
||||
if parent_impl != hir::CRATE_OWNER_ID
|
||||
&& let hir::Node::Item(item) = cx.tcx.hir().get_by_def_id(parent_impl.def_id)
|
||||
|
|
@ -2567,7 +2567,7 @@ pub fn inherits_cfg(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
|||
|
||||
tcx.has_attr(def_id, sym::cfg)
|
||||
|| hir
|
||||
.parent_iter(hir.local_def_id_to_hir_id(def_id))
|
||||
.parent_iter(tcx.local_def_id_to_hir_id(def_id))
|
||||
.flat_map(|(parent_id, _)| hir.attrs(parent_id))
|
||||
.any(|attr| attr.has_name(sym::cfg))
|
||||
}
|
||||
|
|
@ -2687,7 +2687,7 @@ impl<'tcx> ExprUseNode<'tcx> {
|
|||
.and(Binder::dummy(cx.tcx.type_of(id).instantiate_identity())),
|
||||
)),
|
||||
Self::Return(id) => {
|
||||
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(id.def_id);
|
||||
let hir_id = cx.tcx.local_def_id_to_hir_id(id.def_id);
|
||||
if let Some(Node::Expr(Expr {
|
||||
kind: ExprKind::Closure(c),
|
||||
..
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
|
|||
ty::Closure(id, subs) => {
|
||||
let decl = id
|
||||
.as_local()
|
||||
.and_then(|id| cx.tcx.hir().fn_decl_by_hir_id(cx.tcx.hir().local_def_id_to_hir_id(id)));
|
||||
.and_then(|id| cx.tcx.hir().fn_decl_by_hir_id(cx.tcx.local_def_id_to_hir_id(id)));
|
||||
Some(ExprFnSig::Closure(decl, subs.as_closure().sig()))
|
||||
},
|
||||
ty::FnDef(id, subs) => Some(ExprFnSig::Sig(cx.tcx.fn_sig(id).instantiate(cx.tcx, subs), Some(id))),
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ fn qpath_certainty(cx: &LateContext<'_>, qpath: &QPath<'_>, resolves_to_type: bo
|
|||
path_segment_certainty(cx, type_certainty(cx, ty), path_segment, resolves_to_type)
|
||||
},
|
||||
|
||||
QPath::LangItem(lang_item, _, _) => {
|
||||
QPath::LangItem(lang_item, ..) => {
|
||||
cx.tcx
|
||||
.lang_items()
|
||||
.get(*lang_item)
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
|
|||
// Otherwise it may cause unexpected behaviours and ICEs
|
||||
// (https://github.com/rust-lang/rust/issues/86261).
|
||||
let is_reachable_non_generic = matches!(
|
||||
tcx.hir().get(tcx.hir().local_def_id_to_hir_id(local_def_id)),
|
||||
tcx.hir().get(tcx.local_def_id_to_hir_id(local_def_id)),
|
||||
Node::Item(&hir::Item {
|
||||
kind: hir::ItemKind::Static(..) | hir::ItemKind::Fn(..),
|
||||
..
|
||||
|
|
|
|||
|
|
@ -488,7 +488,6 @@ const PERMITTED_CRANELIFT_DEPENDENCIES: &[&str] = &[
|
|||
/// to the cargo executable.
|
||||
pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
||||
let mut checked_runtime_licenses = false;
|
||||
let mut rust_metadata = None;
|
||||
|
||||
for &(workspace, exceptions, permitted_deps) in WORKSPACES {
|
||||
if !root.join(workspace).join("Cargo.lock").exists() {
|
||||
|
|
@ -512,15 +511,6 @@ pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
|||
let runtime_ids = compute_runtime_crates(&metadata);
|
||||
check_runtime_license_exceptions(&metadata, runtime_ids, bad);
|
||||
checked_runtime_licenses = true;
|
||||
rust_metadata = Some(metadata);
|
||||
} else if workspace == "src/tools/cargo" {
|
||||
check_rustfix(
|
||||
rust_metadata
|
||||
.as_ref()
|
||||
.expect("The root workspace should be the first to be checked"),
|
||||
&metadata,
|
||||
bad,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -749,33 +739,3 @@ fn deps_of_filtered<'a>(
|
|||
deps_of_filtered(metadata, &dep.pkg, result, filter);
|
||||
}
|
||||
}
|
||||
|
||||
fn direct_deps_of<'a>(
|
||||
metadata: &'a Metadata,
|
||||
pkg_id: &'a PackageId,
|
||||
) -> impl Iterator<Item = &'a Package> {
|
||||
let resolve = metadata.resolve.as_ref().unwrap();
|
||||
let node = resolve.nodes.iter().find(|n| &n.id == pkg_id).unwrap();
|
||||
node.deps.iter().map(|dep| pkg_from_id(metadata, &dep.pkg))
|
||||
}
|
||||
|
||||
fn check_rustfix(rust_metadata: &Metadata, cargo_metadata: &Metadata, bad: &mut bool) {
|
||||
let cargo = pkg_from_name(cargo_metadata, "cargo");
|
||||
let cargo_rustfix =
|
||||
direct_deps_of(cargo_metadata, &cargo.id).find(|p| p.name == "rustfix").unwrap();
|
||||
|
||||
let compiletest = pkg_from_name(rust_metadata, "compiletest");
|
||||
let compiletest_rustfix =
|
||||
direct_deps_of(rust_metadata, &compiletest.id).find(|p| p.name == "rustfix").unwrap();
|
||||
|
||||
if cargo_rustfix.version != compiletest_rustfix.version {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"cargo's rustfix version {} does not match compiletest's rustfix version {}\n\
|
||||
rustfix should be kept in sync, update the cargo side first, and then update \
|
||||
compiletest along with cargo.",
|
||||
cargo_rustfix.version,
|
||||
compiletest_rustfix.version
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue