diff mbox series

[meta-lts-mixins,kirkstone/rust,27/33] rust: Oe-selftest changes for rust v1.77

Message ID bd3f4cf8333b602e179e979e5ee7e7a1a979802f.1724874972.git.scott.murray@konsulko.com
State New
Headers show
Series Update to Rust 1.78.0 | expand

Commit Message

Scott Murray Aug. 28, 2024, 8:09 p.m. UTC
From: Yash Shinde <Yash.Shinde@windriver.com>

    Update the file paths for v1.77 and fix the dead code error as follows:

    Compiling coverage-dump v0.1.0 (/home/poky/build-st/tmp/work/core2-64-poky-linux/rust/1.77.0/rustc-1.77.0-src/src/tools/coverage-dump)
    error: field `0` is never read
       --> src/tools/coverage-dump/src/covfun.rs:222:15
        |
    222 |     Expansion(u32),
        |     --------- ^^^
        |     |
        |     field in this variant
        |
        = note: `-D dead-code` implied by `-D warnings`
        = help: to override `-D warnings` add `#[allow(dead_code)]`
    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
        |
    222 |     Expansion(()),
        |               ~~

    error: could not compile `coverage-dump` (bin "coverage-dump") due to 1 previous error

    Only the required change is backported here to run the build without any errors.
    Other changes are merged with the commit in v1.78.

    Reference: https://github.com/rust-lang/rust/commit/9a5034a20ed8b055dc615271f9d9cf27f9e494f0#diff-d4ecc6273352a2a8ebd02c45233d9bff7c6694f20b67ddad0614af7a89c06748

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 072df9d3d8792a6f0250cc5e37545f04e6a046ec)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 .../rust/files/deadcode-backport.patch        | 39 +++++++++++++++++++
 .../rust/files/rust-oe-selftest.patch         | 17 ++++++--
 recipes-devtools/rust/rust-source.inc         |  1 +
 3 files changed, 54 insertions(+), 3 deletions(-)
 create mode 100644 recipes-devtools/rust/files/deadcode-backport.patch
diff mbox series

Patch

diff --git a/recipes-devtools/rust/files/deadcode-backport.patch b/recipes-devtools/rust/files/deadcode-backport.patch
new file mode 100644
index 0000000..9ab229e
--- /dev/null
+++ b/recipes-devtools/rust/files/deadcode-backport.patch
@@ -0,0 +1,39 @@ 
+Fix the dead code error as follows:
+
+    Compiling coverage-dump v0.1.0 (/home/poky/build-st/tmp/work/core2-64-poky-linux/rust/1.77.0/rustc-1.77.0-src/src/tools/coverage-dump)
+    error: field `0` is never read
+       --> src/tools/coverage-dump/src/covfun.rs:222:15
+        |
+    222 |     Expansion(u32),
+        |     --------- ^^^
+        |     |
+        |     field in this variant
+        |
+        = note: `-D dead-code` implied by `-D warnings`
+        = help: to override `-D warnings` add `#[allow(dead_code)]`
+    help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
+        |
+    222 |     Expansion(()),
+        |               ~~
+
+    error: could not compile `coverage-dump` (bin "coverage-dump") due to 1 previous error
+
+Only the required change is backported here to run the build without any errors.
+Other changes are merged with the commit in v1.78.
+
+Upstream-Status: Backport [https://github.com/rust-lang/rust/commit/9a5034a20ed8b055dc615271f9d9cf27f9e494f0#diff-d4ecc6273352a2a8ebd02c45233d9bff7c6694f20b67ddad0614af7a89c06748]
+
+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
+---
+diff --git a/src/tools/coverage-dump/src/covfun.rs b/src/tools/coverage-dump/src/covfun.rs
+--- a/src/tools/coverage-dump/src/covfun.rs
++++ b/src/tools/coverage-dump/src/covfun.rs
+@@ -219,7 +219,7 @@
+ enum MappingKind {
+     Code(CovTerm),
+     Gap(CovTerm),
+-    Expansion(u32),
++    Expansion(#[allow(dead_code)] u32),
+     Skip,
+     // Using raw identifiers here makes the dump output a little bit nicer
+     // (via the derived Debug), at the expense of making this tool's source
diff --git a/recipes-devtools/rust/files/rust-oe-selftest.patch b/recipes-devtools/rust/files/rust-oe-selftest.patch
index 2c6e97f..1d28733 100644
--- a/recipes-devtools/rust/files/rust-oe-selftest.patch
+++ b/recipes-devtools/rust/files/rust-oe-selftest.patch
@@ -255,10 +255,10 @@  index 1a9d3d3f12f..0a9cfc48806 100644
  fn test_get_mut_poison() {
      let m = Arc::new(RwLock::new(NonCopy(10)));
      let m2 = m.clone();
-diff --git a/library/std/src/sys/unix/process/process_unix/tests.rs b/library/std/src/sys/unix/process/process_unix/tests.rs
+diff --git a/library/std/src/sys/pal/unix/process/process_unix/tests.rs b/library/std/src/sys/pal/unix/process/process_unix/tests.rs
 index 0a6c6ec19fc..bec257bc630 100644
---- a/library/std/src/sys/unix/process/process_unix/tests.rs
-+++ b/library/std/src/sys/unix/process/process_unix/tests.rs
+--- a/library/std/src/sys/pal/unix/process/process_unix/tests.rs
++++ b/library/std/src/sys/pal/unix/process/process_unix/tests.rs
 @@ -6,6 +6,7 @@
  // safety etc., are tested in tests/ui/process/process-panic-after-fork.rs
 
@@ -319,3 +319,14 @@  index 5d6b9e94ee9..a5aacb2eb87 100644
  fn test_try_panic_any_message_unit_struct() {
      struct Juju;
 
+diff --git a/library/alloc/src/slice/tests.rs b/library/alloc/src/slice/tests.rs
+--- a/library/alloc/src/slice/tests.rs
++++ b/library/alloc/src/slice/tests.rs
+@@ -186,6 +186,7 @@
+ std::thread_local!(static SILENCE_PANIC: Cell<bool> = Cell::new(false));
+
+ #[test]
++#[ignore]
+ #[cfg_attr(target_os = "emscripten", ignore)] // no threads
+ #[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
+ fn panic_safe() {
diff --git a/recipes-devtools/rust/rust-source.inc b/recipes-devtools/rust/rust-source.inc
index dff95ec..328c5b2 100644
--- a/recipes-devtools/rust/rust-source.inc
+++ b/recipes-devtools/rust/rust-source.inc
@@ -11,6 +11,7 @@  SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n
             file://0001-cargo-do-not-write-host-information-into-compilation.patch;patchdir=${RUSTSRC} \
             file://rustdoc-repro-issue-fix-cargo-config-for-codegenunits.patch;patchdir=${RUSTSRC} \
             file://cross-targets-backport.patch;patchdir=${RUSTSRC} \
+            file://deadcode-backport.patch;patchdir=${RUSTSRC} \
             file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \
             file://repro-issue-fix-with-cc-crate-hashmap.patch;patchdir=${RUSTSRC} \
 "