File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
librustc/middle/typeck/check Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
13
13
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
14
14
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
15
15
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16
- refs/heads/auto: e3549ee202355731003002e813cf071cd89f04cb
16
+ refs/heads/auto: 2e4a21c2c2cc0702044dabf11d0839e4ed65a079
17
17
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
18
18
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
19
19
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
Original file line number Diff line number Diff line change @@ -2168,12 +2168,13 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
2168
2168
}
2169
2169
} ;
2170
2170
2171
+ let expr_type = fcx. expr_ty( & * iterator_expr) ;
2171
2172
let method = method:: lookup_in_trait( fcx,
2172
2173
iterator_expr. span,
2173
2174
Some ( & * iterator_expr) ,
2174
2175
token:: intern( "next" ) ,
2175
2176
trait_did,
2176
- fcx . expr_ty ( & * iterator_expr ) ,
2177
+ expr_type ,
2177
2178
[ ] ,
2178
2179
DontAutoderefReceiver ,
2179
2180
IgnoreStaticMethods ) ;
@@ -2184,8 +2185,9 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
2184
2185
Some ( ref method) => method. ty,
2185
2186
None => {
2186
2187
fcx. tcx( ) . sess. span_err( iterator_expr. span,
2187
- "`for` loop expression does not \
2188
- implement the `Iterator` trait") ;
2188
+ format ! ( "`for` loop expression has type `{}` which does \
2189
+ not implement the `Iterator` trait",
2190
+ fcx. infcx( ) . ty_to_string( expr_type) ) . as_slice( ) ) ;
2189
2191
ty:: mk_err( )
2190
2192
}
2191
2193
} ;
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ pub fn main() {
24
24
x : 1 ,
25
25
y : 2 ,
26
26
} ;
27
- for x in bogus { //~ ERROR does not implement the `Iterator` trait
27
+ for x in bogus { //~ ERROR has type `MyStruct` which does not implement the `Iterator` trait
28
28
drop ( x) ;
29
29
}
30
30
}
31
-
You can’t perform that action at this time.
0 commit comments