Skip to content

Commit

Permalink
Rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jroesch authored and Jared Roesch committed Jul 26, 2015
1 parent e857871 commit ee43920
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/librustc/middle/infer/mod.rs
Expand Up @@ -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>>,
Expand Down Expand Up @@ -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
}));
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/middle/ty.rs
Expand Up @@ -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>),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand All @@ -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)
}
}

Expand Down

0 comments on commit ee43920

Please sign in to comment.