Skip to content

fix: replace unstable NonNull::from_ref with stable equivalent#92

Open
pypingou wants to merge 2 commits into
eclipse-score:mainfrom
eclipse-score-fork-rh:fix/stable-nonnull-from-ref
Open

fix: replace unstable NonNull::from_ref with stable equivalent#92
pypingou wants to merge 2 commits into
eclipse-score:mainfrom
eclipse-score-fork-rh:fix/stable-nonnull-from-ref

Conversation

@pypingou
Copy link
Copy Markdown
Contributor

@pypingou pypingou commented May 6, 2026

Replace NonNull::from_ref usage in const fn context with stable alternative using NonNull::new_unchecked.

The NonNull::from_ref method exists in Rust 1.86+ but using it as a const fn is still unstable (requires nightly feature non_null_from_ref). This change enables compilation with stable Rust toolchains including Ferrocene.

Changes:
NonNull::from_ref(value).cast()
to:
unsafe { NonNull::new_unchecked(value as *const _ as *mut ()).cast() }

Both implementations are functionally equivalent and safe in this context due to the lifetime constraints enforced by the borrow checker.

Enables: aarch64-linux builds with stable Ferrocene toolchain
Related: rust-lang/rust#130823

Notes for Reviewer

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 #

Replace NonNull::from_ref usage in const fn context with stable
alternative using NonNull::new_unchecked.

The NonNull::from_ref method exists in Rust 1.86+ but using it as a
const fn is still unstable (requires nightly feature non_null_from_ref).
This change enables compilation with stable Rust toolchains including
Ferrocene.

Changes:
  NonNull::from_ref(value).cast()
to:
  unsafe { NonNull::new_unchecked(value as *const _ as *mut ()).cast() }

Both implementations are functionally equivalent and safe in this
context due to the lifetime constraints enforced by the borrow checker.

Enables: aarch64-linux builds with stable Ferrocene toolchain
Related: rust-lang/rust#130823

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

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.4.2) and connecting to it...
INFO: Invocation ID: d24a76be-612f-49ec-825f-4baf82046922
Computing main repo mapping: 
WARNING: For repository 'rules_python', the root module requires module version rules_python@1.4.1, but got rules_python@1.8.3 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.7.1, but got bazel_skylib@1.8.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.1.1, but got rules_cc@0.2.14 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'aspect_rules_lint', the root module requires module version aspect_rules_lint@2.0.0, but got aspect_rules_lint@2.3.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'buildifier_prebuilt', the root module requires module version buildifier_prebuilt@7.3.1, but got buildifier_prebuilt@8.5.1 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (35 packages loaded, 9 targets configured)

Analyzing: target //:license-check (87 packages loaded, 9 targets configured)

Analyzing: target //:license-check (142 packages loaded, 1985 targets configured)

Analyzing: target //:license-check (142 packages loaded, 2717 targets configured)

Analyzing: target //:license-check (153 packages loaded, 4066 targets configured)

Analyzing: target //:license-check (153 packages loaded, 8044 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8123 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8123 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8123 targets configured)

Analyzing: target //:license-check (165 packages loaded, 8247 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10135 targets configured)

Analyzing: target //:license-check (194 packages loaded, 10444 targets configured)
[13 / 17] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions, 1 running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 5 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
Analyzing: target //:license-check (194 packages loaded, 10444 targets configured)
[15 / 17] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
Analyzing: target //:license-check (194 packages loaded, 10444 targets configured)
[17 / 17] no actions running
Analyzing: target //:license-check (194 packages loaded, 10444 targets configured)
[17 / 17] no actions running
INFO: Analyzed target //:license-check (195 packages loaded, 14778 targets configured).
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 28.920s, Critical Path: 2.93s
INFO: 17 processes: 12 internal, 4 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 17 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

The created documentation from the pull request is available at: docu-html

The TryFrom<Vec<u8>> trait is not implemented for String, causing
compilation errors on aarch64. Use String::from_utf8() which properly
returns Result<String, FromUtf8Error>.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@pypingou pypingou requested a deployment to workflow-approval May 11, 2026 10:03 — with GitHub Actions Waiting
@pypingou pypingou requested a deployment to workflow-approval May 11, 2026 10:03 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant