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

Bug in Rustc Version 1.77 #120349

Closed
jpx40 opened this issue Jan 25, 2024 · 10 comments
Closed

Bug in Rustc Version 1.77 #120349

jpx40 opened this issue Jan 25, 2024 · 10 comments
Labels
A-layout Area: Memory layout of types C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jpx40
Copy link

jpx40 commented Jan 25, 2024

Hey, i noticed an error in One of my deps, this error just started to get up on the Rust Nightly Version.
First Noticed on Version 1.77 2024-01-17

It was tested on Arm M2 MacBook and Arch Linux AMD x86_64.

The error stayed the same.

Repo: https://github.com/time-rs/time

File: https://github.com/time-rs/time/blob/main/time/src/parsing/parsed.rs

Line of the trait Parsed that fails in Line 116.

The Compiler fails to compile the Code of a function that mutates an byte Sequenz.

I tried this code:

 pub fn parse_item<'a>(
        &mut self,
        input: &'a [u8],
        item: &impl sealed::AnyFormatItem,
    ) -> Result<&'a [u8], error::ParseFromDescription> {
        item.parse_item(self, input)
    }

I expected to see this happen: explanation

Instead, this happened: explanation

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (7ffc697ce 2024-01-24)
binary: rustc
commit-hash: 7ffc697ce10f19447c0ce338428ae4b9bc0c041c
commit-date: 2024-01-24
host: aarch64-apple-darwin
release: 1.77.0-nightly
LLVM version: 17.0.6

Backtrace


failures:

---- meta::alignment stdout ----
thread 'meta::alignment' panicked at time/../tests/meta.rs:74:5:
assertion `left == right` failed: alignment of `Parsed` was 8
  left: 16
 right: 8
stack backtrace:
   0: rust_begin_unwind
             at /rustc/7ffc697ce10f19447c0ce338428ae4b9bc0c041c/library/std/src/panicking.rs:647:5
   1: core::panicking::panic_fmt
             at /rustc/7ffc697ce10f19447c0ce338428ae4b9bc0c041c/library/core/src/panicking.rs:72:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/7ffc697ce10f19447c0ce338428ae4b9bc0c041c/library/core/src/panicking.rs:297:5
   4: tests::meta::alignment
             at ./../tests/meta.rs:74:5
   5: tests::meta::alignment::{{closure}}
             at ./../tests/meta.rs:27:15
   6: core::ops::function::FnOnce::call_once
             at /rustc/7ffc697ce10f19447c0ce338428ae4b9bc0c041c/library/core/src/ops/function.rs:250:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/7ffc697ce10f19447c0ce338428ae4b9bc0c041c/library/core/src/ops/function.rs:250:5



failures:
    meta::alignment

test result: FAILED. 1399 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s

error: test failed, to rerun pass `--test tests`
test run_with_all_features ... FAILED

failures:

---- run_with_all_features stdout ----
Error: Error(ExitStatus(unix_wait_status(25856)))

@jpx40 jpx40 added the C-bug Category: This is a bug. label Jan 25, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 25, 2024
@ehuss
Copy link
Contributor

ehuss commented Jan 25, 2024

Can you say more about why this appears to be a new issue? From what I can tell, this test fails on all versions of Rust.

The test appears to be x86-specific. That is, on ARM, the alignment of a 128-bit value is 16, not 8 as it is on x86_64 architectures.

@jpx40
Copy link
Author

jpx40 commented Jan 25, 2024

Can you say more about why this appears to be a new issue? From what I can tell, this test fails on all versions of Rust.

The test appears to be x86-specific. That is, on ARM, the alignment of a 128-bit value is 16, not 8 as it is on x86_64 architectures.

Hey, sry i am not an expert in the byte spectrum. The error first appeared on my x86_64 Linux Machine. Later i tested the Code again on my Arm Notebook. A friend of did test the Code on x86_64 Intel too to close the circle.

Yeah the bug seems to be plattform independent.

@jpx40
Copy link
Author

jpx40 commented Jan 25, 2024

Can you say more about why this appears to be a new issue? From what I can tell, this test fails on all versions of Rust.

The test appears to be x86-specific. That is, on ARM, the alignment of a 128-bit value is 16, not 8 as it is on x86_64 architectures.

sry, i have to sleep, i will test again to more once. again on x86_64 machine to see if the are different Values. But the Code failed on the same Line.

@jpx40
Copy link
Author

jpx40 commented Jan 25, 2024

Can you say more about why this appears to be a new issue? From what I can tell, this test fails on all versions of Rust.

The test appears to be x86-specific. That is, on ARM, the alignment of a 128-bit value is 16, not 8 as it is on x86_64 architectures.

I have no glue. It was an dependency my Code, just figured out which crate failed and started to test the Code of time-rs against different rust Versions. It seems it still works in 1.75 and 1.76. worked (Sry to say it was tested on x86_64). 1.77 failed compiling

@ehuss
Copy link
Contributor

ehuss commented Jan 25, 2024

Ah, I see what you are saying now. This was an intentional change as part of #116672 to update the alignment of 128-bit types on x86.

@asquared31415
Copy link
Contributor

Additionally, the alignments of integer types are explicitly not guaranteed.

Most primitives are generally aligned to their size, although this is platform-specific behavior.

source

@jpx40
Copy link
Author

jpx40 commented Jan 26, 2024

I will send the backtrace of my own code later.

@Noratrieb
Copy link
Member

Thank you for the report, but this is an expected change as mentioned above. You need to update the test (or remove it, I'm not sure why it would be useful to have).
Closing.

@Noratrieb Noratrieb closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2024
@Noratrieb Noratrieb added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-layout Area: Memory layout of types C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 26, 2024
@asquared31415
Copy link
Contributor

It's occasionally useful to have layout tests to ensure that you don't accidentally change layout of something critical. Rustc even has many of these for some of its most commonly used types. But occasionally something like this happens which is out of your control and you just have to update the test and move on.

@jpx40
Copy link
Author

jpx40 commented Jan 26, 2024

It's occasionally useful to have layout tests to ensure that you don't accidentally change layout of something critical. Rustc even has many of these for some of its most commonly used types. But occasionally something like this happens which is out of your control and you just have to update the test and move on.

Ok, unfortunately I couldn't reconstruct the error in my own Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: Memory layout of types C-discussion Category: Discussion or questions that doesn't represent real issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants