Rebase fixes
This commit is contained in:
parent
e85787102f
commit
ee43920410
@ -73,7 +73,7 @@ pub struct InferCtxt<'a, 'tcx: 'a> {
|
||||
// We instantiate UnificationTable with bounds<Ty> because the
|
||||
// types that might instantiate a general type variable have an
|
||||
// order, represented by its upper and lower bounds.
|
||||
pub type_variables: RefCell<type_variable::TypeVariableTable<'tcx>>,
|
||||
type_variables: RefCell<type_variable::TypeVariableTable<'tcx>>,
|
||||
|
||||
// Map from integral variable to the kind of integer it represents
|
||||
int_unification_table: RefCell<UnificationTable<ty::IntVid>>,
|
||||
@ -1366,19 +1366,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn report_conflicting_default_types(&self,
|
||||
span: Span,
|
||||
expected: type_variable::Default<'tcx>,
|
||||
actual: type_variable::Default<'tcx>) {
|
||||
span: Span,
|
||||
expected: type_variable::Default<'tcx>,
|
||||
actual: type_variable::Default<'tcx>) {
|
||||
let trace = TypeTrace {
|
||||
origin: Misc(span),
|
||||
values: Types(ty::expected_found {
|
||||
values: Types(ty::ExpectedFound {
|
||||
expected: expected.ty,
|
||||
found: actual.ty
|
||||
})
|
||||
};
|
||||
|
||||
self.report_and_explain_type_error(trace,
|
||||
&ty::type_err::terr_ty_param_default_mismatch(ty::expected_found {
|
||||
&TypeError::TyParamDefaultMismatch(ty::ExpectedFound {
|
||||
expected: expected,
|
||||
found: actual
|
||||
}));
|
||||
|
@ -2039,7 +2039,7 @@ pub struct ExpectedFound<T> {
|
||||
}
|
||||
|
||||
// Data structures used in type unification
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum TypeError<'tcx> {
|
||||
Mismatch,
|
||||
UnsafetyMismatch(ExpectedFound<ast::Unsafety>),
|
||||
@ -2069,7 +2069,7 @@ pub enum TypeError<'tcx> {
|
||||
ConvergenceMismatch(ExpectedFound<bool>),
|
||||
ProjectionNameMismatched(ExpectedFound<ast::Name>),
|
||||
ProjectionBoundsLength(ExpectedFound<usize>),
|
||||
TyParamDefaultMismatch(ExpectedFound<Ty<'tcx>>)
|
||||
TyParamDefaultMismatch(ExpectedFound<type_variable::Default<'tcx>>)
|
||||
}
|
||||
|
||||
/// Bounds suitable for an existentially quantified type parameter
|
||||
@ -5083,7 +5083,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
values.expected,
|
||||
values.found)
|
||||
},
|
||||
terr_ty_param_default_mismatch(ref values) => {
|
||||
TyParamDefaultMismatch(ref values) => {
|
||||
write!(f, "conflicting type parameter defaults {} and {}",
|
||||
values.expected.ty,
|
||||
values.found.ty)
|
||||
@ -5445,7 +5445,7 @@ impl<'tcx> ctxt<'tcx> {
|
||||
using it as a trait object"));
|
||||
}
|
||||
},
|
||||
terr_ty_param_default_mismatch(values) => {
|
||||
TyParamDefaultMismatch(values) => {
|
||||
let expected = values.expected;
|
||||
let found = values.found;
|
||||
self.sess.span_note(sp,
|
||||
|
@ -1785,7 +1785,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// it had been solved by previously applying a default.
|
||||
|
||||
// We take a snapshot for use in error reporting.
|
||||
let snapshot = self.infcx().type_variables.borrow_mut().snapshot();
|
||||
let snapshot = self.infcx().start_snapshot();
|
||||
|
||||
for ty in &unbound_tyvars {
|
||||
if self.infcx().type_var_diverges(ty) {
|
||||
@ -1815,10 +1815,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
// There were some errors to report
|
||||
// There are some errors to report
|
||||
if conflicts.len() > 0 {
|
||||
self.infcx().type_variables.borrow_mut().rollback_to(snapshot);
|
||||
self.infcx().rollback_to(snapshot);
|
||||
|
||||
// Loop through each conflicting default compute the conflict
|
||||
// and then report the error.
|
||||
for (conflict, default) in conflicts {
|
||||
let conflicting_default =
|
||||
self.find_conflicting_default(
|
||||
@ -1836,7 +1838,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
default)
|
||||
}
|
||||
} else {
|
||||
self.infcx().type_variables.borrow_mut().commit(snapshot)
|
||||
self.infcx().commit_from(snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user