Skip to content

Commit 8a93f34

Browse files
committed
Address nits and add assertation
1 parent c0b7638 commit 8a93f34

File tree

1 file changed

+6
-3
lines changed
  • src/librustc_typeck/check

1 file changed

+6
-3
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,7 +1823,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18231823
let mut conflicts = Vec::new();
18241824

18251825
// Collect all unsolved type, integral and floating point variables.
1826-
let unsolved_variables = self.inh.infcx.candidates_for_defaulting();
1826+
let defaults_to_apply = self.inh.infcx.candidates_for_defaulting();
18271827

18281828
let mut has_user_default = HashSet::new();
18291829
let mut has_literal_fallback = HashSet::new();
@@ -1832,8 +1832,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18321832
// Examine all unsolved variables, and narrow them to the set that have applicable
18331833
// defaults. We want to process any unsolved variables that have either an explicit
18341834
// user default, literal fallback, or are diverging.
1835-
for &(ref ty, ref default) in &unsolved_variables {
1836-
let resolved = self.infcx().resolve_type_vars_if_possible(ty);
1835+
for &(ref ty, ref default) in &defaults_to_apply {
1836+
// We should NEVER process anything but a TyInfer.
1837+
assert!(match ty.sty { ty::TyInfer(_) => true, _ => false });
18371838
match default {
18381839
&Default::User(ref user_default) => {
18391840
debug!("select_all_obligations_and_apply_defaults: ty: {:?} with default: {:?}",
@@ -1925,6 +1926,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19251926
}
19261927
}
19271928

1929+
// Apply integer and floating point fallbacks to any variables that
1930+
// weren't solved by the previous phase where we applied user defaults.
19281931
for ty in &has_literal_fallback {
19291932
let resolved = self.infcx().resolve_type_vars_if_possible(ty);
19301933
match self.infcx().type_is_unconstrained_numeric(resolved) {

0 commit comments

Comments
 (0)