Auto merge of #138630 - matthiaskrgr:rollup-kk1gogr, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #138384 (Move `hir::Item::ident` into `hir::ItemKind`.) - #138508 (Clarify "owned data" in E0515.md) - #138531 (Store test diffs in job summaries and improve analysis formatting) - #138533 (Only use `DIST_TRY_BUILD` for try jobs that were not selected explicitly) - #138556 (Fix ICE: attempted to remap an already remapped filename) - #138608 (rustc_target: Add target feature constraints for LoongArch) - #138619 (Flatten `if`s in `rustc_codegen_ssa`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
259fdb5212
105 changed files with 1345 additions and 1150 deletions
|
@ -2026,7 +2026,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
LetVisitor { span }.visit_body(body).break_value()
|
||||
}
|
||||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(ty, _, _), .. }) => {
|
||||
hir::Node::Item(hir::Item { kind: hir::ItemKind::Const(_, ty, _, _), .. }) => {
|
||||
Some(&ty.peel_refs().kind)
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
@ -338,7 +338,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
..
|
||||
},
|
||||
hir::PathSegment {
|
||||
ident: assoc_item_name,
|
||||
ident: assoc_item_ident,
|
||||
res: Res::Def(_, item_id),
|
||||
..
|
||||
},
|
||||
|
@ -368,17 +368,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
|
||||
if let Some(local_def_id) = data.trait_ref.def_id.as_local()
|
||||
&& let hir::Node::Item(hir::Item {
|
||||
ident: trait_name,
|
||||
kind: hir::ItemKind::Trait(_, _, _, _, trait_item_refs),
|
||||
kind: hir::ItemKind::Trait(_, _, trait_ident, _, _, trait_item_refs),
|
||||
..
|
||||
}) = self.tcx.hir_node_by_def_id(local_def_id)
|
||||
&& let Some(method_ref) = trait_item_refs
|
||||
.iter()
|
||||
.find(|item_ref| item_ref.ident == *assoc_item_name)
|
||||
.find(|item_ref| item_ref.ident == *assoc_item_ident)
|
||||
{
|
||||
err.span_label(
|
||||
method_ref.span,
|
||||
format!("`{trait_name}::{assoc_item_name}` defined here"),
|
||||
format!("`{trait_ident}::{assoc_item_ident}` defined here"),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -419,7 +419,12 @@ pub fn report_dyn_incompatibility<'tcx>(
|
|||
) -> Diag<'tcx> {
|
||||
let trait_str = tcx.def_path_str(trait_def_id);
|
||||
let trait_span = tcx.hir_get_if_local(trait_def_id).and_then(|node| match node {
|
||||
hir::Node::Item(item) => Some(item.ident.span),
|
||||
hir::Node::Item(item) => match item.kind {
|
||||
hir::ItemKind::Trait(_, _, ident, ..) | hir::ItemKind::TraitAlias(ident, _, _) => {
|
||||
Some(ident.span)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
},
|
||||
_ => None,
|
||||
});
|
||||
|
||||
|
|
|
@ -267,8 +267,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
let node = self.tcx.hir_node_by_def_id(body_id);
|
||||
match node {
|
||||
hir::Node::Item(hir::Item {
|
||||
ident,
|
||||
kind: hir::ItemKind::Trait(_, _, generics, bounds, _),
|
||||
kind: hir::ItemKind::Trait(_, _, ident, generics, bounds, _),
|
||||
..
|
||||
}) if self_ty == self.tcx.types.self_param => {
|
||||
assert!(param_ty);
|
||||
|
@ -282,7 +281,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
None,
|
||||
projection,
|
||||
trait_pred,
|
||||
Some((ident, bounds)),
|
||||
Some((&ident, bounds)),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -331,7 +330,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
}
|
||||
hir::Node::Item(hir::Item {
|
||||
kind:
|
||||
hir::ItemKind::Trait(_, _, generics, ..)
|
||||
hir::ItemKind::Trait(_, _, _, generics, ..)
|
||||
| hir::ItemKind::Impl(hir::Impl { generics, .. }),
|
||||
..
|
||||
}) if projection.is_some() => {
|
||||
|
@ -352,15 +351,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
|
||||
hir::Node::Item(hir::Item {
|
||||
kind:
|
||||
hir::ItemKind::Struct(_, generics)
|
||||
| hir::ItemKind::Enum(_, generics)
|
||||
| hir::ItemKind::Union(_, generics)
|
||||
| hir::ItemKind::Trait(_, _, generics, ..)
|
||||
hir::ItemKind::Struct(_, _, generics)
|
||||
| hir::ItemKind::Enum(_, _, generics)
|
||||
| hir::ItemKind::Union(_, _, generics)
|
||||
| hir::ItemKind::Trait(_, _, _, generics, ..)
|
||||
| hir::ItemKind::Impl(hir::Impl { generics, .. })
|
||||
| hir::ItemKind::Fn { generics, .. }
|
||||
| hir::ItemKind::TyAlias(_, generics)
|
||||
| hir::ItemKind::Const(_, generics, _)
|
||||
| hir::ItemKind::TraitAlias(generics, _),
|
||||
| hir::ItemKind::TyAlias(_, _, generics)
|
||||
| hir::ItemKind::Const(_, _, generics, _)
|
||||
| hir::ItemKind::TraitAlias(_, generics, _),
|
||||
..
|
||||
})
|
||||
| hir::Node::TraitItem(hir::TraitItem { generics, .. })
|
||||
|
@ -412,15 +411,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
|
||||
hir::Node::Item(hir::Item {
|
||||
kind:
|
||||
hir::ItemKind::Struct(_, generics)
|
||||
| hir::ItemKind::Enum(_, generics)
|
||||
| hir::ItemKind::Union(_, generics)
|
||||
| hir::ItemKind::Trait(_, _, generics, ..)
|
||||
hir::ItemKind::Struct(_, _, generics)
|
||||
| hir::ItemKind::Enum(_, _, generics)
|
||||
| hir::ItemKind::Union(_, _, generics)
|
||||
| hir::ItemKind::Trait(_, _, _, generics, ..)
|
||||
| hir::ItemKind::Impl(hir::Impl { generics, .. })
|
||||
| hir::ItemKind::Fn { generics, .. }
|
||||
| hir::ItemKind::TyAlias(_, generics)
|
||||
| hir::ItemKind::Const(_, generics, _)
|
||||
| hir::ItemKind::TraitAlias(generics, _),
|
||||
| hir::ItemKind::TyAlias(_, _, generics)
|
||||
| hir::ItemKind::Const(_, _, generics, _)
|
||||
| hir::ItemKind::TraitAlias(_, generics, _),
|
||||
..
|
||||
}) if !param_ty => {
|
||||
// Missing generic type parameter bound.
|
||||
|
@ -842,7 +841,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
name.to_string()
|
||||
}
|
||||
Some(hir::Node::Item(hir::Item {
|
||||
ident, kind: hir::ItemKind::Fn { .. }, ..
|
||||
kind: hir::ItemKind::Fn { ident, .. }, ..
|
||||
})) => {
|
||||
err.span_label(ident.span, "consider calling this function");
|
||||
ident.to_string()
|
||||
|
@ -1588,20 +1587,20 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
if let Some(typeck_results) = &self.typeck_results
|
||||
&& let ty = typeck_results.expr_ty_adjusted(base)
|
||||
&& let ty::FnDef(def_id, _args) = ty.kind()
|
||||
&& let Some(hir::Node::Item(hir::Item { ident, span, vis_span, .. })) =
|
||||
self.tcx.hir_get_if_local(*def_id)
|
||||
&& let Some(hir::Node::Item(item)) = self.tcx.hir_get_if_local(*def_id)
|
||||
{
|
||||
let (ident, _, _, _) = item.expect_fn();
|
||||
let msg = format!("alternatively, consider making `fn {ident}` asynchronous");
|
||||
if vis_span.is_empty() {
|
||||
if item.vis_span.is_empty() {
|
||||
err.span_suggestion_verbose(
|
||||
span.shrink_to_lo(),
|
||||
item.span.shrink_to_lo(),
|
||||
msg,
|
||||
"async ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else {
|
||||
err.span_suggestion_verbose(
|
||||
vis_span.shrink_to_hi(),
|
||||
item.vis_span.shrink_to_hi(),
|
||||
msg,
|
||||
" async",
|
||||
Applicability::MaybeIncorrect,
|
||||
|
@ -3303,8 +3302,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
let mut is_auto_trait = false;
|
||||
match tcx.hir_get_if_local(data.impl_or_alias_def_id) {
|
||||
Some(Node::Item(hir::Item {
|
||||
kind: hir::ItemKind::Trait(is_auto, ..),
|
||||
ident,
|
||||
kind: hir::ItemKind::Trait(is_auto, _, ident, ..),
|
||||
..
|
||||
})) => {
|
||||
// FIXME: we should do something else so that it works even on crate foreign
|
||||
|
|
|
@ -516,7 +516,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
|
|||
match self.tcx.parent_hir_node(self.tcx.local_def_id_to_hir_id(anon_reg.scope))
|
||||
{
|
||||
hir::Node::Item(hir::Item {
|
||||
kind: hir::ItemKind::Trait(_, _, generics, ..),
|
||||
kind: hir::ItemKind::Trait(_, _, _, generics, ..),
|
||||
..
|
||||
})
|
||||
| hir::Node::Item(hir::Item {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue