feature-gate member constraints outside of async-await

Minimizes risk.
This commit is contained in:
Niko Matsakis 2019-06-20 10:44:20 -04:00
parent cbc75c699c
commit 74a6efbf00
18 changed files with 147 additions and 7 deletions

View file

@ -0,0 +1,9 @@
trait Trait<'a, 'b> { }
impl<T> Trait<'_, '_> for T {}
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
//~^ ERROR ambiguous lifetime bound
(x, y)
}
fn main() { }

View file

@ -0,0 +1,10 @@
error: ambiguous lifetime bound in `impl Trait`
--> $DIR/feature-gate-member-constraints.rs:4:43
|
LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
| ^^^^^^^^^^^^^^^^^^ neither `'a` nor `'b` outlives the other
|
= help: add #![feature(member_constraints)] to the crate attributes to enable
error: aborting due to previous error

View file

@ -1,5 +1,6 @@
// compile-flags:-Zborrowck=mir
#![feature(member_constraints)]
#![feature(existential_type)]
#[derive(Clone)]

View file

@ -1,5 +1,5 @@
error: lifetime may not live long enough
--> $DIR/error-handling.rs:12:56
--> $DIR/error-handling.rs:13:56
|
LL | fn foo<'a, 'b, 'c>(x: &'static i32, mut y: &'a i32) -> E<'b, 'c> {
| -- lifetime `'a` defined here ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`

View file

@ -3,6 +3,8 @@
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(member_constraints)]
trait Trait<'a, 'b> {}
impl<T> Trait<'_, '_> for T {}

View file

@ -3,6 +3,8 @@
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(member_constraints)]
trait Trait<'a, 'b> { }
impl<T> Trait<'_, '_> for T { }

View file

@ -3,6 +3,7 @@
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(member_constraints)]
#![feature(existential_type)]
trait Trait<'a, 'b> { }

View file

@ -3,6 +3,8 @@
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(member_constraints)]
trait Trait<'a, 'b> { }
impl<T> Trait<'_, '_> for T { }

View file

@ -3,6 +3,8 @@
// revisions: migrate mir
//[mir]compile-flags: -Z borrowck=mir
#![feature(member_constraints)]
trait Trait<'a, 'b> {}
impl<T> Trait<'_, '_> for T {}

View file

@ -1,5 +1,7 @@
// edition:2018
#![feature(member_constraints)]
trait Trait<'a, 'b> {}
impl<T> Trait<'_, '_> for T {}

View file

@ -1,11 +1,11 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ordinary-bounds-unrelated.rs:16:74
--> $DIR/ordinary-bounds-unrelated.rs:18:74
|
LL | fn upper_bounds<'a, 'b, 'c, 'd, 'e>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'d, 'e>
| ^^^^^^^^^^^^^^^^^^
|
note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 21:1
--> $DIR/ordinary-bounds-unrelated.rs:21:1
note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 23:1
--> $DIR/ordinary-bounds-unrelated.rs:23:1
|
LL | / {
LL | | // Hidden type `Ordinary<'0>` with constraints:

View file

@ -1,5 +1,7 @@
// edition:2018
#![feature(member_constraints)]
trait Trait<'a, 'b> {}
impl<T> Trait<'_, '_> for T {}

View file

@ -1,11 +1,11 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ordinary-bounds-unsuited.rs:18:62
--> $DIR/ordinary-bounds-unsuited.rs:20:62
|
LL | fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b>
| ^^^^^^^^^^^^^^^^^^
|
note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 20:1
--> $DIR/ordinary-bounds-unsuited.rs:20:1
note: hidden type `Ordinary<'_>` captures the scope of call-site for function at 22:1
--> $DIR/ordinary-bounds-unsuited.rs:22:1
|
LL | / {
LL | | // We return a value:

View file

@ -1,5 +1,7 @@
// run-pass
#![feature(member_constraints)]
use std::fmt::Debug;
trait MultiRegionTrait<'a, 'b> {}