File tree 2 files changed +24
-6
lines changed
librustc/middle/borrowck/gather_loans
2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -230,12 +230,15 @@ fn gather_loans_in_expr(this: &mut GatherLoanCtxt,
230
230
231
231
// make sure that the thing we are pointing out stays valid
232
232
// for the lifetime `scope_r` of the resulting ptr:
233
- let scope_r = ty_region ( tcx, ex. span , ty:: expr_ty ( tcx, ex) ) ;
234
- this. guarantee_valid ( ex. id ,
235
- ex. span ,
236
- base_cmt,
237
- LoanMutability :: from_ast_mutability ( mutbl) ,
238
- scope_r) ;
233
+ let expr_ty = ty:: expr_ty ( tcx, ex) ;
234
+ if !ty:: type_is_bot ( expr_ty) {
235
+ let scope_r = ty_region ( tcx, ex. span , expr_ty) ;
236
+ this. guarantee_valid ( ex. id ,
237
+ ex. span ,
238
+ base_cmt,
239
+ LoanMutability :: from_ast_mutability ( mutbl) ,
240
+ scope_r) ;
241
+ }
239
242
visit:: walk_expr ( this, ex, ( ) ) ;
240
243
}
241
244
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // error-pattern:explicit failure
12
+
13
+ fn main ( ) {
14
+ & fail ! ( )
15
+ }
You can’t perform that action at this time.
0 commit comments