@@ -1823,7 +1823,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1823
1823
let mut conflicts = Vec :: new ( ) ;
1824
1824
1825
1825
// 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 ( ) ;
1827
1827
1828
1828
let mut has_user_default = HashSet :: new ( ) ;
1829
1829
let mut has_literal_fallback = HashSet :: new ( ) ;
@@ -1832,8 +1832,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1832
1832
// Examine all unsolved variables, and narrow them to the set that have applicable
1833
1833
// defaults. We want to process any unsolved variables that have either an explicit
1834
1834
// 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 } ) ;
1837
1838
match default {
1838
1839
& Default :: User ( ref user_default) => {
1839
1840
debug ! ( "select_all_obligations_and_apply_defaults: ty: {:?} with default: {:?}" ,
@@ -1925,6 +1926,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1925
1926
}
1926
1927
}
1927
1928
1929
+ // Apply integer and floating point fallbacks to any variables that
1930
+ // weren't solved by the previous phase where we applied user defaults.
1928
1931
for ty in & has_literal_fallback {
1929
1932
let resolved = self . infcx ( ) . resolve_type_vars_if_possible ( ty) ;
1930
1933
match self . infcx ( ) . type_is_unconstrained_numeric ( resolved) {
0 commit comments