File tree 4 files changed +53
-9
lines changed
4 files changed +53
-9
lines changed Original file line number Diff line number Diff line change @@ -3044,15 +3044,17 @@ pub fn adjust_ty(cx: ctxt,
3044
3044
Some ( @AutoDerefRef ( ref adj) ) => {
3045
3045
let mut adjusted_ty = unadjusted_ty;
3046
3046
3047
- for uint:: range( 0 , adj. autoderefs) |i| {
3048
- match ty:: deref ( cx, adjusted_ty, true ) {
3049
- Some ( mt) => { adjusted_ty = mt. ty ; }
3050
- None => {
3051
- cx. sess . span_bug (
3052
- span,
3053
- fmt ! ( "The %uth autoderef failed: %s" ,
3054
- i, ty_to_str( cx,
3055
- adjusted_ty) ) ) ;
3047
+ if ( !ty:: type_is_error ( adjusted_ty) ) {
3048
+ for uint:: range( 0 , adj. autoderefs) |i| {
3049
+ match ty:: deref ( cx, adjusted_ty, true ) {
3050
+ Some ( mt) => { adjusted_ty = mt. ty ; }
3051
+ None => {
3052
+ cx. sess . span_bug (
3053
+ span,
3054
+ fmt ! ( "The %uth autoderef failed: %s" ,
3055
+ i, ty_to_str( cx,
3056
+ adjusted_ty) ) ) ;
3057
+ }
3056
3058
}
3057
3059
}
3058
3060
}
Original file line number Diff line number Diff line change @@ -460,6 +460,10 @@ fn constrain_call(rcx: @mut Rcx,
460
460
debug ! ( "constrain_call(call_expr=%s, implicitly_ref_args=%?)" ,
461
461
call_expr. repr( tcx) , implicitly_ref_args) ;
462
462
let callee_ty = rcx. resolve_node_type ( callee_id) ;
463
+ if ty:: type_is_error ( callee_ty) {
464
+ // Bail, as function type is unknown
465
+ return ;
466
+ }
463
467
let fn_sig = ty:: ty_fn_sig ( callee_ty) ;
464
468
465
469
// `callee_region` is the scope representing the time in which the
@@ -1108,6 +1112,12 @@ pub mod guarantor {
1108
1112
-> ExprCategorizationType {
1109
1113
let mut ct = ct;
1110
1114
let tcx = rcx. fcx . ccx . tcx ;
1115
+
1116
+ if ( ty:: type_is_error ( ct. ty ) ) {
1117
+ ct. cat . pointer = NotPointer ;
1118
+ return ct;
1119
+ }
1120
+
1111
1121
for uint:: range( 0 , autoderefs) |_| {
1112
1122
ct. cat . guarantor = guarantor_of_deref ( & ct. cat ) ;
1113
1123
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
+ // Issue #5062
12
+
13
+ fn main ( ) {
14
+ fmt ! ( "%?" , None ) ; //~ ERROR cannot determine a type for this expression: unconstrained type
15
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2012 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
+ struct S < ' self , T > {
12
+ o : & ' self Option < T >
13
+ }
14
+
15
+ fn main ( ) {
16
+ S { o : & None } ; //~ ERROR cannot determine a type for this expression: unconstrained type
17
+ }
You can’t perform that action at this time.
0 commit comments