|
| 1 | +//@ edition:2021 |
| 2 | + |
| 3 | +trait Trait {} |
| 4 | + |
| 5 | +struct IceCream; |
| 6 | + |
| 7 | +impl IceCream { |
| 8 | + fn foo(_: &Trait) {} |
| 9 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 10 | + |
| 11 | + fn bar(self, _: &'a Trait) {} |
| 12 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 13 | + //~| ERROR: use of undeclared lifetime name |
| 14 | + |
| 15 | + fn alice<'a>(&self, _: &Trait) {} |
| 16 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 17 | + |
| 18 | + fn bob<'a>(_: &'a Trait) {} |
| 19 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 20 | + |
| 21 | + fn cat() -> &Trait { |
| 22 | + //~^ ERROR: missing lifetime specifier |
| 23 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 24 | + &Type |
| 25 | + } |
| 26 | + |
| 27 | + fn dog<'a>() -> &Trait { |
| 28 | + //~^ ERROR: missing lifetime specifier |
| 29 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 30 | + &Type |
| 31 | + } |
| 32 | + |
| 33 | + fn kitten() -> &'a Trait { |
| 34 | + //~^ ERROR: use of undeclared lifetime name |
| 35 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 36 | + &Type |
| 37 | + } |
| 38 | + |
| 39 | + fn puppy<'a>() -> &'a Trait { |
| 40 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 41 | + &Type |
| 42 | + } |
| 43 | + |
| 44 | + fn parrot() -> &mut Trait { |
| 45 | + //~^ ERROR: missing lifetime specifier |
| 46 | + //~| ERROR: cannot return a mutable reference to a bare trait |
| 47 | + &mut Type |
| 48 | + //~^ ERROR: cannot return reference to temporary value |
| 49 | + } |
| 50 | +} |
| 51 | + |
| 52 | +trait Sing { |
| 53 | + fn foo(_: &Trait); |
| 54 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 55 | + |
| 56 | + fn bar(_: &'a Trait); |
| 57 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 58 | + //~| ERROR: use of undeclared lifetime name |
| 59 | + |
| 60 | + fn alice<'a>(_: &Trait); |
| 61 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 62 | + |
| 63 | + fn bob<'a>(_: &'a Trait); |
| 64 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 65 | + |
| 66 | + fn cat() -> &Trait; |
| 67 | + //~^ ERROR: missing lifetime specifier |
| 68 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 69 | + |
| 70 | + fn dog<'a>() -> &Trait { |
| 71 | + //~^ ERROR: missing lifetime specifier |
| 72 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 73 | + &Type |
| 74 | + } |
| 75 | + |
| 76 | + fn kitten() -> &'a Trait { |
| 77 | + //~^ ERROR: use of undeclared lifetime name |
| 78 | + //~| ERROR: trait objects must include the `dyn` keyword |
| 79 | + &Type |
| 80 | + } |
| 81 | + |
| 82 | + fn puppy<'a>() -> &'a Trait { |
| 83 | + //~^ ERROR: trait objects must include the `dyn` keyword |
| 84 | + &Type |
| 85 | + } |
| 86 | + |
| 87 | + fn parrot() -> &mut Trait { |
| 88 | + //~^ ERROR: missing lifetime specifier |
| 89 | + //~| ERROR: cannot return a mutable reference to a bare trait |
| 90 | + &mut Type |
| 91 | + //~^ ERROR: cannot return reference to temporary value |
| 92 | + } |
| 93 | +} |
| 94 | + |
| 95 | +fn foo(_: &Trait) {} |
| 96 | +//~^ ERROR: trait objects must include the `dyn` keyword |
| 97 | + |
| 98 | +fn bar(_: &'a Trait) {} |
| 99 | +//~^ ERROR: trait objects must include the `dyn` keyword |
| 100 | +//~| ERROR: use of undeclared lifetime name |
| 101 | + |
| 102 | +fn alice<'a>(_: &Trait) {} |
| 103 | +//~^ ERROR: trait objects must include the `dyn` keyword |
| 104 | + |
| 105 | +fn bob<'a>(_: &'a Trait) {} |
| 106 | +//~^ ERROR: trait objects must include the `dyn` keyword |
| 107 | + |
| 108 | +struct Type; |
| 109 | + |
| 110 | +impl Trait for Type {} |
| 111 | + |
| 112 | +fn cat() -> &Trait { |
| 113 | +//~^ ERROR: missing lifetime specifier |
| 114 | +//~| ERROR: trait objects must include the `dyn` keyword |
| 115 | + &Type |
| 116 | +} |
| 117 | + |
| 118 | +fn dog<'a>() -> &Trait { |
| 119 | +//~^ ERROR: missing lifetime specifier |
| 120 | +//~| ERROR: trait objects must include the `dyn` keyword |
| 121 | + &Type |
| 122 | +} |
| 123 | + |
| 124 | +fn kitten() -> &'a Trait { |
| 125 | +//~^ ERROR: use of undeclared lifetime name |
| 126 | +//~| ERROR: trait objects must include the `dyn` keyword |
| 127 | + &Type |
| 128 | +} |
| 129 | + |
| 130 | +fn puppy<'a>() -> &'a Trait { |
| 131 | +//~^ ERROR: trait objects must include the `dyn` keyword |
| 132 | + &Type |
| 133 | +} |
| 134 | + |
| 135 | +fn parrot() -> &mut Trait { |
| 136 | + //~^ ERROR: missing lifetime specifier |
| 137 | + //~| ERROR: cannot return a mutable reference to a bare trait |
| 138 | + &mut Type |
| 139 | + //~^ ERROR: cannot return reference to temporary value |
| 140 | +} |
| 141 | + |
| 142 | +fn main() {} |
0 commit comments