Skip to content

Commit 3fd7f3a

Browse files
committed
Rebase fixes
1 parent ea007bf commit 3fd7f3a

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/librustc/middle/infer/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub struct InferCtxt<'a, 'tcx: 'a> {
7373
// We instantiate UnificationTable with bounds<Ty> because the
7474
// types that might instantiate a general type variable have an
7575
// order, represented by its upper and lower bounds.
76-
pub type_variables: RefCell<type_variable::TypeVariableTable<'tcx>>,
76+
type_variables: RefCell<type_variable::TypeVariableTable<'tcx>>,
7777

7878
// Map from integral variable to the kind of integer it represents
7979
int_unification_table: RefCell<UnificationTable<ty::IntVid>>,
@@ -1362,19 +1362,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
13621362
}
13631363

13641364
pub fn report_conflicting_default_types(&self,
1365-
span: Span,
1366-
expected: type_variable::Default<'tcx>,
1367-
actual: type_variable::Default<'tcx>) {
1365+
span: Span,
1366+
expected: type_variable::Default<'tcx>,
1367+
actual: type_variable::Default<'tcx>) {
13681368
let trace = TypeTrace {
13691369
origin: Misc(span),
1370-
values: Types(ty::expected_found {
1370+
values: Types(ty::ExpectedFound {
13711371
expected: expected.ty,
13721372
found: actual.ty
13731373
})
13741374
};
13751375

13761376
self.report_and_explain_type_error(trace,
1377-
&ty::type_err::terr_ty_param_default_mismatch(ty::expected_found {
1377+
&TypeError::TyParamDefaultMismatch(ty::ExpectedFound {
13781378
expected: expected,
13791379
found: actual
13801380
}));

src/librustc/middle/ty.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ pub struct ExpectedFound<T> {
19511951
}
19521952

19531953
// Data structures used in type unification
1954-
#[derive(Clone, Copy, Debug)]
1954+
#[derive(Clone, Debug)]
19551955
pub enum TypeError<'tcx> {
19561956
Mismatch,
19571957
UnsafetyMismatch(ExpectedFound<ast::Unsafety>),
@@ -1981,7 +1981,7 @@ pub enum TypeError<'tcx> {
19811981
ConvergenceMismatch(ExpectedFound<bool>),
19821982
ProjectionNameMismatched(ExpectedFound<ast::Name>),
19831983
ProjectionBoundsLength(ExpectedFound<usize>),
1984-
TyParamDefaultMismatch(ExpectedFound<Ty<'tcx>>)
1984+
TyParamDefaultMismatch(ExpectedFound<type_variable::Default<'tcx>>)
19851985
}
19861986

19871987
/// Bounds suitable for an existentially quantified type parameter
@@ -5101,7 +5101,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
51015101
values.expected,
51025102
values.found)
51035103
},
5104-
terr_ty_param_default_mismatch(ref values) => {
5104+
TyParamDefaultMismatch(ref values) => {
51055105
write!(f, "conflicting type parameter defaults {} and {}",
51065106
values.expected.ty,
51075107
values.found.ty)
@@ -5463,7 +5463,7 @@ impl<'tcx> ctxt<'tcx> {
54635463
using it as a trait object"));
54645464
}
54655465
},
5466-
terr_ty_param_default_mismatch(values) => {
5466+
TyParamDefaultMismatch(values) => {
54675467
let expected = values.expected;
54685468
let found = values.found;
54695469
self.sess.span_note(sp,

src/librustc_typeck/check/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17791779
// it had been solved by previously applying a default.
17801780

17811781
// We take a snapshot for use in error reporting.
1782-
let snapshot = self.infcx().type_variables.borrow_mut().snapshot();
1782+
let snapshot = self.infcx().start_snapshot();
17831783

17841784
for ty in &unbound_tyvars {
17851785
if self.infcx().type_var_diverges(ty) {
@@ -1809,10 +1809,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18091809
}
18101810
}
18111811

1812-
// There were some errors to report
1812+
// There are some errors to report
18131813
if conflicts.len() > 0 {
1814-
self.infcx().type_variables.borrow_mut().rollback_to(snapshot);
1814+
self.infcx().rollback_to(snapshot);
18151815

1816+
// Loop through each conflicting default compute the conflict
1817+
// and then report the error.
18161818
for (conflict, default) in conflicts {
18171819
let conflicting_default =
18181820
self.find_conflicting_default(
@@ -1830,7 +1832,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18301832
default)
18311833
}
18321834
} else {
1833-
self.infcx().type_variables.borrow_mut().commit(snapshot)
1835+
self.infcx().commit_from(snapshot)
18341836
}
18351837
}
18361838

0 commit comments

Comments
 (0)