Skip to content

Commit 1c64346

Browse files
committed
Auto merge of rust-lang#119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlin
Replace visibility test with reachability test in dead code detection Fixes rust-lang#119545 Also included is a fix for an error now flagged by the lint
2 parents 241ba61 + ee32b66 commit 1c64346

File tree

7 files changed

+12
-17
lines changed

7 files changed

+12
-17
lines changed

alloc/src/collections/btree/navigate.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ impl<BorrowType: marker::BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Lea
655655
pub enum Position<BorrowType, K, V> {
656656
Leaf(NodeRef<BorrowType, K, V, marker::Leaf>),
657657
Internal(NodeRef<BorrowType, K, V, marker::Internal>),
658-
InternalKV(Handle<NodeRef<BorrowType, K, V, marker::Internal>, marker::KV>),
658+
InternalKV,
659659
}
660660

661661
impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal> {
@@ -677,7 +677,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
677677
visit(Position::Leaf(leaf));
678678
match edge.next_kv() {
679679
Ok(kv) => {
680-
visit(Position::InternalKV(kv));
680+
visit(Position::InternalKV);
681681
kv.right_edge()
682682
}
683683
Err(_) => return,
@@ -699,7 +699,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
699699
self.visit_nodes_in_order(|pos| match pos {
700700
Position::Leaf(node) => result += node.len(),
701701
Position::Internal(node) => result += node.len(),
702-
Position::InternalKV(_) => (),
702+
Position::InternalKV => (),
703703
});
704704
result
705705
}

alloc/src/collections/btree/node/tests.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
3232
result += &format!("\n{}{:?}", indent, leaf.keys());
3333
}
3434
navigate::Position::Internal(_) => {}
35-
navigate::Position::InternalKV(kv) => {
36-
let depth = self.height() - kv.into_node().height();
37-
let indent = " ".repeat(depth);
38-
result += &format!("\n{}{:?}", indent, kv.into_kv().0);
39-
}
35+
navigate::Position::InternalKV => {}
4036
});
4137
result
4238
}

std/src/sys/pal/sgx/net.rs

+2
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ pub mod netc {
524524

525525
#[derive(Copy, Clone)]
526526
pub struct sockaddr_in {
527+
#[allow(dead_code)]
527528
pub sin_family: sa_family_t,
528529
pub sin_port: u16,
529530
pub sin_addr: in_addr,
@@ -536,6 +537,7 @@ pub mod netc {
536537

537538
#[derive(Copy, Clone)]
538539
pub struct sockaddr_in6 {
540+
#[allow(dead_code)]
539541
pub sin6_family: sa_family_t,
540542
pub sin6_port: u16,
541543
pub sin6_addr: in6_addr,

std/src/sys/pal/unix/thread_local_dtor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
3535
#[cfg(not(sanitizer_cfi_normalize_integers))]
3636
#[cfi_encoding = "i"]
3737
#[repr(transparent)]
38-
pub struct c_int(pub libc::c_int);
38+
pub struct c_int(#[allow(dead_code)] pub libc::c_int);
3939

4040
extern "C" {
4141
#[linkage = "extern_weak"]

std/src/sys/pal/unsupported/net.rs

+2
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ pub mod netc {
346346

347347
#[derive(Copy, Clone)]
348348
pub struct sockaddr_in {
349+
#[allow(dead_code)]
349350
pub sin_family: sa_family_t,
350351
pub sin_port: u16,
351352
pub sin_addr: in_addr,
@@ -358,6 +359,7 @@ pub mod netc {
358359

359360
#[derive(Copy, Clone)]
360361
pub struct sockaddr_in6 {
362+
#[allow(dead_code)]
361363
pub sin6_family: sa_family_t,
362364
pub sin6_port: u16,
363365
pub sin6_addr: in6_addr,

std/src/sys/pal/wasi/net.rs

+2
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ pub mod netc {
520520

521521
#[derive(Copy, Clone)]
522522
pub struct sockaddr_in {
523+
#[allow(dead_code)]
523524
pub sin_family: sa_family_t,
524525
pub sin_port: u16,
525526
pub sin_addr: in_addr,
@@ -532,6 +533,7 @@ pub mod netc {
532533

533534
#[derive(Copy, Clone)]
534535
pub struct sockaddr_in6 {
536+
#[allow(dead_code)]
535537
pub sin6_family: sa_family_t,
536538
pub sin6_port: u16,
537539
pub sin6_addr: in6_addr,

test/src/console.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ pub struct ConsoleTestDiscoveryState {
4646
pub tests: usize,
4747
pub benchmarks: usize,
4848
pub ignored: usize,
49-
pub options: Options,
5049
}
5150

5251
impl ConsoleTestDiscoveryState {
@@ -56,13 +55,7 @@ impl ConsoleTestDiscoveryState {
5655
None => None,
5756
};
5857

59-
Ok(ConsoleTestDiscoveryState {
60-
log_out,
61-
tests: 0,
62-
benchmarks: 0,
63-
ignored: 0,
64-
options: opts.options,
65-
})
58+
Ok(ConsoleTestDiscoveryState { log_out, tests: 0, benchmarks: 0, ignored: 0 })
6659
}
6760

6861
pub fn write_log<F, S>(&mut self, msg: F) -> io::Result<()>

0 commit comments

Comments
 (0)