about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2019-07-11 18:44:56 +0000
committerLzu Tao <taolzu@gmail.com>2019-07-11 18:44:56 +0000
commit8347917dd955e40c813867e0fddb52c3adb4711c (patch)
tree811108295d938030b6085dc63085739a7f30a922
parentab3adf380d09005e2deea002ac172135a5c158f0 (diff)
downloadrust-8347917dd955e40c813867e0fddb52c3adb4711c.tar.gz
rust-8347917dd955e40c813867e0fddb52c3adb4711c.zip
Remove feature gate `dropck_parametricity` completely
Therefore we also remove `#[unsafe_destructor_blind_to_params]`
attribute completly.
-rw-r--r--src/librustc/ty/util.rs15
-rw-r--r--src/librustc_typeck/check/dropck.rs4
-rw-r--r--src/librustdoc/html/render.rs1
-rw-r--r--src/libsyntax/feature_gate.rs14
-rw-r--r--src/libsyntax_pos/symbol.rs1
-rw-r--r--src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs3
-rw-r--r--src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs5
-rw-r--r--src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs5
-rw-r--r--src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs12
-rw-r--r--src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr14
-rw-r--r--src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs29
-rw-r--r--src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr20
-rw-r--r--src/test/ui/span/issue28498-reject-lifetime-param.rs5
-rw-r--r--src/test/ui/span/issue28498-reject-lifetime-param.stderr2
-rw-r--r--src/test/ui/span/issue28498-reject-passed-to-fn.rs3
-rw-r--r--src/test/ui/span/issue28498-reject-passed-to-fn.stderr2
-rw-r--r--src/test/ui/span/issue28498-reject-trait-bound.rs5
-rw-r--r--src/test/ui/span/issue28498-reject-trait-bound.stderr2
18 files changed, 17 insertions, 125 deletions
diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs
index a3b99f143d0..56cb89b5144 100644
--- a/src/librustc/ty/util.rs
+++ b/src/librustc/ty/util.rs
@@ -22,7 +22,6 @@ use rustc_macros::HashStable;
 use std::{cmp, fmt};
 use syntax::ast;
 use syntax::attr::{self, SignedInt, UnsignedInt};
-use syntax::symbol::sym;
 use syntax_pos::{Span, DUMMY_SP};
 
 #[derive(Copy, Clone, Debug)]
@@ -435,20 +434,6 @@ impl<'tcx> TyCtxt<'tcx> {
             Some(dtor) => dtor.did
         };
 
-        // RFC 1238: if the destructor method is tagged with the
-        // attribute `unsafe_destructor_blind_to_params`, then the
-        // compiler is being instructed to *assume* that the
-        // destructor will not access borrowed data,
-        // even if such data is otherwise reachable.
-        //
-        // Such access can be in plain sight (e.g., dereferencing
-        // `*foo.0` of `Foo<'a>(&'a u32)`) or indirectly hidden
-        // (e.g., calling `foo.0.clone()` of `Foo<T:Clone>`).
-        if self.has_attr(dtor, sym::unsafe_destructor_blind_to_params) {
-            debug!("destructor_constraint({:?}) - blind", def.did);
-            return vec![];
-        }
-
         let impl_def_id = self.associated_item(dtor).container.id();
         let impl_generics = self.generics_of(impl_def_id);
 
diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs
index c4c4e10a14c..babffe479bc 100644
--- a/src/librustc_typeck/check/dropck.rs
+++ b/src/librustc_typeck/check/dropck.rs
@@ -246,7 +246,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
 ///
 /// * (1.) `D` has a lifetime- or type-parametric Drop implementation,
 ///        (where that `Drop` implementation does not opt-out of
-///         this check via the `unsafe_destructor_blind_to_params`
+///         this check via the `may_dangle`
 ///         attribute), and
 /// * (2.) the structure of `D` can reach a reference of type `&'a _`,
 ///
@@ -279,7 +279,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
 /// instead Drop-Check now simply assumes that if a destructor has
 /// access (direct or indirect) to a lifetime parameter, then that
 /// lifetime must be forced to outlive that destructor's dynamic
-/// extent. We then provide the `unsafe_destructor_blind_to_params`
+/// extent. We then provide the `may_dangle`
 /// attribute as a way for destructor implementations to opt-out of
 /// this conservative assumption (and thus assume the obligation of
 /// ensuring that they do not access data nor invoke methods of
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 5c6847b4141..3cd520fd4b5 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -3809,7 +3809,6 @@ const ATTRIBUTE_WHITELIST: &'static [Symbol] = &[
     sym::must_use,
     sym::no_mangle,
     sym::repr,
