Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcore no longer builds for AVR #130818

Closed
RalfJung opened this issue Sep 25, 2024 · 1 comment · Fixed by #130832
Closed

libcore no longer builds for AVR #130818

RalfJung opened this issue Sep 25, 2024 · 1 comment · Fixed by #130832
Labels
O-AVR Target: AVR processors (ATtiny, ATmega, etc.) T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

When building libcore for a custom target with this target spec, I am getting a build error:

  warning: unused import: `insertion_sort_shift_left`
   --> /Users/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/slice/sort/stable/mod.rs:9:62
    |
  9 |     SMALL_SORT_GENERAL_SCRATCH_LEN, StableSmallSortTypeImpl, insertion_sort_shift_left,
    |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_imports)]` on by default
  
  warning: unused import: `crate::slice::sort::shared::smallsort::insertion_sort_shift_left`
   --> /Users/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/slice/sort/unstable/mod.rs:8:5
    |
  8 | use crate::slice::sort::shared::smallsort::insertion_sort_shift_left;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  error[E0433]: failed to resolve: use of undeclared crate or module `tiny`
    --> /Users/runner/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/slice/sort/stable/mod.rs:65:13
     |
  65 |             tiny::mergesort(v, scratch, is_less);
     |             ^^^^ use of undeclared crate or module `tiny`

Last known-to-work commit: 6ce3767
First known-to-not-work commit: 1b5aa96

@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 25, 2024
@RalfJung RalfJung added O-AVR Target: AVR processors (ATtiny, ATmega, etc.) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 25, 2024
@RalfJung
Copy link
Member Author

Probably caused by #129587
Cc @Voultapher (but you're not expected to fix this since this is a tier 3 target)

@jieyouxu jieyouxu added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 25, 2024
bors added a commit to rust-lang/miri that referenced this issue Sep 25, 2024
switch custom target JSON test to a less exotic target

We used to test an AVR target here, but while it is nice to test a 16bit target, it is also currently the case that rustc CI does not even check that libcore builds on a 16bit target -- and we don't want Miri to be in the game of maintaining that support. (See rust-lang/rust#130818.)

So let's use a tier 2 target as the basis for testing a custom JSON target.

(FWIW, we also test wasm32-wasip2 which is tier 3, but I expect it will become tier 2 Soon-ish.)
@bors bors closed this as completed in 3a33523 Sep 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 25, 2024
Rollup merge of rust-lang#130832 - RalfJung:sort-cfg-mess, r=workingjubilee

fix some cfg logic around optimize_for_size and 16-bit targets

Fixes rust-lang#130818.
Fixes rust-lang#129910.

There are still some warnings when building on a 16bit target:
```
warning: struct `AlignedStorage` is never constructed
   --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/stable/mod.rs:135:8
    |
135 | struct AlignedStorage<T, const N: usize> {
    |        ^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: associated items `new` and `as_uninit_slice_mut` are never used
   --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/stable/mod.rs:141:8
    |
140 | impl<T, const N: usize> AlignedStorage<T, N> {
    | -------------------------------------------- associated items in this implementation
141 |     fn new() -> Self {
    |        ^^^
...
145 |     fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit<T>] {
    |        ^^^^^^^^^^^^^^^^^^^

warning: function `quicksort` is never used
  --> /home/r/src/rust/rustc.2/library/core/src/slice/sort/unstable/quicksort.rs:19:15
   |
19 | pub(crate) fn quicksort<'a, T, F>(
   |               ^^^^^^^^^

warning: `core` (lib) generated 3 warnings
```

However, the cfg stuff here is sufficiently messy that I didn't want to touch more of it. I think all `feature = "optimize_for_size"` should become `any(feature = "optimize_for_size", target_pointer_width = "16")` but I am not entirely certain. Warnings are fine, Miri will just ignore them.

Cc `@Voultapher`
RalfJung pushed a commit to RalfJung/rust that referenced this issue Sep 29, 2024
switch custom target JSON test to a less exotic target

We used to test an AVR target here, but while it is nice to test a 16bit target, it is also currently the case that rustc CI does not even check that libcore builds on a 16bit target -- and we don't want Miri to be in the game of maintaining that support. (See rust-lang#130818.)

So let's use a tier 2 target as the basis for testing a custom JSON target.

(FWIW, we also test wasm32-wasip2 which is tier 3, but I expect it will become tier 2 Soon-ish.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-AVR Target: AVR processors (ATtiny, ATmega, etc.) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants