1
- - Feature Name: dropck_eyepatch
1
+ - Feature Name: dropck_eyepatch, generic_param_attrs
2
2
- Start Date: 2015-10-19
3
3
- RFC PR: [ rust-lang/rfcs #1327 ] ( https://github.com/rust-lang/rfcs/pull/1327 )
4
4
- Rust Issue: [ rust-lang/rust #34761 ] ( https://github.com/rust-lang/rust/issues/34761 )
@@ -19,6 +19,9 @@ and type paramters). Atop that capability, this RFC proposes adding a
19
19
holds data that must not be accessed during the dynamic extent of that
20
20
` drop ` invocation.
21
21
22
+ As a side-effect, enable adding attributes to the formal declarations
23
+ of generic type and lifetime parameters.
24
+
22
25
[ RFC 1238 ] : https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
23
26
[ RFC 769 ] : https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md
24
27
@@ -140,7 +143,7 @@ storage for [cyclic graph structures][dropck_legal_cycles.rs]).
140
143
1 . Add the ability to attach attributes to syntax that binds formal
141
144
lifetime or type parmeters. For the purposes of this RFC, the only
142
145
place in the syntax that requires such attributes are ` impl `
143
- blocks, as in ` impl Drop for Type { ... } `
146
+ blocks, as in ` impl<T> Drop for Type<T> { ... } `
144
147
145
148
2 . Add a new fine-grained attribute, ` may_dangle ` , which is attached
146
149
to the binding sites for lifetime or type parameters on an ` Drop `
@@ -163,6 +166,8 @@ storage for [cyclic graph structures][dropck_legal_cycles.rs]).
163
166
164
167
This is a simple extension to the syntax.
165
168
169
+ It is guarded by the feature gate ` generic_param_attrs ` .
170
+
166
171
Constructions like the following will now become legal.
167
172
168
173
Example of eyepatch attribute on a single type parameter:
@@ -212,6 +217,8 @@ unsafe impl<'a, X, Y> Drop for Foo<'a, #[may_dangle] X, Y> {
212
217
213
218
Add a new attribute, ` #[may_dangle] ` (the "eyepatch").
214
219
220
+ It is guarded by the feature gate ` dropck_eyepatch ` .
221
+
215
222
The eyepatch is similar to ` unsafe_destructor_blind_to_params ` : it is
216
223
part of the ` Drop ` implementation, and it is meant
217
224
to assert that a destructor is guaranteed not to access certain kinds
@@ -457,10 +464,6 @@ reflected in what he wrote in the [RFC 1238 alternatives][].)
457
464
458
465
## Make dropck "see again" via (focused) where-clauses
459
466
460
- (This alternative carries over some ideas from
461
- [ the previous section] [ blacklist-not-whitelist ] , but it stands well on
462
- its own as something to consider, so I am giving it its own section.)
463
-
464
467
The idea is that we keep the UGEH attribute, blunt hammer that it is.
465
468
You first opt out of the dropck ordering constraints via that, and
466
469
then you add back in ordering constraints via ` where ` clauses.
0 commit comments