-    sym::unsafe_destructor_blind_to_params,
     sym::non_exhaustive
 ];
 
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 84a012f03c9..e3628d908fb 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -199,9 +199,6 @@ declare_features! (
 
     // no-tracking-issue-end
 
-    // Allows using `#[unsafe_destructor_blind_to_params]` (RFC 1238).
-    (active, dropck_parametricity, "1.3.0", Some(28498), None),
-
     // no-tracking-issue-start
 
     // Allows using `#[omit_gdb_pretty_printer_section]`.
@@ -641,6 +638,8 @@ declare_features! (
     (removed, extern_in_paths, "1.33.0", Some(55600), None,
      Some("subsumed by `::foo::bar` paths")),
     (removed, quote, "1.33.0", Some(29601), None, None),
+    // Allows using `#[unsafe_destructor_blind_to_params]` (RFC 1238).
+    (removed, dropck_parametricity, "1.38.0", Some(28498), None, None),
 
     // -------------------------------------------------------------------------
     // feature-group-end: removed features
@@ -1447,15 +1446,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
             cfg_fn!(omit_gdb_pretty_printer_section)
         )
     ),
-    (sym::unsafe_destructor_blind_to_params,
-    Normal,
-    template!(Word),
-    Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761",
-                                Some("replace this attribute with `#[may_dangle]`")),
-        sym::dropck_parametricity,
-        "unsafe_destructor_blind_to_params has been replaced by \
-            may_dangle and will be removed in the future",
-        cfg_fn!(dropck_parametricity))),
     (sym::may_dangle,
     Normal,
     template!(Word),
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 581fd47c4b3..a983180ac01 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -695,7 +695,6 @@ symbols! {
         unmarked_api,
         unreachable_code,
         unrestricted_attribute_tokens,
-        unsafe_destructor_blind_to_params,
         unsafe_no_drop_flag,
         unsized_locals,
         unsized_tuple_coercion,
diff --git a/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs
index 0c94ee53d35..aea9fde5309 100644
--- a/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs
+++ b/src/test/run-pass/issues/issue-28498-ugeh-with-lifetime-param.rs
@@ -20,8 +20,7 @@ struct Foo<'a>(u32, &'a ScribbleOnDrop);
 
 unsafe impl<#[may_dangle] 'a> Drop for Foo<'a> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is sound,
-        // because destructor never accesses `self.1`.
+        // Use of `may_dangle` is sound, because destructor never accesses `self.1`.
         println!("Dropping Foo({}, _)", self.0);
     }
 }
diff --git a/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs
index bf051b950e5..91ef5a7c98d 100644
--- a/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs
+++ b/src/test/run-pass/issues/issue-28498-ugeh-with-passed-to-fn.rs
@@ -25,9 +25,8 @@ struct Foo<T>(u32, T, Box<for <'r> fn(&'r T) -> String>);
 
 unsafe impl<#[may_dangle] T> Drop for Foo<T> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is sound,
-        // because destructor never passes a `self.1` to the callback
-        // (in `self.2`) despite having it available.
+        // Use of `may_dangle` is sound, because destructor never passes a `self.1`
+        // to the callback (in `self.2`) despite having it available.
         println!("Dropping Foo({}, _)", self.0);
     }
 }
diff --git a/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs b/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs
index b6f55350a6c..808f3b6e81e 100644
--- a/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs
+++ b/src/test/run-pass/issues/issue-28498-ugeh-with-trait-bound.rs
@@ -22,9 +22,8 @@ struct Foo<T: fmt::Debug>(u32, T);
 
 unsafe impl<#[may_dangle] T: fmt::Debug> Drop for Foo<T> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is sound,
-        // because destructor never accesses the `Debug::fmt` method
-        // of `T`, despite having it available.
+        // Use of `may_dangle` is sound, because destructor never accesses
+        // the `Debug::fmt` method of `T`, despite having it available.
         println!("Dropping Foo({}, _)", self.0);
     }
 }
diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs
deleted file mode 100644
index 33252019e71..00000000000
--- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-#![deny(deprecated)]
-#![feature(dropck_parametricity)]
-
-struct Foo;
-
-impl Drop for Foo {
-    #[unsafe_destructor_blind_to_params]
-    //~^ ERROR use of deprecated attribute `dropck_parametricity`
-    fn drop(&mut self) {}
-}
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr
deleted file mode 100644
index b6a474575c6..00000000000
--- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761
-  --> $DIR/feature-gate-dropck-ugeh-2.rs:7:5
-   |
-LL |     #[unsafe_destructor_blind_to_params]
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]`
-   |
-note: lint level defined here
-  --> $DIR/feature-gate-dropck-ugeh-2.rs:1:9
-   |
-LL | #![deny(deprecated)]
-   |         ^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs
deleted file mode 100644
index a2377cda9bd..00000000000
--- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-// gate-test-dropck_parametricity
-
-// Ensure that attempts to use the unsafe attribute are feature-gated.
-// Example adapted from RFC 1238 text (just left out the feature gate).
-
-// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md
-//     #example-of-the-unguarded-escape-hatch
-
-use std::cell::Cell;
-
-struct Concrete<'a>(u32, Cell<Option<&'a Concrete<'a>>>);
-
-struct Foo<T> { data: Vec<T> }
-
-impl<T> Drop for Foo<T> {
-    #[unsafe_destructor_blind_to_params] // This is the UGEH attribute
-    //~^ ERROR unsafe_destructor_blind_to_params has been replaced
-    //~| WARN use of deprecated attribute `dropck_parametricity`
-    fn drop(&mut self) { }
-}
-
-fn main() {
-    let mut foo = Foo {  data: Vec::new() };
-    foo.data.push(Concrete(0, Cell::new(None)));
-    foo.data.push(Concrete(0, Cell::new(None)));
-
-    foo.data[0].1.set(Some(&foo.data[1]));
-    foo.data[1].1.set(Some(&foo.data[0]));
-}
diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr
deleted file mode 100644
index 581b760ba4f..00000000000
--- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr
+++ /dev/null
@@ -1,20 +0,0 @@
-error[E0658]: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future
-  --> $DIR/feature-gate-dropck-ugeh.rs:16:5
-   |
-LL |     #[unsafe_destructor_blind_to_params] // This is the UGEH attribute
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/28498
-   = help: add `#![feature(dropck_parametricity)]` to the crate attributes to enable
-
-warning: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761
-  --> $DIR/feature-gate-dropck-ugeh.rs:16:5
-   |
-LL |     #[unsafe_destructor_blind_to_params] // This is the UGEH attribute
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]`
-   |
-   = note: #[warn(deprecated)] on by default
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.rs b/src/test/ui/span/issue28498-reject-lifetime-param.rs
index 5876d4240c0..1e719015785 100644
--- a/src/test/ui/span/issue28498-reject-lifetime-param.rs
+++ b/src/test/ui/span/issue28498-reject-lifetime-param.rs
@@ -16,9 +16,8 @@ struct Foo<'a>(u32, &'a ScribbleOnDrop);
 
 impl<'a> Drop for Foo<'a> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is unsound,
-        // because destructor accesses borrowed data in `self.1`
-        // and we must force that to strictly outlive `self`.
+        // Use of `may_dangle` is unsound, because destructor accesses borrowed data
+        // in `self.1` and we must force that to strictly outlive `self`.
         println!("Dropping Foo({}, {:?})", self.0, self.1);
     }
 }
diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.stderr
index 1dcb40e5d9c..3119ddd03cc 100644
--- a/src/test/ui/span/issue28498-reject-lifetime-param.stderr
+++ b/src/test/ui/span/issue28498-reject-lifetime-param.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-lifetime-param.rs:33:19
+  --> $DIR/issue28498-reject-lifetime-param.rs:32:19
    |
 LL |     foo1 = Foo(1, &first_dropped);
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough
diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.rs b/src/test/ui/span/issue28498-reject-passed-to-fn.rs
index 76d84055434..dcd2e9ad4ba 100644
--- a/src/test/ui/span/issue28498-reject-passed-to-fn.rs
+++ b/src/test/ui/span/issue28498-reject-passed-to-fn.rs
@@ -16,8 +16,7 @@ struct Foo<T>(u32, T, Box<for <'r> fn(&'r T) -> String>);
 
 impl<T> Drop for Foo<T> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is unsound,
-        // because we pass `T` to the callback in `self.2`
+        // Use of `may_dangle` is unsound, because we pass `T` to the callback in `self.2`
         // below, and thus potentially read from borrowed data.
         println!("Dropping Foo({}, {})", self.0, (self.2)(&self.1));
     }
diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
index 214a6f6d65c..60e8a648cd5 100644
--- a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
+++ b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-passed-to-fn.rs:35:19
+  --> $DIR/issue28498-reject-passed-to-fn.rs:34:19
    |
 LL |     foo1 = Foo(1, &first_dropped, Box::new(callback));
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough
diff --git a/src/test/ui/span/issue28498-reject-trait-bound.rs b/src/test/ui/span/issue28498-reject-trait-bound.rs
index 77a443286cb..444cebb19a7 100644
--- a/src/test/ui/span/issue28498-reject-trait-bound.rs
+++ b/src/test/ui/span/issue28498-reject-trait-bound.rs
@@ -18,9 +18,8 @@ struct Foo<T: fmt::Debug>(u32, T);
 
 impl<T: fmt::Debug> Drop for Foo<T> {
     fn drop(&mut self) {
-        // Use of `may_dangle` is unsound,
-        // because we access `T` fmt method when we pass `self.1`
-        // below, and thus potentially read from borrowed data.
+        // Use of `may_dangle` is unsound, because we access `T` fmt method when we pass
+        // `self.1` below, and thus potentially read from borrowed data.
         println!("Dropping Foo({}, {:?})", self.0, self.1);
     }
 }
diff --git a/src/test/ui/span/issue28498-reject-trait-bound.stderr b/src/test/ui/span/issue28498-reject-trait-bound.stderr
index d4fe291bef3..22e4a8205b6 100644
--- a/src/test/ui/span/issue28498-reject-trait-bound.stderr
+++ b/src/test/ui/span/issue28498-reject-trait-bound.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `first_dropped` does not live long enough
-  --> $DIR/issue28498-reject-trait-bound.rs:35:19
+  --> $DIR/issue28498-reject-trait-bound.rs:34:19
    |
 LL |     foo1 = Foo(1, &first_dropped);
    |                   ^^^^^^^^^^^^^^ borrowed value does not live long enough