Skip to content

Commit e3b3ea4

Browse files
committed
---
yaml --- r: 129790 b: refs/heads/auto c: 2e4a21c h: refs/heads/master v: v3
1 parent f6174b9 commit e3b3ea4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: e3549ee202355731003002e813cf071cd89f04cb
16+
refs/heads/auto: 2e4a21c2c2cc0702044dabf11d0839e4ed65a079
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,12 +2168,13 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
21682168
}
21692169
};
21702170

2171+
let expr_type = fcx.expr_ty(&*iterator_expr);
21712172
let method = method::lookup_in_trait(fcx,
21722173
iterator_expr.span,
21732174
Some(&*iterator_expr),
21742175
token::intern("next"),
21752176
trait_did,
2176-
fcx.expr_ty(&*iterator_expr),
2177+
expr_type,
21772178
[],
21782179
DontAutoderefReceiver,
21792180
IgnoreStaticMethods);
@@ -2184,8 +2185,9 @@ fn lookup_method_for_for_loop(fcx: &FnCtxt,
21842185
Some(ref method) => method.ty,
21852186
None => {
21862187
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());
21892191
ty::mk_err()
21902192
}
21912193
};

branches/auto/src/test/compile-fail/for-loop-bogosity.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ pub fn main() {
2424
x: 1,
2525
y: 2,
2626
};
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
2828
drop(x);
2929
}
3030
}
31-

0 commit comments

Comments
 (0)