|
| 1 | +// Test for #124423, which causes an ice bug |
| 2 | +// |
| 3 | +//@ compile-flags: -Z threads=16 |
| 4 | +//@ check-fail |
| 5 | +//@ parallel-front-end |
| 6 | + |
| 7 | +use std::fmt::Debug; |
| 8 | + |
| 9 | +fn elided(_: &impl Copy + 'a) -> _ { x } |
| 10 | +//~^ ERROR ambiguous `+` in a type |
| 11 | +//~| ERROR use of undeclared lifetime name `'a` |
| 12 | +//~| ERROR the placeholder `_` is not allowed within types on item signatures for return types |
| 13 | + |
| 14 | +fn explicit<'b>(_: &'a impl Copy + 'a) -> impl 'a { x } |
| 15 | +//~^ ERROR ambiguous `+` in a type |
| 16 | +//~| ERROR at least one trait must be specified |
| 17 | +//~| ERROR use of undeclared lifetime name `'a` |
| 18 | +//~| ERROR use of undeclared lifetime name `'a` |
| 19 | +//~| ERROR use of undeclared lifetime name `'a` |
| 20 | + |
| 21 | +fn elided2( impl 'b) -> impl 'a + 'a { x } |
| 22 | +//~^ ERROR expected one of `:` or `|`, found `'b` |
| 23 | +//~| ERROR expected identifier, found keyword `impl` |
| 24 | +//~| ERROR at least one trait must be specified |
| 25 | +//~| ERROR use of undeclared lifetime name `'a` |
| 26 | +//~| ERROR use of undeclared lifetime name `'a` |
| 27 | + |
| 28 | +fn explicit2<'a>(_: &'a impl Copy + 'a) -> impl Copy + 'a { x } |
| 29 | +//~^ ERROR ambiguous `+` in a type |
| 30 | + |
| 31 | +fn foo<'a>(_: &impl Copy + 'a) -> impl 'b + 'a { x } |
| 32 | +//~^ ERROR ambiguous `+` in a type |
| 33 | +//~| ERROR at least one trait must be specified |
| 34 | +//~| ERROR use of undeclared lifetime name `'b` |
| 35 | + |
| 36 | +fn elided3(_: &impl Copy + 'a) -> Box<dyn 'a> { Box::new(x) } |
| 37 | +//~^ ERROR ambiguous `+` in a type |
| 38 | +//~| ERROR use of undeclared lifetime name `'a` |
| 39 | +//~| ERROR use of undeclared lifetime name `'a` |
| 40 | +//~| ERROR at least one trait is required for an object type |
| 41 | + |
| 42 | +fn x<'b>(_: &'a impl Copy + 'a) -> Box<dyn 'b> { Box::u32(x) } |
| 43 | +//~^ ERROR ambiguous `+` in a type |
| 44 | +//~| ERROR use of undeclared lifetime name `'a` |
| 45 | +//~| ERROR use of undeclared lifetime name `'a` |
| 46 | +//~| ERROR at least one trait is required for an object type |
| 47 | +//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope |
| 48 | + |
| 49 | +fn elided4(_: &impl Copy + 'a) -> new { x(x) } |
| 50 | +//~^ ERROR ambiguous `+` in a type |
| 51 | +//~| ERROR use of undeclared lifetime name `'a` |
| 52 | +//~| ERROR cannot find type `new` in this scope |
| 53 | + |
| 54 | +trait LifetimeTrait<'a> {} |
| 55 | + |
| 56 | +impl<'a> LifetimeTrait<'a> for &'a Box<dyn 'a> {} |
| 57 | +//~^ ERROR at least one trait is required for an object type |
| 58 | + |
| 59 | +fn main() {} |
0 commit comments