Add RFC 1238's unsafe_destructor_blind_to_params (UGEH) where needed.
I needed it in `RawVec`, `Vec`, and `TypedArena` for `rustc` to bootstrap; but of course that alone was not sufficient for `make check`. Later I added `unsafe_destructor_blind_to_params` to collections, in particular `LinkedList` and `RawTable` (the backing representation for `HashMap` and `HashSet`), to get the regression tests exercising cyclic structure from PR #27185 building. ---- Note that the feature is `dropck_parametricity` (which is not the same as the attribute's name). We will almost certainly vary our strategy here in the future, so it makes some sense to have a not-as-ugly name for the feature gate. (The attribute name was deliberately selected to be ugly looking.)
This commit is contained in:
parent
9868df2fd5
commit
d778e57bf6
12 changed files with 42 additions and 5 deletions
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#![allow(non_camel_case_types)]
|
||||
|
||||
#![feature(dropck_parametricity)]
|
||||
|
||||
trait UserDefined { }
|
||||
|
||||
impl UserDefined for i32 { }
|
||||
|
|
@ -26,7 +28,10 @@ impl<'a, T> UserDefined for &'a T { }
|
|||
macro_rules! impl_drop {
|
||||
($Bound:ident, $Id:ident) => {
|
||||
struct $Id<T:$Bound>(T);
|
||||
impl <T:$Bound> Drop for $Id<T> { fn drop(&mut self) { } }
|
||||
impl <T:$Bound> Drop for $Id<T> {
|
||||
#[unsafe_destructor_blind_to_params]
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue