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

fix some cfg logic around optimize_for_size and 16-bit targets #130832

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Sep 25, 2024

Fixes #130818.
Fixes #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

@rustbot
Copy link
Collaborator

rustbot commented Sep 25, 2024

r? @workingjubilee

rustbot has assigned @workingjubilee.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Contributor

@Voultapher Voultapher left a comment

Choose a reason for hiding this comment

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

LGTM

@RalfJung RalfJung added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2024
@jieyouxu jieyouxu added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 25, 2024
@workingjubilee
Copy link
Member

I think I specifically suggested something like this, so
@bors r+ rollup

this should only affect tier 3 targets, thus cannot fail in CI.

@bors
Copy link
Contributor

bors commented Sep 25, 2024

📌 Commit 1151eb1 has been approved by workingjubilee

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2024
@Voultapher
Copy link
Contributor

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.

There is a small difference where, opt-for-size uses stack allocation, and 16-bit targets don't, so it shouldn't be changed wholesale.

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#130735 (Simple validation for unsize coercion in MIR validation)
 - rust-lang#130781 (Fix up setting strip = true in Cargo.toml makes build scripts fail in…)
 - rust-lang#130811 (add link from random() helper fn to extensive DefaultRandomSource docs)
 - rust-lang#130819 (Add `must_use` attribute to `len_utf8` and `len_utf16`.)
 - rust-lang#130832 (fix some cfg logic around optimize_for_size and 16-bit targets)
 - rust-lang#130842 (Add tracking issue for io_error_inprogress)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3a33523 into rust-lang:master Sep 25, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request 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 RalfJung deleted the sort-cfg-mess branch September 26, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcore no longer builds for AVR driftsort implementation uses an out-of-range literal on 16-bit targets
6 participants