Migrate OpaqueHiddenType mismatch
This commit is contained in:
@@ -15,6 +15,7 @@ pub use self::AssocItemContainer::*;
|
||||
pub use self::BorrowKind::*;
|
||||
pub use self::IntVarValue::*;
|
||||
pub use self::Variance::*;
|
||||
use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason};
|
||||
use crate::metadata::ModChild;
|
||||
use crate::middle::privacy::AccessLevels;
|
||||
use crate::mir::{Body, GeneratorLayout};
|
||||
@@ -1184,20 +1185,17 @@ pub struct OpaqueHiddenType<'tcx> {
|
||||
impl<'tcx> OpaqueHiddenType<'tcx> {
|
||||
pub fn report_mismatch(&self, other: &Self, tcx: TyCtxt<'tcx>) {
|
||||
// Found different concrete types for the opaque type.
|
||||
let mut err = tcx.sess.struct_span_err(
|
||||
other.span,
|
||||
"concrete type differs from previous defining opaque type use",
|
||||
);
|
||||
err.span_label(other.span, format!("expected `{}`, got `{}`", self.ty, other.ty));
|
||||
if self.span == other.span {
|
||||
err.span_label(
|
||||
self.span,
|
||||
"this expression supplies two conflicting concrete types for the same opaque type",
|
||||
);
|
||||
let sub_diag = if self.span == other.span {
|
||||
TypeMismatchReason::ConflictType { span: self.span }
|
||||
} else {
|
||||
err.span_note(self.span, "previous use here");
|
||||
}
|
||||
err.emit();
|
||||
TypeMismatchReason::PreviousUse { span: self.span }
|
||||
};
|
||||
tcx.sess.emit_err(OpaqueHiddenTypeMismatch {
|
||||
self_ty: self.ty,
|
||||
other_ty: other.ty,
|
||||
other_span: other.span,
|
||||
sub: sub_diag,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user