@@ -1808,7 +1808,7 @@ impl<'a> LowerMethod<'a> {
1808
1808
}
1809
1809
1810
1810
fn tuple_literal ( & mut self , node : hir:: TupleLiteral ) -> RegisterId {
1811
- self . check_inferred ( node. resolved_type , false , node. location ) ;
1811
+ self . check_inferred ( node. resolved_type , node. location ) ;
1812
1812
1813
1813
let tup = self . new_register ( node. resolved_type ) ;
1814
1814
let id = node. type_id . unwrap ( ) ;
@@ -1922,7 +1922,7 @@ impl<'a> LowerMethod<'a> {
1922
1922
let loc = InstructionLocation :: new ( node. name . location ) ;
1923
1923
let reg = match node. kind {
1924
1924
types:: CallKind :: Call ( info) => {
1925
- self . check_inferred ( info. returns , true , node. location ) ;
1925
+ self . check_inferred ( info. returns , node. location ) ;
1926
1926
1927
1927
let rec = if info. receiver . is_explicit ( ) {
1928
1928
node. receiver . map ( |expr| self . expression ( expr) )
@@ -1936,7 +1936,7 @@ impl<'a> LowerMethod<'a> {
1936
1936
self . call_method ( info, rec, args, node. name . location )
1937
1937
}
1938
1938
types:: CallKind :: GetField ( info) => {
1939
- self . check_inferred ( info. variable_type , false , node. location ) ;
1939
+ self . check_inferred ( info. variable_type , node. location ) ;
1940
1940
1941
1941
let typ = info. variable_type ;
1942
1942
let rec = self . expression ( node. receiver . unwrap ( ) ) ;
@@ -1980,7 +1980,7 @@ impl<'a> LowerMethod<'a> {
1980
1980
}
1981
1981
}
1982
1982
types:: CallKind :: CallClosure ( info) => {
1983
- self . check_inferred ( info. returns , true , node. location ) ;
1983
+ self . check_inferred ( info. returns , node. location ) ;
1984
1984
1985
1985
let returns = info. returns ;
1986
1986
let rec = self . expression ( node. receiver . unwrap ( ) ) ;
@@ -2014,7 +2014,7 @@ impl<'a> LowerMethod<'a> {
2014
2014
reg
2015
2015
}
2016
2016
types:: CallKind :: TypeInstance ( info) => {
2017
- self . check_inferred ( info. resolved_type , false , node. location ) ;
2017
+ self . check_inferred ( info. resolved_type , node. location ) ;
2018
2018
2019
2019
let ins = self . new_register ( info. resolved_type ) ;
2020
2020
let tid = info. type_id ;
@@ -2168,11 +2168,8 @@ impl<'a> LowerMethod<'a> {
2168
2168
}
2169
2169
}
2170
2170
2171
- fn check_inferred ( & mut self , typ : TypeRef , call : bool , location : Location ) {
2172
- // For calls we start with a depth of 1 such that we can disallow
2173
- // methods returning borrows of data that can't be borrowed (e.g. a
2174
- // borrow of a unique value).
2175
- match typ. verify_type ( self . db ( ) , call as usize ) {
2171
+ fn check_inferred ( & mut self , typ : TypeRef , location : Location ) {
2172
+ match typ. verify_type ( self . db ( ) , 0 ) {
2176
2173
Ok ( ( ) ) => { }
2177
2174
Err ( VerificationError :: Incomplete ) => {
2178
2175
self . state . diagnostics . cant_infer_type (
@@ -2227,7 +2224,7 @@ impl<'a> LowerMethod<'a> {
2227
2224
let loc = InstructionLocation :: new ( node. location ) ;
2228
2225
let reg = match node. kind {
2229
2226
types:: CallKind :: Call ( info) => {
2230
- self . check_inferred ( info. returns , true , node. location ) ;
2227
+ self . check_inferred ( info. returns , node. location ) ;
2231
2228
2232
2229
let rec = if info. receiver . is_explicit ( ) {
2233
2230
Some ( self . expression ( node. receiver ) )
@@ -3520,7 +3517,7 @@ impl<'a> LowerMethod<'a> {
3520
3517
}
3521
3518
3522
3519
fn closure ( & mut self , node : hir:: Closure ) -> RegisterId {
3523
- self . check_inferred ( node. resolved_type , false , node. location ) ;
3520
+ self . check_inferred ( node. resolved_type , node. location ) ;
3524
3521
3525
3522
let module = self . module ;
3526
3523
let closure_id = node. closure_id . unwrap ( ) ;
0 commit comments