Skip to content

Rollup of 8 pull requests #126433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5cfe020
Always emit native-static-libs note, even if it is empty
madsmtm Feb 17, 2024
27ecb71
`UniqueRc`: support allocators and `T: ?Sized`.
kpreid Jun 11, 2024
6445073
Add pub struct with allow(dead_code) into worklist
mu001999 Jun 12, 2024
48d3425
Remove some msys2 utils
ChrisDenton Jun 12, 2024
c81ffab
std::unix::fs::link using direct linkat call for Solaris and macOs.
devnexen Jun 12, 2024
2733b8a
Avoid follow-up errors on erroneous patterns
oli-obk Jun 11, 2024
a621701
Replace some `Option<Diag>` with `Result<(), Diag>`
oli-obk Jun 12, 2024
ece3e3e
Replace some `Option<Diag>` with `Result<(), Diag>`
oli-obk Jun 12, 2024
e8d6170
Replace some `Option<Diag>` with `Result<(), Diag>`
oli-obk Jun 12, 2024
7566307
Replace a `bool` with a `Result<(), ErrorGuaranteed>`
oli-obk Jun 12, 2024
b28221e
Use diagnostic method for diagnostics
oli-obk Apr 15, 2024
c75f728
Add some tests
oli-obk Apr 15, 2024
9cf60ee
Method resolution constrains hidden types instead of rejecting method…
oli-obk Apr 15, 2024
58e3ac0
extend the check for LLVM build
onur-ozkan Jun 13, 2024
a5709f3
Rollup merge of #121216 - madsmtm:fix-108825, r=wesleywiser
matthiaskrgr Jun 13, 2024
9958f8d
Rollup merge of #123962 - oli-obk:define_opaque_types5, r=lcnr
matthiaskrgr Jun 13, 2024
264b173
Rollup merge of #126285 - kpreid:unique-rc, r=dtolnay
matthiaskrgr Jun 13, 2024
c87e06d
Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov
matthiaskrgr Jun 13, 2024
758f890
Rollup merge of #126320 - oli-obk:pat_ice, r=lcnr
matthiaskrgr Jun 13, 2024
160e4c9
Rollup merge of #126343 - ChrisDenton:remove-utils, r=Kobzol
matthiaskrgr Jun 13, 2024
7fde38a
Rollup merge of #126351 - devnexen:to_sol11_upd, r=ChrisDenton
matthiaskrgr Jun 13, 2024
0e05486
Rollup merge of #126399 - onur-ozkan:126156, r=albertlarsan68
matthiaskrgr Jun 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add pub struct with allow(dead_code) into worklist
  • Loading branch information
mu001999 committed Jun 12, 2024
commit 64450732be8c3111360589e9f8c44eab83f449e0
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,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()),
DefKind::Struct => struct_all_fields_are_public(tcx, id.to_def_id()) || has_allow_dead_code_or_lang_attr(tcx, id).is_some(),
_ => true
})
.map(|id| (id, ComesFromAllowExpect::No))
Expand Down
33 changes: 33 additions & 0 deletions tests/ui/lint/dead-code/allow-unconstructed-pub-struct.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//@ 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() {}
Loading