Add pub struct with allow(dead_code) into worklist · rust-lang/rust@6445073 (original) (raw)
File tree
2 files changed
lines changed
- compiler/rustc_passes/src
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -898,7 +898,7 @@ fn create_and_seed_worklist( | ||
898 | 898 | match tcx.def_kind(id) { |
899 | 899 | DefKind::Impl { .. } => false, |
900 | 900 | DefKind::AssocConst | DefKind::AssocFn => !matches!(tcx.associated_item(id).container, AssocItemContainer::ImplContainer), |
901 | -DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()), | |
901 | +DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()) | | |
902 | 902 | _ => true |
903 | 903 | }) |
904 | 904 | .map(|id |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
1 | +//@ check-pass | |
2 | + | |
3 | +mod ffi { | |
4 | +use super::*; | |
5 | + | |
6 | +extern "C" { | |
7 | +pub fn DomPromise_AddRef(promise: *const Promise); | |
8 | +pub fn DomPromise_Release(promise: *const Promise); | |
9 | +} | |
10 | +} | |
11 | + | |
12 | +#[repr(C)] | |
13 | +#[allow(unused)] | |
14 | +pub struct Promise { | |
15 | +private: [u8; 0], | |
16 | +__nosync: ::std:📑:PhantomData<::std::rc::Rc<u8>>, | |
17 | +} | |
18 | + | |
19 | +pub unsafe trait RefCounted { | |
20 | +unsafe fn addref(&self); | |
21 | +unsafe fn release(&self); | |
22 | +} | |
23 | + | |
24 | +unsafe impl RefCounted for Promise { | |
25 | +unsafe fn addref(&self) { | |
26 | + ffi::DomPromise_AddRef(self) | |
27 | +} | |
28 | +unsafe fn release(&self) { | |
29 | + ffi::DomPromise_Release(self) | |
30 | +} | |
31 | +} | |
32 | + | |
33 | +fn main() {} |