mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Don't ICE in check_must_not_suspend_ty for mismatched tuple arity
This commit is contained in:
parent
984eab57f7
commit
4042f55079
@ -607,10 +607,7 @@ fn check_must_not_suspend_ty<'tcx>(
|
||||
ty::Tuple(fields) => {
|
||||
let mut has_emitted = false;
|
||||
let comps = match data.expr.map(|e| &e.kind) {
|
||||
Some(hir::ExprKind::Tup(comps)) => {
|
||||
debug_assert_eq!(comps.len(), fields.len());
|
||||
Some(comps)
|
||||
}
|
||||
Some(hir::ExprKind::Tup(comps)) if comps.len() == fields.len() => Some(comps),
|
||||
_ => None,
|
||||
};
|
||||
for (i, ty) in fields.iter().enumerate() {
|
||||
|
9
src/test/ui/lint/must_not_suspend/tuple-mismatch.rs
Normal file
9
src/test/ui/lint/must_not_suspend/tuple-mismatch.rs
Normal file
@ -0,0 +1,9 @@
|
||||
#![feature(generators)]
|
||||
|
||||
fn main() {
|
||||
let _generator = || {
|
||||
yield ((), ((), ()));
|
||||
yield ((), ());
|
||||
//~^ ERROR mismatched types
|
||||
};
|
||||
}
|
12
src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr
Normal file
12
src/test/ui/lint/must_not_suspend/tuple-mismatch.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/tuple-mismatch.rs:6:20
|
||||
|
|
||||
LL | yield ((), ());
|
||||
| ^^ expected tuple, found `()`
|
||||
|
|
||||
= note: expected tuple `((), ())`
|
||||
found unit type `()`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user