1
Fork 0

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.
This commit is contained in:
Eric Holk 2022-01-21 09:36:24 -08:00
parent 84e918971d
commit 13090889f5
6 changed files with 28 additions and 1 deletions

View file

@ -22,6 +22,10 @@ use tracing::debug;
mod drop_ranges;
// FIXME(eholk): This flag is here to give a quick way to disable drop tracking in case we find
// unexpected breakages while it's still new. It should be removed before too long.
const ENABLE_DROP_TRACKING: bool = false;
struct InteriorVisitor<'a, 'tcx> {
fcx: &'a FnCtxt<'a, 'tcx>,
types: FxIndexSet<ty::GeneratorInteriorTypeCause<'tcx>>,
@ -77,7 +81,10 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
yield_data.expr_and_pat_count, self.expr_count, source_span
);
if self.drop_ranges.is_dropped_at(hir_id, yield_data.expr_and_pat_count)
if ENABLE_DROP_TRACKING
&& self
.drop_ranges
.is_dropped_at(hir_id, yield_data.expr_and_pat_count)
{
debug!("value is dropped at yield point; not recording");
return false;

View file

@ -1,6 +1,10 @@
// edition:2018
// compile-flags: --crate-type lib
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
// (see generator_interior.rs:27)
// ignore-test
use std::{cell::RefCell, fmt::Debug, rc::Rc};
fn non_sync() -> impl Debug {

View file

@ -3,6 +3,10 @@
// (rather than give a general error message)
// edition:2018
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
// (see generator_interior.rs:27)
// ignore-test
async fn bar<T>() -> () {}
async fn foo() {

View file

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

View file

@ -1,5 +1,9 @@
// check-pass
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
// (see generator_interior.rs:27)
// ignore-test
#![feature(negative_impls, generators)]
struct Foo;

View file

@ -1,3 +1,7 @@
// FIXME(eholk): temporarily disabled while drop range tracking is disabled
// (see generator_interior.rs:27)
// ignore-test
#![feature(negative_impls, generators)]
struct Foo;