use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashSet;
-use rustc_errors::{Applicability, DiagnosticBuilder, ErrorReported};
+use rustc_errors::{Applicability, Diagnostic, ErrorReported};
use rustc_hir as hir;
use rustc_hir::def::{CtorOf, DefKind, Res};
use rustc_hir::def_id::DefId;
) => {
// A reborrow has no effect before a dereference.
}
+ // Catch cases which have Deref(None)
+ // having them slip to bug! causes ICE
+ // see #94291 for more info
+ (&[Adjustment { kind: Adjust::Deref(None), .. }], _) => {
+ self.tcx.sess.delay_span_bug(
+ DUMMY_SP,
+ &format!("Can't compose Deref(None) expressions"),
+ )
+ }
// FIXME: currently we never try to compose autoderefs
// and ReifyFnPointer/UnsafeFnPointer, but we could.
_ => bug!(
pub(in super::super) fn note_internal_mutation_in_method(
&self,
- err: &mut DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
expr: &hir::Expr<'_>,
expected: Ty<'tcx>,
found: Ty<'tcx>,
pub(in super::super) fn note_need_for_fn_pointer(
&self,
- err: &mut DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
expected: Ty<'tcx>,
found: Ty<'tcx>,
) {