Commit 4b869bf
committed
Auto merge of #141465 - RalfJung:target-feature-in-trait, r=<try>
forbid #[target_feature] in traits
`target_feature` in trait *implementations* makes basically no sense -- it's almost always unsound since a generic caller has no way of knowing the required target features! In particular, now that we can have *safe* target feature functions, that's *definitely* unsound in combination with `dyn`, see #139368.
As sound version of this would have to check that the same target features are already set in the trait declaration. But only functions with bodies can even have target features in the trait declaration!
So, this was never actually designed in a way that makes any sense, it just kinda did something. Interestingly there were tests for `#[target_feature]` in traits and trait impls... not sure how that didn't set off alarm bells. Oh well.
I propose we just entirely forbid target features in trait impls and trait declarations. This will need an FCW, but before we do that let's get an idea for how big the fallout is by doing a crater run. The diagnostics that result from PR are terrible but it's good enough for crater.File tree
7 files changed
+41
-103
lines changed- compiler/rustc_passes/src
- tests/ui
- rfcs/rfc-2396-target_feature-11
- target-feature
7 files changed
+41
-103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
861 | 861 | | |
862 | 862 | | |
863 | 863 | | |
864 | | - | |
865 | | - | |
| 864 | + | |
866 | 865 | | |
867 | 866 | | |
868 | 867 | | |
| |||
This file was deleted.
Lines changed: 0 additions & 35 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 93 | | |
106 | 94 | | |
107 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 181 | + | |
205 | 182 | | |
206 | | - | |
207 | | - | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments