about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-07-30 12:29:02 -0400
committerMichael Goulet <michael@errs.io>2024-08-03 07:57:31 -0400
commitd29818c9f552d6941bc00770e7aa1e2768e02e07 (patch)
tree69d1a541f809491dbffce2d871502128406cf91f
parent22da61624590a413c98df5087ff4454fcc618dbf (diff)
downloadrust-d29818c9f552d6941bc00770e7aa1e2768e02e07.tar.gz
rust-d29818c9f552d6941bc00770e7aa1e2768e02e07.zip
Revert "Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov"
This reverts commit 977c5fd419ade52467f7de79d5bfc25c0c893275, reversing
changes made to 24c94f0e4f5aa333c665fbbba423172c30176624.
-rw-r--r--compiler/rustc_passes/src/dead.rs2
-rw-r--r--tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs33
2 files changed, 1 insertions, 34 deletions
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs
index d4ce9b02473..90f436a6fc1 100644
--- a/compiler/rustc_passes/src/dead.rs
+++ b/compiler/rustc_passes/src/dead.rs
@@ -923,7 +923,7 @@ fn create_and_seed_worklist(
                     match tcx.def_kind(id) {
                         DefKind::Impl { .. } => false,
                         DefKind::AssocConst | DefKind::AssocFn => !matches!(tcx.associated_item(id).container, AssocItemContainer::ImplContainer),
-                        DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()) || has_allow_dead_code_or_lang_attr(tcx, id).is_some(),
+                        DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()),
                         _ => true
                     })
                 .map(|id| (id, ComesFromAllowExpect::No))
diff --git a/tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs b/tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs
deleted file mode 100644
index 8cd1524045b..00000000000
--- a/tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-//@ check-pass
-
-mod ffi {
-    use super::*;
-
-    extern "C" {
-        pub fn DomPromise_AddRef(promise: *const Promise);
-        pub fn DomPromise_Release(promise: *const Promise);
-    }
-}
-
-#[repr(C)]
-#[allow(unused)]
-pub struct Promise {
-    private: [u8; 0],
-    __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>,
-}
-
-pub unsafe trait RefCounted {
-    unsafe fn addref(&self);
-    unsafe fn release(&self);
-}
-
-unsafe impl RefCounted for Promise {
-    unsafe fn addref(&self) {
-        ffi::DomPromise_AddRef(self)
-    }
-    unsafe fn release(&self) {
-        ffi::DomPromise_Release(self)
-    }
-}
-
-fn main() {}