Repository navigation
Prepare to make rustc_trivial_field_reads usable in user code - #164217
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Prepare to make `rustc_trivial_field_reads` usable in user code
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (e790d10): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 5.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.6%, secondary 2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 488.816s -> 489.518s (0.14%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Prepare to make `rustc_trivial_field_reads` usable in user code
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (a64a0d1): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 490.869s -> 490.424s (-0.09%) |
|
Let's run it again, i think the improvements are spurious. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Allow `rustc_trivial_field_reads` on inherent methods Add test for multiple usage sites
d92ee46 to
70426a6
Compare
|
Thanks for the reviews :) Squashed into two commits |
|
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
This comment was marked as outdated.
This comment was marked as outdated.
1 similar comment
This comment was marked as outdated.
This comment was marked as outdated.
|
Thanks! @bors r=mejrs,mu001999 rollup=never |
|
@bors rollup=iffy |
|
⌛ Testing commit 70426a6 with merge 2e70d67... Workflow: https://github.com/rust-lang/rust/actions/runs/42811773796 |
Prepare to make `rustc_trivial_field_reads` usable in user code Zulip discussion: [#t-lang > diagnostics attribute to ignore code for unused_code lints](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/diagnostics.20attribute.20to.20ignore.20code.20for.20unused_code.20lints/with/614949580) [#t-compiler/help > #160621 (Allow ignoring fns for dead code analysis)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.23160621.20.28Allow.20ignoring.20fns.20for.20dead.20code.20analysis.29/with/629007836) Open questions I have: 1. Some of the `Debug` impls are not pointed out as usage sites. For example this test: ```rust #[derive(Debug)] enum TupleVariant { Variant1(i32), //~ ERROR: variant `Variant1` is never constructed Variant2, } fn main() { let _ = TupleVariant::Variant2; } ``` now loses its the note in the error message: ``` note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis ``` but in my mind this also makes sense - the `Debug` impl never constructs that `Variant1` and even if `rustc_trivial_field_reads` is removed from the debug impl, the "variant never constructed" warning would still occur. Note that this doesn't apply to `Clone` impls, which do technically construct that variant although that brings me to point 2 2. If I am reading the code right, the whole point of the `ignored_variant_stack` is to make sure we don't mark a variant of an enum live from within a match arm that matches on that exact enum variant. But isn't that exactly what the `Clone` impl does? The inner match arm of it would look like `Variant1(x) => Variant1(x)`. I looked into `necessary_variants` and found that it directly ignores the kind of variant we encounter, namely `PatKind::TupleStruct(hir::QPath::TypeRelative(...))` but I don't really understand why and whether that's a bug or whether I am missing something
|
@bors yield |
|
Auto build was cancelled. Cancelled workflows: The next pull request likely to be tested is #165752. |
…1999 Prepare to make `rustc_trivial_field_reads` usable in user code Zulip discussion: [#t-lang > diagnostics attribute to ignore code for unused_code lints](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/diagnostics.20attribute.20to.20ignore.20code.20for.20unused_code.20lints/with/614949580) [#t-compiler/help > rust-lang#160621 (Allow ignoring fns for dead code analysis)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.23160621.20.28Allow.20ignoring.20fns.20for.20dead.20code.20analysis.29/with/629007836) Open questions I have: 1. Some of the `Debug` impls are not pointed out as usage sites. For example this test: ```rust #[derive(Debug)] enum TupleVariant { Variant1(i32), //~ ERROR: variant `Variant1` is never constructed Variant2, } fn main() { let _ = TupleVariant::Variant2; } ``` now loses its the note in the error message: ``` note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis ``` but in my mind this also makes sense - the `Debug` impl never constructs that `Variant1` and even if `rustc_trivial_field_reads` is removed from the debug impl, the "variant never constructed" warning would still occur. Note that this doesn't apply to `Clone` impls, which do technically construct that variant although that brings me to point 2 2. If I am reading the code right, the whole point of the `ignored_variant_stack` is to make sure we don't mark a variant of an enum live from within a match arm that matches on that exact enum variant. But isn't that exactly what the `Clone` impl does? The inner match arm of it would look like `Variant1(x) => Variant1(x)`. I looked into `necessary_variants` and found that it directly ignores the kind of variant we encounter, namely `PatKind::TupleStruct(hir::QPath::TypeRelative(...))` but I don't really understand why and whether that's a bug or whether I am missing something
…1999 Prepare to make `rustc_trivial_field_reads` usable in user code Zulip discussion: [#t-lang > diagnostics attribute to ignore code for unused_code lints](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/diagnostics.20attribute.20to.20ignore.20code.20for.20unused_code.20lints/with/614949580) [#t-compiler/help > rust-lang#160621 (Allow ignoring fns for dead code analysis)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.23160621.20.28Allow.20ignoring.20fns.20for.20dead.20code.20analysis.29/with/629007836) Open questions I have: 1. Some of the `Debug` impls are not pointed out as usage sites. For example this test: ```rust #[derive(Debug)] enum TupleVariant { Variant1(i32), //~ ERROR: variant `Variant1` is never constructed Variant2, } fn main() { let _ = TupleVariant::Variant2; } ``` now loses its the note in the error message: ``` note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis ``` but in my mind this also makes sense - the `Debug` impl never constructs that `Variant1` and even if `rustc_trivial_field_reads` is removed from the debug impl, the "variant never constructed" warning would still occur. Note that this doesn't apply to `Clone` impls, which do technically construct that variant although that brings me to point 2 2. If I am reading the code right, the whole point of the `ignored_variant_stack` is to make sure we don't mark a variant of an enum live from within a match arm that matches on that exact enum variant. But isn't that exactly what the `Clone` impl does? The inner match arm of it would look like `Variant1(x) => Variant1(x)`. I looked into `necessary_variants` and found that it directly ignores the kind of variant we encounter, namely `PatKind::TupleStruct(hir::QPath::TypeRelative(...))` but I don't really understand why and whether that's a bug or whether I am missing something
…uwer Rollup of 24 pull requests Successful merges: - #165709 (remove 'x miri' smoke test from PR CI) - #164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - #165569 (`Move` trait feature gate) - #165575 (Upgrade bundled musl to 1.2.6) - #163241 (Add enclosing item context when pointing at `FnMut` bound) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165047 (Change the span building of paths from first-to-last to chained) - #165458 (fix incorrect byte count suffix on MSVC) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #165753 (avoid Terminator:None in MIR inliner) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165562 (stop using gce in a test) - #165681 (Add safety requirements for Pattern and Searcher) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) - #165739 (remove NOP File::flush from fs tests) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #164218 (Tweak private re-export errors to point at correct span and have more context)
…uwer Rollup of 24 pull requests Successful merges: - #165709 (remove 'x miri' smoke test from PR CI) - #164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - #165569 (`Move` trait feature gate) - #165575 (Upgrade bundled musl to 1.2.6) - #163241 (Add enclosing item context when pointing at `FnMut` bound) - #163992 (add `core::arch::{x86, x86_64}::x87_f80`) - #165047 (Change the span building of paths from first-to-last to chained) - #165458 (fix incorrect byte count suffix on MSVC) - #165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - #165586 (Remove `backend_optimization_level`.) - #165646 (fix NumScalableVectors::from_field_count) - #165655 (Unignore passing GCC backend tests) - #165740 (miri subtree update) - #165753 (avoid Terminator:None in MIR inliner) - #153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - #164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - #165562 (stop using gce in a test) - #165681 (Add safety requirements for Pattern and Searcher) - #165682 (interpret: ensure newly created unions have uninit in their padding) - #165693 (Move `check_attr` to attribute parsing) - #165715 (windows: check for null before wide encoding) - #165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - #165733 (docs(num): remove needless whitespaces) - #165739 (remove NOP File::flush from fs tests) Failed merges: - #165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - #164218 (Tweak private re-export errors to point at correct span and have more context)
Rollup merge of #164217 - tehforsch:fix-160621, r=mejrs,mu001999 Prepare to make `rustc_trivial_field_reads` usable in user code Zulip discussion: [#t-lang > diagnostics attribute to ignore code for unused_code lints](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/diagnostics.20attribute.20to.20ignore.20code.20for.20unused_code.20lints/with/614949580) [#t-compiler/help > #160621 (Allow ignoring fns for dead code analysis)](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.23160621.20.28Allow.20ignoring.20fns.20for.20dead.20code.20analysis.29/with/629007836) Open questions I have: 1. Some of the `Debug` impls are not pointed out as usage sites. For example this test: ```rust #[derive(Debug)] enum TupleVariant { Variant1(i32), //~ ERROR: variant `Variant1` is never constructed Variant2, } fn main() { let _ = TupleVariant::Variant2; } ``` now loses its the note in the error message: ``` note: `TupleVariant` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis ``` but in my mind this also makes sense - the `Debug` impl never constructs that `Variant1` and even if `rustc_trivial_field_reads` is removed from the debug impl, the "variant never constructed" warning would still occur. Note that this doesn't apply to `Clone` impls, which do technically construct that variant although that brings me to point 2 2. If I am reading the code right, the whole point of the `ignored_variant_stack` is to make sure we don't mark a variant of an enum live from within a match arm that matches on that exact enum variant. But isn't that exactly what the `Clone` impl does? The inner match arm of it would look like `Variant1(x) => Variant1(x)`. I looked into `necessary_variants` and found that it directly ignores the kind of variant we encounter, namely `PatKind::TupleStruct(hir::QPath::TypeRelative(...))` but I don't really understand why and whether that's a bug or whether I am missing something
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (b076b10): comparison URL. Overall result: ❌ regressions - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 406.28 MiB -> 406.40 MiB (0.03%) |
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
View all comments
Zulip discussion:
#t-lang > diagnostics attribute to ignore code for unused_code lints
#t-compiler/help > #160621 (Allow ignoring fns for dead code analysis)
Open questions I have:
Debugimpls are not pointed out as usage sites. For example this test:now loses its the note in the error message:
but in my mind this also makes sense - the
Debugimpl never constructs thatVariant1and even ifrustc_trivial_field_readsis removed from the debug impl, the "variant never constructed" warning would still occur. Note that this doesn't apply toCloneimpls, which do technically construct that variant although that brings me to point 2ignored_variant_stackis to make sure we don't mark a variant of an enum live from within a match arm that matches on that exact enum variant. But isn't that exactly what theCloneimpl does? The inner match arm of it would look likeVariant1(x) => Variant1(x). I looked intonecessary_variantsand found that it directly ignores the kind of variant we encounter, namelyPatKind::TupleStruct(hir::QPath::TypeRelative(...))but I don't really understand why and whether that's a bug or whether I am missing something