mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
drop_tracking_mir: diagnose recursive generator.
This commit is contained in:
parent
0fbfc3e769
commit
0916616fec
@ -1511,6 +1511,14 @@ fn opaque_type_cycle_error(
|
||||
{
|
||||
label_match(interior_ty.ty, interior_ty.span);
|
||||
}
|
||||
if tcx.sess.opts.unstable_opts.drop_tracking_mir
|
||||
&& let DefKind::Generator = tcx.def_kind(closure_def_id)
|
||||
{
|
||||
let generator_layout = tcx.mir_generator_witnesses(closure_def_id);
|
||||
for interior_ty in &generator_layout.field_tys {
|
||||
label_match(interior_ty.ty, interior_ty.source_info.span);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,9 @@ error[E0720]: cannot resolve opaque type
|
||||
|
|
||||
LL | fn generator_hold() -> impl Sized {
|
||||
| ^^^^^^^^^^ recursive opaque type
|
||||
...
|
||||
LL | let x = generator_hold();
|
||||
| - generator captures itself here
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:90:26
|
||||
|
Loading…
Reference in New Issue
Block a user