Skip to content

Commit 8e8fc34

Browse files
committed
Merge branch 'dropck-eyepatch' of github.com:pnkfelix/rfcs into dropck-eyepatch
2 parents 82afb34 + ef11dc0 commit 8e8fc34

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

text/1327-dropck-param-eyepatch.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- Feature Name: dropck_eyepatch
1+
- Feature Name: dropck_eyepatch, generic_param_attrs
22
- Start Date: 2015-10-19
33
- RFC PR: [rust-lang/rfcs#1327](https://github.com/rust-lang/rfcs/pull/1327)
44
- 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
1919
holds data that must not be accessed during the dynamic extent of that
2020
`drop` invocation.
2121

22+
As a side-effect, enable adding attributes to the formal declarations
23+
of generic type and lifetime parameters.
24+
2225
[RFC 1238]: https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
2326
[RFC 769]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md
2427

@@ -140,7 +143,7 @@ storage for [cyclic graph structures][dropck_legal_cycles.rs]).
140143
1. Add the ability to attach attributes to syntax that binds formal
141144
lifetime or type parmeters. For the purposes of this RFC, the only
142145
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> { ... }`
144147

145148
2. Add a new fine-grained attribute, `may_dangle`, which is attached
146149
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]).
163166

164167
This is a simple extension to the syntax.
165168

169+
It is guarded by the feature gate `generic_param_attrs`.
170+
166171
Constructions like the following will now become legal.
167172

168173
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> {
212217

213218
Add a new attribute, `#[may_dangle]` (the "eyepatch").
214219

220+
It is guarded by the feature gate `dropck_eyepatch`.
221+
215222
The eyepatch is similar to `unsafe_destructor_blind_to_params`: it is
216223
part of the `Drop` implementation, and it is meant
217224
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][].)
457464

458465
## Make dropck "see again" via (focused) where-clauses
459466

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-
464467
The idea is that we keep the UGEH attribute, blunt hammer that it is.
465468
You first opt out of the dropck ordering constraints via that, and
466469
then you add back in ordering constraints via `where` clauses.

0 commit comments

Comments
 (0)