@@ -57,7 +57,7 @@ impl<'tcx> NeverCompatHandler<'tcx> {
5757 if fcx. infcx . unresolved_type_vars ( fn_substs) . is_some ( ) {
5858 for subst in fn_substs. types ( ) {
5959 let mut finder = TyVarFinder { infcx : & fcx. infcx , vars : vec ! [ ] } ;
60- path . ty . fold_with ( & mut finder) ;
60+ subst . fold_with ( & mut finder) ;
6161 path. unresolved_vars . push ( finder. vars ) ;
6262 }
6363
@@ -124,7 +124,7 @@ impl<'tcx> NeverCompatHandler<'tcx> {
124124 debug ! ( "Subst is uninhabited: {:?}" , resolved_subst) ;
125125 if !vars. is_empty ( ) {
126126 debug ! ( "Found fallback vars: {:?}" , vars) ;
127- uninhabited_subst = Some ( ( resolved_subst , vars) ) ;
127+ uninhabited_subst = Some ( vars) ;
128128 break ;
129129 } else {
130130 debug ! ( "No fallback vars" )
@@ -134,7 +134,7 @@ impl<'tcx> NeverCompatHandler<'tcx> {
134134 }
135135 }
136136
137- if let ( true , Some ( ( subst , vars) ) ) = ( args_inhabited, uninhabited_subst) {
137+ if let ( true , Some ( vars) ) = ( args_inhabited, uninhabited_subst) {
138138 debug ! ( "All arguments are inhabited, at least one subst is not inhabited!" ) ;
139139
140140 let mut best_diverging_var = None ;
@@ -211,6 +211,7 @@ impl<'tcx> NeverCompatHandler<'tcx> {
211211 diverging_var_span,
212212 "... due to this expression evaluating to `!`" ,
213213 )
214+ . note ( "If you want the `!` type to be used here, add explicit type annotations" )
214215 . emit ( ) ;
215216 }
216217 }
0 commit comments