File tree 1 file changed +22
-0
lines changed
src/librustc_typeck/check
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ use rustc::ty::fold::TypeFolder;
7
7
use rustc:: ty:: { Ty , TyCtxt , TyVid } ;
8
8
use rustc_data_structures:: fx:: FxHashMap ;
9
9
use rustc_hir:: HirId ;
10
+ use std:: borrow:: Cow ;
10
11
11
12
/// Code to detect cases where using `!` (never-type) fallback instead of `()` fallback
12
13
/// may result in the introduction of undefined behavior;
@@ -302,6 +303,27 @@ impl<'tcx> NeverCompatHandler<'tcx> {
302
303
}
303
304
} ;
304
305
306
+ let args_infer = match path. args . as_ref ( ) . unwrap ( ) {
307
+ Cow :: Borrowed ( b) => b. iter ( ) . any ( |ty| {
308
+ fcx. infcx
309
+ . unresolved_type_vars ( & fcx. infcx . resolve_vars_if_possible ( ty) )
310
+ . is_some ( )
311
+ } ) ,
312
+ Cow :: Owned ( o) => fcx
313
+ . infcx
314
+ . unresolved_type_vars ( & fcx. infcx . resolve_vars_if_possible ( o) )
315
+ . is_some ( ) ,
316
+ } ;
317
+
318
+ if args_infer {
319
+ debug ! (
320
+ "pre_fallback: skipping due to inference vars in fn {:?} args {:?}" ,
321
+ ty_resolved,
322
+ path. args. unwrap( )
323
+ ) ;
324
+ return None ;
325
+ }
326
+
305
327
// Any method call with inference variables in its substs
306
328
// could potentially be affected by fallback.
307
329
if fcx. infcx . unresolved_type_vars ( fn_substs) . is_some ( ) {
You can’t perform that action at this time.
0 commit comments