@@ -2808,9 +2808,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
2808
2808
} else {
2809
2809
// is the missing argument of type `()`?
2810
2810
let sugg_unit = if expected_arg_tys. len ( ) == 1 && supplied_arg_count == 0 {
2811
- self . resolve_type_vars_if_possible ( & expected_arg_tys[ 0 ] ) . is_nil ( )
2811
+ self . resolve_type_vars_if_possible ( & expected_arg_tys[ 0 ] ) . is_unit ( )
2812
2812
} else if fn_inputs. len ( ) == 1 && supplied_arg_count == 0 {
2813
- self . resolve_type_vars_if_possible ( & fn_inputs[ 0 ] ) . is_nil ( )
2813
+ self . resolve_type_vars_if_possible ( & fn_inputs[ 0 ] ) . is_unit ( )
2814
2814
} else {
2815
2815
false
2816
2816
} ;
@@ -3958,7 +3958,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3958
3958
if let Some ( ref e) = * expr_opt {
3959
3959
coerce. coerce ( self , & cause, e, e_ty) ;
3960
3960
} else {
3961
- assert ! ( e_ty. is_nil ( ) ) ;
3961
+ assert ! ( e_ty. is_unit ( ) ) ;
3962
3962
coerce. coerce_forced_unit ( self , & cause, & mut |_| ( ) , true ) ;
3963
3963
}
3964
3964
} else {
@@ -4752,7 +4752,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4752
4752
expression : & ' gcx hir:: Expr ,
4753
4753
expected : Ty < ' tcx > ,
4754
4754
cause_span : Span ) {
4755
- if expected. is_nil ( ) {
4755
+ if expected. is_unit ( ) {
4756
4756
// `BlockTailExpression` only relevant if the tail expr would be
4757
4757
// useful on its own.
4758
4758
match expression. node {
@@ -4795,7 +4795,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
4795
4795
can_suggest : bool ) {
4796
4796
// Only suggest changing the return type for methods that
4797
4797
// haven't set a return type at all (and aren't `fn main()` or an impl).
4798
- match ( & fn_decl. output , found. is_suggestable ( ) , can_suggest, expected. is_nil ( ) ) {
4798
+ match ( & fn_decl. output , found. is_suggestable ( ) , can_suggest, expected. is_unit ( ) ) {
4799
4799
( & hir:: FunctionRetTy :: DefaultReturn ( span) , true , true , true ) => {
4800
4800
err. span_suggestion_with_applicability (
4801
4801
span,
0 commit comments