Skip to content

Commit

Permalink
Merge branch 'dropck-eyepatch' of github.com:pnkfelix/rfcs into dropc…
Browse files Browse the repository at this point in the history
…k-eyepatch
  • Loading branch information
pnkfelix committed Jul 11, 2016
2 parents 82afb34 + ef11dc0 commit 8e8fc34
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions text/1327-dropck-param-eyepatch.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Feature Name: dropck_eyepatch
- Feature Name: dropck_eyepatch, generic_param_attrs
- Start Date: 2015-10-19
- RFC PR: [rust-lang/rfcs#1327](https://github.com/rust-lang/rfcs/pull/1327)
- Rust Issue: [rust-lang/rust#34761](https://github.com/rust-lang/rust/issues/34761)
Expand All @@ -19,6 +19,9 @@ and type paramters). Atop that capability, this RFC proposes adding a
holds data that must not be accessed during the dynamic extent of that
`drop` invocation.

As a side-effect, enable adding attributes to the formal declarations
of generic type and lifetime parameters.

[RFC 1238]: https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
[RFC 769]: https://github.com/rust-lang/rfcs/blob/master/text/0769-sound-generic-drop.md

Expand Down Expand Up @@ -140,7 +143,7 @@ storage for [cyclic graph structures][dropck_legal_cycles.rs]).
1. Add the ability to attach attributes to syntax that binds formal
lifetime or type parmeters. For the purposes of this RFC, the only
place in the syntax that requires such attributes are `impl`
blocks, as in `impl Drop for Type { ... }`
blocks, as in `impl<T> Drop for Type<T> { ... }`

2. Add a new fine-grained attribute, `may_dangle`, which is attached
to the binding sites for lifetime or type parameters on an `Drop`
Expand All @@ -163,6 +166,8 @@ storage for [cyclic graph structures][dropck_legal_cycles.rs]).

This is a simple extension to the syntax.

It is guarded by the feature gate `generic_param_attrs`.

Constructions like the following will now become legal.

Example of eyepatch attribute on a single type parameter:
Expand Down Expand Up @@ -212,6 +217,8 @@ unsafe impl<'a, X, Y> Drop for Foo<'a, #[may_dangle] X, Y> {

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

It is guarded by the feature gate `dropck_eyepatch`.

The eyepatch is similar to `unsafe_destructor_blind_to_params`: it is
part of the `Drop` implementation, and it is meant
to assert that a destructor is guaranteed not to access certain kinds
Expand Down Expand Up @@ -457,10 +464,6 @@ reflected in what he wrote in the [RFC 1238 alternatives][].)

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

(This alternative carries over some ideas from
[the previous section][blacklist-not-whitelist], but it stands well on
its own as something to consider, so I am giving it its own section.)

The idea is that we keep the UGEH attribute, blunt hammer that it is.
You first opt out of the dropck ordering constraints via that, and
then you add back in ordering constraints via `where` clauses.
Expand Down

0 comments on commit 8e8fc34

Please sign in to comment.