Skip to content

Conversation

r-chiba
Copy link

@r-chiba r-chiba commented Oct 3, 2025

Description

This change fixes to import size_of and align_of from the core crate.

We have seen an error failing to resolve this import directive.

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

We have seen an error failing to resolve this import directive.
Fix the path to import from the core crate.
@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Oct 3, 2025
@tgross35
Copy link
Contributor

tgross35 commented Oct 3, 2025

What is the error you are seeing? We import core::mem so I'm not sure why things wouldn't be working. I'd expect fmt::Debug to be in the same boat.

@r-chiba
Copy link
Author

r-chiba commented Oct 3, 2025

We saw this error on a Windows environment:

00:47:54 error[E0432]: unresolved import `mem`
00:47:54 --> external/+_repo_rules2+libc/src\macros.rs:81:28
00:47:54 |
00:47:54 81 |             pub(crate) use mem::{align_of, align_of_val, size_of, size_of_val};
00:47:54 |                            ^^^ help: a similar path exists: `self::mem`
00:47:54 |
00:47:54 ::: external/+_repo_rules2+libc/src/lib.rs:57:9
00:47:54 |
00:47:54 57 |         prelude!();
00:47:54 |         ---------- in this macro invocation
00:47:54 |
00:47:54 = note: this error originates in the macro `prelude` (in Nightly builds, run with -Z macro-backtrace for more info)
00:47:54 
00:47:54 error: aborting due to 1 previous error

@tgross35
Copy link
Contributor

tgross35 commented Oct 3, 2025

Do you have the rustc invocation that caused that and some more toolchain info? I'm not able to reproduce, of course, and I don't really understand where the error would be coming from. Libc isn't getting built with an old edition or something, is it?

@r-chiba
Copy link
Author

r-chiba commented Oct 3, 2025

I think the rustc version is 1.88.0 but I couldn't find the exact command used for the build.

The context is that the error happened to one of the components of (the internal version of) Android's AOSP project when I updated the libc crate version used for Android build (internal version of https://cs.android.com/android/platform/superproject/main/+/main:external/rust/android-crates-io/) from 0.2.172 to 0.2.175.

I'm so sorry but I'm not a developer of the component failed to build and I have no idea how the component is built. And unfortunately I don't have a minimal reproducible case of the failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants