File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
src/librustc_typeck/check Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -1149,21 +1149,34 @@ fn typeck_tables_of_with_fallback<'tcx>(
1149
1149
1150
1150
if let ty:: FnDef ( _, substs) = ty. kind {
1151
1151
debug ! ( "Got substs: {:?}" , substs) ;
1152
- let mut inhabited = true ;
1152
+ let mut args_inhabited = true ;
1153
+ let mut substs_inhabited = true ;
1154
+
1153
1155
for arg in & * path. args . unwrap ( ) {
1154
1156
let resolved_arg = fcx. infcx . resolve_vars_if_possible ( arg) ;
1155
1157
1156
1158
if resolved_arg. conservative_is_privately_uninhabited ( tcx) {
1157
1159
debug ! ( "Arg is uninhabited: {:?}" , resolved_arg) ;
1158
- inhabited = false ;
1160
+ args_inhabited = false ;
1159
1161
break ;
1160
1162
} else {
1161
1163
debug ! ( "Arg is inhabited: {:?}" , resolved_arg) ;
1162
1164
}
1163
1165
}
1164
1166
1165
- if inhabited {
1166
- debug ! ( "All arguments are inhabited!" ) ;
1167
+ for subst_ty in substs. types ( ) {
1168
+ let resolved_subst = fcx. infcx . resolve_vars_if_possible ( & subst_ty) ;
1169
+ if resolved_subst. conservative_is_privately_uninhabited ( tcx) {
1170
+ debug ! ( "Subst is uninhabited: {:?}" , resolved_subst) ;
1171
+ substs_inhabited = false ;
1172
+ break ;
1173
+ } else {
1174
+ debug ! ( "Subst is inhabited: {:?}" , resolved_subst) ;
1175
+ }
1176
+ }
1177
+
1178
+ if args_inhabited && !substs_inhabited {
1179
+ debug ! ( "All arguments are inhabited, at least one subst is not inhabited!" ) ;
1167
1180
fcx. tcx ( )
1168
1181
. sess
1169
1182
. struct_span_warn (
You can’t perform that action at this time.
0 commit comments