Skip to content

Commit 1309088

Browse files
committed
Disable drop range tracking in generators
Generator drop tracking caused an ICE for generators involving the Never type (Issue #93161). Since this breaks miri, we temporarily disable drop tracking so miri is unblocked while we properly fix the issue.
1 parent 84e9189 commit 1309088

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

compiler/rustc_typeck/src/check/generator_interior.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ use tracing::debug;
2222

2323
mod drop_ranges;
2424

25+
// FIXME(eholk): This flag is here to give a quick way to disable drop tracking in case we find
26+
// unexpected breakages while it's still new. It should be removed before too long.
27+
const ENABLE_DROP_TRACKING: bool = false;
28+
2529
struct InteriorVisitor<'a, 'tcx> {
2630
fcx: &'a FnCtxt<'a, 'tcx>,
2731
types: FxIndexSet<ty::GeneratorInteriorTypeCause<'tcx>>,
@@ -77,7 +81,10 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
7781
yield_data.expr_and_pat_count, self.expr_count, source_span
7882
);
7983

80-
if self.drop_ranges.is_dropped_at(hir_id, yield_data.expr_and_pat_count)
84+
if ENABLE_DROP_TRACKING
85+
&& self
86+
.drop_ranges
87+
.is_dropped_at(hir_id, yield_data.expr_and_pat_count)
8188
{
8289
debug!("value is dropped at yield point; not recording");
8390
return false;

src/test/ui/async-await/async-fn-nonsend.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// edition:2018
22
// compile-flags: --crate-type lib
33

4+
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
5+
// (see generator_interior.rs:27)
6+
// ignore-test
7+
48
use std::{cell::RefCell, fmt::Debug, rc::Rc};
59

610
fn non_sync() -> impl Debug {

src/test/ui/async-await/unresolved_type_param.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// (rather than give a general error message)
44
// edition:2018
55

6+
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
7+
// (see generator_interior.rs:27)
8+
// ignore-test
9+
610
async fn bar<T>() -> () {}
711

812
async fn foo() {

src/test/ui/generator/drop-control-flow.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// build-pass
22

3+
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
4+
// (see generator_interior.rs:27)
5+
// ignore-test
6+
37
// A test to ensure generators capture values that were conditionally dropped,
48
// and also that values that are dropped along all paths to a yield do not get
59
// included in the generator type.

src/test/ui/generator/issue-57478.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// check-pass
22

3+
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
4+
// (see generator_interior.rs:27)
5+
// ignore-test
6+
37
#![feature(negative_impls, generators)]
48

59
struct Foo;

src/test/ui/generator/partial-drop.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
2+
// (see generator_interior.rs:27)
3+
// ignore-test
4+
15
#![feature(negative_impls, generators)]
26

37
struct Foo;

0 commit comments

Comments
 (0)