mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
14d56e8338
Most of these changes either add revision names that were apparently missing, or explicitly mark a revision name as currently unused.
49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
//@ revisions: func object clause ok
|
|
|
|
#![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) {
|
|
//[func]~^ ERROR E0581
|
|
}
|
|
|
|
// 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) {
|
|
//[func]~^ ERROR E0581
|
|
}
|
|
|
|
#[cfg(object)]
|
|
fn object1(_: Box<dyn for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
|
|
//[object]~^ ERROR E0582
|
|
}
|
|
|
|
#[cfg(object)]
|
|
fn object2(_: Box<dyn for<'a> Fn() -> <() as Foo<'a>>::Item>) {
|
|
//[object]~^ ERROR E0582
|
|
}
|
|
|
|
#[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]
|
|
fn main() { } //[ok]~ ERROR fatal error triggered by #[rustc_error]
|