1
Fork 0

Use tcx.require_lang_item instead of unwrapping

This commit is contained in:
Maybe Waffle 2022-11-22 17:19:19 +00:00
parent 0f7d81754d
commit b80356a5ab
9 changed files with 14 additions and 12 deletions

View file

@ -1,7 +1,7 @@
//! Concrete error types for all operations which may be invalid in a certain const context.
use hir::def_id::LocalDefId;
use hir::ConstContext;
use hir::{ConstContext, LangItem};
use rustc_errors::{
error_code, struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed,
};
@ -304,7 +304,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
err.span_note(deref_target, "deref defined here");
}
diag_trait(&mut err, self_ty, tcx.lang_items().deref_trait().unwrap());
diag_trait(&mut err, self_ty, tcx.require_lang_item(LangItem::Deref, Some(span)));
err
}
_ if tcx.opt_parent(callee) == tcx.get_diagnostic_item(sym::ArgumentV1Methods) => {