2024-05-04 08:58:31 +00:00
|
|
|
//@ revisions: func object clause ok
|
2016-03-22 10:37:12 +00:00
|
|
|
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
|
|
|
trait Foo<'a> {
|
|
|
|
type Item;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> Foo<'a> for() {
|
|
|
|
type Item = ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that appearing in a projection input in the argument is not enough:
|
|
|
|
#[cfg(func)]
|
|
|
|
fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) {
|
2017-01-06 19:35:23 +00:00
|
|
|
//[func]~^ ERROR E0581
|
2016-03-22 10:37:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check that appearing in a projection input in the return still
|
|
|
|
// causes an error:
|
|
|
|
#[cfg(func)]
|
|
|
|
fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
|
2017-01-06 19:35:23 +00:00
|
|
|
//[func]~^ ERROR E0581
|
2016-03-22 10:37:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(object)]
|
2019-05-28 18:46:13 +00:00
|
|
|
fn object1(_: Box<dyn for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
|
2017-01-06 19:35:23 +00:00
|
|
|
//[object]~^ ERROR E0582
|
2016-03-22 10:37:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(object)]
|
2019-05-28 18:46:13 +00:00
|
|
|
fn object2(_: Box<dyn for<'a> Fn() -> <() as Foo<'a>>::Item>) {
|
2017-01-06 19:35:23 +00:00
|
|
|
//[object]~^ ERROR E0582
|
2016-03-22 10:37:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(clause)]
|
|
|
|
fn clause1<T>() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 {
|
|
|
|
//[clause]~^ ERROR `Output` references lifetime `'a`
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(clause)]
|
|
|
|
fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
|
|
|
|
//[clause]~^ ERROR `Output` references lifetime `'a`
|
|
|
|
}
|
|
|
|
|
|
|
|
#[rustc_error]
|
2019-11-05 21:42:23 +00:00
|
|
|
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
|