Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0d49862
Clarify/add `must_use` messages for more `into_raw*` functions of `al…
zachs18 Jul 10, 2024
6d477d3
Add `must_use` to IntoRawFd/IntoRawSocket/IntoRawHandle's methods.
zachs18 Jul 10, 2024
84d84da
Explicitly ignore `into_raw_handle()` using `let _ =` in sys/pal/wind…
zachs18 Jul 11, 2024
649b431
Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, Pi…
NobodyXu Jul 28, 2024
794434e
initial implementation of rustdoc nested aux-build
EtomicBomb Jul 24, 2024
d8211de
ordering and wrapping cross-crate-info tests
EtomicBomb Jul 24, 2024
f6f0ef4
reformatted rustdoc/cross-crate-info, fixing trailing newline issue
EtomicBomb Jul 24, 2024
12d87ee
file_stem and comment per notriddle
EtomicBomb Jul 25, 2024
f91da72
merge conflicts; fix rebase duplicating imports
EtomicBomb Jul 29, 2024
bd24763
Move a comment.
nnethercote Jul 29, 2024
70fcf9e
Insert some blank lines.
nnethercote Jul 29, 2024
bd23e0e
canonicalize path in another place to fix #128411
EtomicBomb Jul 31, 2024
281c2fd
Inline and remove `parse_local_mk`.
nnethercote Jul 31, 2024
fe647f0
Remove `LhsExpr`.
nnethercote Jul 31, 2024
2eb2ef1
Streamline attribute stitching on AST nodes.
nnethercote Jul 31, 2024
9d77d17
Move a comment to a better spot.
nnethercote Aug 1, 2024
d1f05fd
Distinguish the two kinds of token range.
nnethercote Jul 31, 2024
b485dd1
rewrite reproducible-build-2 to rmake
Oneirical Jun 28, 2024
94da7b1
rewrite stable-symbol-names to rmake
Oneirical Jun 28, 2024
3e0f186
Revert "Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petr…
compiler-errors Jul 30, 2024
6cd4315
Revert "Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pn…
compiler-errors Jul 30, 2024
b0ca61f
Revert "Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=…
compiler-errors Jul 30, 2024
89e0587
Revert "Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pn…
compiler-errors Jul 30, 2024
02f4762
Revert "Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petr…
compiler-errors Jul 30, 2024
d51b4bc
Revert "Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pn…
compiler-errors Jul 30, 2024
9a6133b
Suppress new false-negatives that were masked by dead code analysis c…
compiler-errors Jul 30, 2024
41b017e
Add the `sha512`, `sm3` and `sm4` target features
sayantn Aug 1, 2024
0142573
Bless test fallout
compiler-errors Jul 30, 2024
c0d9357
rewrite cross-lang-lto-clang to rmake
Oneirical Jul 29, 2024
560e86d
rewrite cross-lang-lto-pgo-smoketest to rmake
Oneirical Jul 29, 2024
290a260
run cross-lang-lto-pgo-smoketest in CI by renaming it
Oneirical Aug 1, 2024
84e261e
chore: use shorthand initializer
nyurik Aug 2, 2024
c7b684e
Rollup merge of #126704 - sayantn:sha, r=Amanieu
jieyouxu Aug 3, 2024
83ba819
Rollup merge of #127095 - Oneirical:testiary-education, r=jieyouxu
jieyouxu Aug 3, 2024
c88a0a7
Rollup merge of #127586 - zachs18:more-must-use, r=cuviper
jieyouxu Aug 3, 2024
20b65ae
Rollup merge of #128161 - EtomicBomb:just-compiletest, r=notriddle
jieyouxu Aug 3, 2024
d33d31b
Rollup merge of #128303 - NobodyXu:specialise-for-pipe, r=cuviper
jieyouxu Aug 3, 2024
b3ebd3b
Rollup merge of #128356 - Oneirical:real-estate-reaLTOr, r=jieyouxu
jieyouxu Aug 3, 2024
8364347
Rollup merge of #128368 - nnethercote:rustfmt-tweaks, r=cuviper
jieyouxu Aug 3, 2024
a966ede
Rollup merge of #128404 - compiler-errors:revert-dead-code-changes, r…
jieyouxu Aug 3, 2024
47099a8
Rollup merge of #128483 - nnethercote:still-more-cfg-cleanups, r=petr…
jieyouxu Aug 3, 2024
31db40d
Rollup merge of #128557 - nyurik:dup-init, r=compiler-errors
jieyouxu Aug 3, 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
Revert "Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petr…
…ochenkov"

This reverts commit 91b18a0, reversing
changes made to 9aedec9.
  • Loading branch information
compiler-errors committed Aug 1, 2024
commit 3e0f186e6b38533b7e7b3432c6cb3338eb4613a6
36 changes: 17 additions & 19 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,26 +73,24 @@ fn adt_of<'tcx>(ty: &hir::Ty<'tcx>) -> Option<(LocalDefId, DefKind)> {
}

fn struct_all_fields_are_public(tcx: TyCtxt<'_>, id: LocalDefId) -> bool {
let adt_def = tcx.adt_def(id);

// skip types contain fields of unit and never type,
// it's usually intentional to make the type not constructible
let not_require_constructor = adt_def.all_fields().any(|field| {
// treat PhantomData and positional ZST as public,
// we don't want to lint types which only have them,
// cause it's a common way to use such types to check things like well-formedness
tcx.adt_def(id).all_fields().all(|field| {
let field_type = tcx.type_of(field.did).instantiate_identity();
field_type.is_unit() || field_type.is_never()
});

not_require_constructor
|| adt_def.all_fields().all(|field| {
let field_type = tcx.type_of(field.did).instantiate_identity();
// skip fields of PhantomData,
// cause it's a common way to check things like well-formedness
if field_type.is_phantom_data() {
return true;
}

field.vis.is_public()
})
if field_type.is_phantom_data() {
return true;
}
let is_positional = field.name.as_str().starts_with(|c: char| c.is_ascii_digit());
if is_positional
&& tcx
.layout_of(tcx.param_env(field.did).and(field_type))
.map_or(true, |layout| layout.is_zst())
{
return true;
}
field.vis.is_public()
})
}

/// check struct and its fields are public or not,
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/derives/clone-debug-dead-code-in-the-same-struct.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![forbid(dead_code)]

#[derive(Debug)]
pub struct Whatever {
pub struct Whatever { //~ ERROR struct `Whatever` is never constructed
pub field0: (),
field1: (), //~ ERROR fields `field1`, `field2`, `field3`, and `field4` are never read
field1: (),
field2: (),
field3: (),
field4: (),
Expand Down
16 changes: 3 additions & 13 deletions tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
error: fields `field1`, `field2`, `field3`, and `field4` are never read
--> $DIR/clone-debug-dead-code-in-the-same-struct.rs:6:5
error: struct `Whatever` is never constructed
--> $DIR/clone-debug-dead-code-in-the-same-struct.rs:4:12
|
LL | pub struct Whatever {
| -------- fields in this struct
LL | pub field0: (),
LL | field1: (),
| ^^^^^^
LL | field2: (),
| ^^^^^^
LL | field3: (),
| ^^^^^^
LL | field4: (),
| ^^^^^^
| ^^^^^^^^
|
= note: `Whatever` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
note: the lint level is defined here
--> $DIR/clone-debug-dead-code-in-the-same-struct.rs:1:11
|
Expand Down
35 changes: 0 additions & 35 deletions tests/ui/lint/dead-code/unconstructible-pub-struct.rs

This file was deleted.

14 changes: 0 additions & 14 deletions tests/ui/lint/dead-code/unconstructible-pub-struct.stderr

This file was deleted.