Gate things properly
This commit is contained in:
@@ -160,7 +160,9 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
|||||||
let mut next_outlives_predicates = vec![];
|
let mut next_outlives_predicates = vec![];
|
||||||
for (pred, constraint_category) in outlives_predicates {
|
for (pred, constraint_category) in outlives_predicates {
|
||||||
// Constraint is implied by a coroutine's well-formedness.
|
// Constraint is implied by a coroutine's well-formedness.
|
||||||
if higher_ranked_assumptions.contains(&pred) {
|
if self.infcx.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
|
||||||
|
&& higher_ranked_assumptions.contains(&pred)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,12 +69,14 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
|
|
||||||
// Filter out any region-region outlives assumptions that are implied by
|
// Filter out any region-region outlives assumptions that are implied by
|
||||||
// coroutine well-formedness.
|
// coroutine well-formedness.
|
||||||
|
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions {
|
||||||
storage.data.constraints.retain(|(constraint, _)| match *constraint {
|
storage.data.constraints.retain(|(constraint, _)| match *constraint {
|
||||||
Constraint::RegSubReg(r1, r2) => !outlives_env
|
Constraint::RegSubReg(r1, r2) => !outlives_env
|
||||||
.higher_ranked_assumptions()
|
.higher_ranked_assumptions()
|
||||||
.contains(&ty::OutlivesPredicate(r2.into(), r1)),
|
.contains(&ty::OutlivesPredicate(r2.into(), r1)),
|
||||||
_ => true,
|
_ => true,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let region_rels = &RegionRelations::new(self.tcx, outlives_env.free_region_map());
|
let region_rels = &RegionRelations::new(self.tcx, outlives_env.free_region_map());
|
||||||
|
|
||||||
|
|||||||
@@ -235,7 +235,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
let (sup_type, sub_region) =
|
let (sup_type, sub_region) =
|
||||||
(sup_type, sub_region).fold_with(&mut OpportunisticRegionResolver::new(self));
|
(sup_type, sub_region).fold_with(&mut OpportunisticRegionResolver::new(self));
|
||||||
|
|
||||||
if outlives_env
|
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
|
||||||
|
&& outlives_env
|
||||||
.higher_ranked_assumptions()
|
.higher_ranked_assumptions()
|
||||||
.contains(&ty::OutlivesPredicate(sup_type.into(), sub_region))
|
.contains(&ty::OutlivesPredicate(sup_type.into(), sub_region))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2256,6 +2256,8 @@ options! {
|
|||||||
environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)"),
|
environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)"),
|
||||||
has_thread_local: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
has_thread_local: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||||
"explicitly enable the `cfg(target_thread_local)` directive"),
|
"explicitly enable the `cfg(target_thread_local)` directive"),
|
||||||
|
higher_ranked_assumptions: bool = (false, parse_bool, [TRACKED],
|
||||||
|
"allow deducing higher-ranked outlives assumptions from coroutines when proving auto traits"),
|
||||||
hint_mostly_unused: bool = (false, parse_bool, [TRACKED],
|
hint_mostly_unused: bool = (false, parse_bool, [TRACKED],
|
||||||
"hint that most of this crate will go unused, to minimize work for uncalled functions"),
|
"hint that most of this crate will go unused, to minimize work for uncalled functions"),
|
||||||
human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
|
human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
error: implementation of `FnOnce` is not general enough
|
||||||
|
--> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5
|
||||||
|
|
|
||||||
|
LL | / send(async {
|
||||||
|
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||||
|
LL | | });
|
||||||
|
| |______^ implementation of `FnOnce` is not general enough
|
||||||
|
|
|
||||||
|
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
|
||||||
|
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||||
|
|
||||||
|
error: implementation of `FnOnce` is not general enough
|
||||||
|
--> $DIR/drop-tracking-unresolved-typeck-results.rs:102:5
|
||||||
|
|
|
||||||
|
LL | / send(async {
|
||||||
|
LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrdered(PhantomData), 0)).await
|
||||||
|
LL | | });
|
||||||
|
| |______^ implementation of `FnOnce` is not general enough
|
||||||
|
|
|
||||||
|
= note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`...
|
||||||
|
= note: ...but it actually implements `FnOnce<(&(),)>`
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
//@ incremental
|
//@ incremental
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ check-pass
|
//@ revisions: assumptions no_assumptions
|
||||||
|
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
|
||||||
|
//@[assumptions] check-pass
|
||||||
|
//@[no_assumptions] known-bug: #110338
|
||||||
|
|
||||||
use std::future::*;
|
use std::future::*;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
error: implementation of `Send` is not general enough
|
||||||
|
--> $DIR/issue-110963-early.rs:17:5
|
||||||
|
|
|
||||||
|
LL | / spawn(async move {
|
||||||
|
LL | | let mut hc = hc;
|
||||||
|
LL | | if !hc.check().await {
|
||||||
|
LL | | log_health_check_failure().await;
|
||||||
|
LL | | }
|
||||||
|
LL | | });
|
||||||
|
| |______^ implementation of `Send` is not general enough
|
||||||
|
|
|
||||||
|
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
|
||||||
|
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
|
||||||
|
|
||||||
|
error: implementation of `Send` is not general enough
|
||||||
|
--> $DIR/issue-110963-early.rs:17:5
|
||||||
|
|
|
||||||
|
LL | / spawn(async move {
|
||||||
|
LL | | let mut hc = hc;
|
||||||
|
LL | | if !hc.check().await {
|
||||||
|
LL | | log_health_check_failure().await;
|
||||||
|
LL | | }
|
||||||
|
LL | | });
|
||||||
|
| |______^ implementation of `Send` is not general enough
|
||||||
|
|
|
||||||
|
= note: `Send` would have to be implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'0>(..) }`, for any two lifetimes `'0` and `'1`...
|
||||||
|
= note: ...but `Send` is actually implemented for the type `impl Future<Output = bool> { <HC as HealthCheck>::check<'2>(..) }`, for some specific lifetime `'2`
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
//@ check-pass
|
//@ revisions: assumptions no_assumptions
|
||||||
|
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
|
||||||
|
//@[assumptions] check-pass
|
||||||
|
//@[no_assumptions] known-bug: #110338
|
||||||
|
|
||||||
#![feature(return_type_notation)]
|
#![feature(return_type_notation)]
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
error: lifetime bound not satisfied
|
||||||
|
--> $DIR/higher-ranked-coroutine-param-outlives-2.rs:14:5
|
||||||
|
|
|
||||||
|
LL | / async { // a coroutine checked for autotrait impl `Send`
|
||||||
|
LL | | let x = None::<I::Future<'_, '_>>; // a type referencing GAT
|
||||||
|
LL | | async {}.await; // a yield point
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
|
||||||
|
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||||
|
|
||||||
|
error: lifetime bound not satisfied
|
||||||
|
--> $DIR/higher-ranked-coroutine-param-outlives-2.rs:21:5
|
||||||
|
|
|
||||||
|
LL | / async { // a coroutine checked for autotrait impl `Send`
|
||||||
|
LL | | let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
|
||||||
|
LL | | async {}.await; // a yield point
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
|
||||||
|
= note: this is a known limitation that will be removed in the future (see issue #100013 <https://github.com/rust-lang/rust/issues/100013> for more information)
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
//@ check-pass
|
|
||||||
//@ edition: 2021
|
//@ edition: 2021
|
||||||
|
//@ revisions: assumptions no_assumptions
|
||||||
|
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
|
||||||
|
//@[assumptions] check-pass
|
||||||
|
//@[no_assumptions] known-bug: #110338
|
||||||
|
|
||||||
pub trait FutureIterator {
|
pub trait FutureIterator {
|
||||||
type Future<'s, 'cx>: Send
|
type Future<'s, 'cx>: Send
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
error: `C` does not live long enough
|
||||||
|
--> $DIR/higher-ranked-coroutine-param-outlives.rs:21:5
|
||||||
|
|
|
||||||
|
LL | async move { c.connect().await }
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
//@ edition:2018
|
//@ edition:2018
|
||||||
//@ check-pass
|
//@ revisions: assumptions no_assumptions
|
||||||
|
//@[assumptions] compile-flags: -Zhigher-ranked-assumptions
|
||||||
|
//@[assumptions] check-pass
|
||||||
|
//@[no_assumptions] known-bug: #110338
|
||||||
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user