tests H.R. T: 'a bounds proving themselves

This commit is contained in:
Niko Matsakis 2022-06-15 11:02:46 -04:00
parent ad25ee09c7
commit b39ba21fcb
3 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,18 @@
// Test that we consider `for<'a> &'a T: 'a` to be sufficient to prove
// that `for<'a> &'a T: 'a`.
//
// FIXME. Except we don't!
#![allow(warnings)]
fn self_wf2<T>()
where
for<'a> &'a T: 'a,
{
self_wf2::<T>();
//~^ ERROR `T` does not live long enough
//
// FIXME. This ought to be accepted, presumably.
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: `T` does not live long enough
--> $DIR/forall-wf-ref-reflexive.rs:12:5
|
LL | self_wf2::<T>();
| ^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -0,0 +1,15 @@
// Test that we consider `for<'a> T: 'a` to be sufficient to prove
// that `for<'a> T: 'a`.
//
// check-pass
#![allow(warnings)]
fn self_wf1<T>()
where
for<'a> T: 'a,
{
self_wf1::<T>();
}
fn main() {}