Skip to content

fix(rust): E0716 extend log metadata lifetimes during formatting - #304

Open
ian-harmon-traton wants to merge 3 commits into
eclipse-score:mainfrom
ian-harmon-traton:fix/rust-score_write-E0716
Open

ian-harmon-traton wants to merge 3 commits into
eclipse-score:mainfrom
ian-harmon-traton:fix/rust-score_write-E0716

Conversation

@ian-harmon-traton

@ian-harmon-traton ian-harmon-traton commented Sep 9, 2026

Copy link
Copy Markdown

Notes for Reviewer

Issue

Fixes the following Rust compilation error in score_log_bridge:

error[E0716]: temporary value dropped while borrowed
  --> score/mw/log/rust/score_log_bridge/src/score_log_bridge.rs
   |
   | let _ = score_write!(&mut log_message, "{}:", record.module_path());
   |                                                ^^^^^^^^^^^^^^^^^^^^
   |                                                creates a temporary value which is freed while still in use

The same error occurs for record.file() and record.line().
Reproduce it by building a Rust target that depends on score_log_bridge

The compiler reported E0716 for Record::module_path(), Record::file(), and Record::line().

What Changed

The metadata values are now assigned to local variables before being passed to score_write!. This extends their lifetimes through the formatting operation without changing the generated log output.

Pre-Review Checklist for the PR Author

  • PR title is short, expressive and meaningful
  • Commits are properly organized
  • Relevant issues are linked in the References section
  • Tests are conducted
  • Unit tests are added

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  • All open points are addressed and tracked via issues

References

Closes #

Use score_baselibs' VLAN target when the local VLAN implementation is
disabled. This makes score/network/vlan.h available in Bazel's compile
sandbox.
Bind module, file, and line metadata before passing them to score_write!
to prevent E0716 temporary-value lifetime errors.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 0cf48303-9ecc-4a45-95ab-83076e3e8b13
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 4 packages loaded
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:license-check': no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
ERROR: no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
INFO: Elapsed time: 15.529s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@pawelrutkaq pawelrutkaq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check with 1.91 + toolchain feroceen

@ian-harmon-traton

Copy link
Copy Markdown
Author

please check with 1.91 + toolchain feroceen

will test next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants