Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov · compiler-errors/rust@977c5fd

File tree

2 files changed

lines changed

  • compiler/rustc_passes/src

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -898,7 +898,7 @@ fn create_and_seed_worklist(

898898

match tcx.def_kind(id) {

899899

DefKind::Impl { .. } => false,

900900

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()) || has_allow_dead_code_or_lang_attr(tcx, id).is_some(),

902902

_ => true

903903

})

904904

.map(|id| (id, ComesFromAllowExpect::No))

Original file line numberDiff line numberDiff 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::marker::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() {}