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