Skip to content

Commit 268b08b

Browse files
committed
do not use ty_adt_id from internal trait
1 parent 6d2ba95 commit 268b08b

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_trait_selection/src/traits/error_reporting

1 file changed

+2
-3
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use rustc_infer::infer::error_reporting::TypeErrCtxt;
2727
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
2828
use rustc_infer::infer::{DefineOpaqueTypes, InferOk, LateBoundRegionConversionTime};
2929
use rustc_middle::hir::map;
30-
use rustc_middle::query::Key;
3130
use rustc_middle::ty::error::TypeError::{self, Sorts};
3231
use rustc_middle::ty::{
3332
self, suggest_arbitrary_trait_bound, suggest_constraining_type_param, AdtKind,
@@ -3701,8 +3700,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
37013700
let Some(typeck_results) = self.typeck_results.as_ref() else { return };
37023701

37033702
// Make sure we're dealing with the `Option` type.
3704-
let Some(ty_adt_did) = typeck_results.expr_ty_adjusted(expr).ty_adt_id() else { return };
3705-
if !tcx.is_diagnostic_item(sym::Option, ty_adt_did) {
3703+
let Some(option_ty_adt) = typeck_results.expr_ty_adjusted(expr).ty_adt_def() else { return };
3704+
if !tcx.is_diagnostic_item(sym::Option, option_ty_adt.did()) {
37063705
return;
37073706
}
37083707

0 commit comments

Comments
 (0)