Remove redundant Code from FulfillmentErrorCode variants
This commit is contained in:
parent
174e73a3f6
commit
f37a919e96
11 changed files with 59 additions and 60 deletions
|
@ -17,7 +17,6 @@ use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
|||
use rustc_middle::ty::{self, Const, ToPredicate, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub use self::FulfillmentErrorCode::*;
|
||||
pub use self::ImplSource::*;
|
||||
pub use self::SelectionError::*;
|
||||
|
||||
|
@ -129,12 +128,12 @@ pub struct FulfillmentError<'tcx> {
|
|||
#[derive(Clone)]
|
||||
pub enum FulfillmentErrorCode<'tcx> {
|
||||
/// Inherently impossible to fulfill; this trait is implemented if and only if it is already implemented.
|
||||
CodeCycle(Vec<PredicateObligation<'tcx>>),
|
||||
CodeSelectionError(SelectionError<'tcx>),
|
||||
CodeProjectionError(MismatchedProjectionTypes<'tcx>),
|
||||
CodeSubtypeError(ExpectedFound<Ty<'tcx>>, TypeError<'tcx>), // always comes from a SubtypePredicate
|
||||
CodeConstEquateError(ExpectedFound<Const<'tcx>>, TypeError<'tcx>),
|
||||
CodeAmbiguity {
|
||||
Cycle(Vec<PredicateObligation<'tcx>>),
|
||||
SelectionError(SelectionError<'tcx>),
|
||||
ProjectionError(MismatchedProjectionTypes<'tcx>),
|
||||
SubtypeError(ExpectedFound<Ty<'tcx>>, TypeError<'tcx>), // always comes from a SubtypePredicate
|
||||
ConstEquateError(ExpectedFound<Const<'tcx>>, TypeError<'tcx>),
|
||||
Ambiguity {
|
||||
/// Overflow reported from the new solver `-Znext-solver`, which will
|
||||
/// be reported as an regular error as opposed to a fatal error.
|
||||
overflow: bool,
|
||||
|
|
|
@ -37,18 +37,19 @@ impl<'tcx> fmt::Debug for traits::FulfillmentError<'tcx> {
|
|||
|
||||
impl<'tcx> fmt::Debug for traits::FulfillmentErrorCode<'tcx> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
use traits::FulfillmentErrorCode::*;
|
||||
match *self {
|
||||
super::CodeSelectionError(ref e) => write!(f, "{e:?}"),
|
||||
super::CodeProjectionError(ref e) => write!(f, "{e:?}"),
|
||||
super::CodeSubtypeError(ref a, ref b) => {
|
||||
SelectionError(ref e) => write!(f, "{e:?}"),
|
||||
ProjectionError(ref e) => write!(f, "{e:?}"),
|
||||
SubtypeError(ref a, ref b) => {
|
||||
write!(f, "CodeSubtypeError({a:?}, {b:?})")
|
||||
}
|
||||
super::CodeConstEquateError(ref a, ref b) => {
|
||||
ConstEquateError(ref a, ref b) => {
|
||||
write!(f, "CodeConstEquateError({a:?}, {b:?})")
|
||||
}
|
||||
super::CodeAmbiguity { overflow: false } => write!(f, "Ambiguity"),
|
||||
super::CodeAmbiguity { overflow: true } => write!(f, "Overflow"),
|
||||
super::CodeCycle(ref cycle) => write!(f, "Cycle({cycle:?})"),
|
||||
Ambiguity { overflow: false } => write!(f, "Ambiguity"),
|
||||
Ambiguity { overflow: true } => write!(f, "Overflow"),
|
||||
Cycle(ref cycle) => write!(f, "Cycle({cycle:?})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue