1
Fork 0

Auto merge of #120767 - matthiaskrgr:rollup-0k8ib1c, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - #120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - #120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - #120214 (match lowering: consistently lower bindings deepest-first)
 - #120688 (GVN: also turn moves into copies with projections)
 - #120702 (docs: also check the inline stmt during redundant link check)
 - #120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered")
 - #120734 (Add `SubdiagnosticMessageOp` as a trait alias.)
 - #120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-02-08 12:14:19 +00:00
commit 1280928a99
125 changed files with 1562 additions and 999 deletions

View file

@ -827,10 +827,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
self.doc_attr_str_error(meta, "keyword");
return false;
}
match self.tcx.opt_hir_node(hir_id).and_then(|node| match node {
let item_kind = match self.tcx.hir_node(hir_id) {
hir::Node::Item(item) => Some(&item.kind),
_ => None,
}) {
};
match item_kind {
Some(ItemKind::Mod(module)) => {
if !module.item_ids.is_empty() {
self.dcx().emit_err(errors::DocKeywordEmptyMod { span: meta.span() });
@ -853,10 +854,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
fn check_doc_fake_variadic(&self, meta: &NestedMetaItem, hir_id: HirId) -> bool {
match self.tcx.opt_hir_node(hir_id).and_then(|node| match node {
let item_kind = match self.tcx.hir_node(hir_id) {
hir::Node::Item(item) => Some(&item.kind),
_ => None,
}) {
};
match item_kind {
Some(ItemKind::Impl(i)) => {
let is_valid = matches!(&i.self_ty.kind, hir::TyKind::Tup([_]))
|| if let hir::TyKind::BareFn(bare_fn_ty) = &i.self_ty.kind {
@ -2221,8 +2223,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
} else {
// special case when `#[macro_export]` is applied to a macro 2.0
let (macro_definition, _) =
self.tcx.opt_hir_node(hir_id).unwrap().expect_item().expect_macro();
let (macro_definition, _) = self.tcx.hir_node(hir_id).expect_item().expect_macro();
let is_decl_macro = !macro_definition.macro_rules;
if is_decl_macro {

View file

@ -8,6 +8,7 @@ use rustc_ast::Label;
use rustc_errors::{
codes::*, AddToDiagnostic, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
DiagnosticSymbolList, EmissionGuarantee, IntoDiagnostic, Level, MultiSpan,
SubdiagnosticMessageOp,
};
use rustc_hir::{self as hir, ExprKind, Target};
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@ -1753,7 +1754,7 @@ pub struct UnusedVariableStringInterp {
}
impl AddToDiagnostic for UnusedVariableStringInterp {
fn add_to_diagnostic_with<F>(self, diag: &mut Diagnostic, _: F) {
fn add_to_diagnostic_with<F: SubdiagnosticMessageOp>(self, diag: &mut Diagnostic, _: F) {
diag.span_label(self.lit, crate::fluent_generated::passes_maybe_string_interpolation);
diag.multipart_suggestion(
crate::fluent_generated::passes_string_interpolation_only_works,

View file

@ -134,7 +134,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
Err(hir::LoopIdError::UnresolvedLabel) => None,
};
if let Some(Node::Block(_)) = loop_id.and_then(|id| self.tcx.opt_hir_node(id)) {
if let Some(Node::Block(_)) = loop_id.map(|id| self.tcx.hir_node(id)) {
return;
}
@ -186,7 +186,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> {
match destination.target_id {
Ok(loop_id) => {
if let Node::Block(block) = self.tcx.opt_hir_node(loop_id).unwrap() {
if let Node::Block(block) = self.tcx.hir_node(loop_id) {
self.sess.dcx().emit_err(ContinueLabeledBlock {
span: e.span,
block_span: block.span,