Skip to content

Commit bbcc665

Browse files
committed
Rebase fixes
1 parent 1302304 commit bbcc665

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

src/librustc/middle/ty/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub enum TypeError<'tcx> {
5757
ConvergenceMismatch(ExpectedFound<bool>),
5858
ProjectionNameMismatched(ExpectedFound<Name>),
5959
ProjectionBoundsLength(ExpectedFound<usize>),
60-
TyParamDefaultMismatch(ExpectedFound<type_variable::Default<'tcx>>)
60+
TyParamDefaultMismatch(ExpectedFound<type_variable::UserDefault<'tcx>>)
6161
}
6262

6363
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Debug, Copy)]

src/librustc_typeck/check/mod.rs

+8-26
Original file line numberDiff line numberDiff line change
@@ -1767,17 +1767,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17671767
}
17681768
}
17691769

1770-
/// Apply "fallbacks" to some types
1771-
/// ! gets replaced with (), unconstrained ints with i32, and unconstrained floats with f64.
17721770
fn default_type_parameters(&self) {
1773-
use middle::ty::error::UnconstrainedNumeric::Neither;
1774-
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
1775-
for ty in &self.infcx().unsolved_variables() {
1771+
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat, Neither};
1772+
let unsolved_variables = self.infcx().candidates_for_defaulting();
1773+
for &(ref ty, _) in &unsolved_variables {
17761774
let resolved = self.infcx().resolve_type_vars_if_possible(ty);
1777-
if self.infcx().type_var_diverges(resolved) {
1775+
let diverges = self.infcx().type_var_diverges(resolved);
1776+
if diverges {
17781777
demand::eqtype(self, codemap::DUMMY_SP, *ty, self.tcx().mk_nil());
17791778
} else {
1780-
match self.infcx().type_is_unconstrained_numeric(resolved) {
1779+
let unconstrained =
1780+
self.infcx().type_is_unconstrained_numeric(resolved);
1781+
match unconstrained {
17811782
UnconstrainedInt => {
17821783
demand::eqtype(self, codemap::DUMMY_SP, *ty, self.tcx().types.i32)
17831784
},
@@ -1809,10 +1810,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18091810
use middle::ty::error::UnconstrainedNumeric::Neither;
18101811
use middle::ty::error::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat};
18111812

1812-
// For the time being this errs on the side of being memory wasteful but provides better
1813-
// error reporting.
1814-
// let type_variables = self.infcx().type_variables.clone();
1815-
18161813
// It is a possible that this algorithm will have to run an arbitrary number of times
18171814
// to terminate so we bound it by the compiler's recursion limit.
18181815
for _ in (0..self.tcx().sess.recursion_limit.get()) {
@@ -2067,21 +2064,6 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> {
20672064
}
20682065
}
20692066

2070-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
2071-
pub enum LvaluePreference {
2072-
PreferMutLvalue,
2073-
NoPreference
2074-
}
2075-
2076-
impl LvaluePreference {
2077-
pub fn from_mutbl(m: ast::Mutability) -> Self {
2078-
match m {
2079-
ast::MutMutable => PreferMutLvalue,
2080-
ast::MutImmutable => NoPreference,
2081-
}
2082-
}
2083-
}
2084-
20852067
/// Whether `autoderef` requires types to resolve.
20862068
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
20872069
pub enum UnresolvedTypeAction {

0 commit comments

Comments
 (0)