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

v0.11.2 doctests fail with Rust 1.78+ due to violated unsafe preconditions on x86_64-unknown-linux-gnu #69

Closed
decathorpe opened this issue May 21, 2024 · 4 comments
Labels

Comments

@decathorpe
Copy link

Since the update to Rust 1.78 (which enabled unsafe precondition checks in std under more circumstances), there are a number of doctests that now fail due to un-aligned or non-null pointers:

src/base.rs - base::from_bytes (line 38)
src/base.rs - base::from_bytes_pedantic (line 77)
src/base.rs - base::transmute_many (line 121)
src/base.rs - base::transmute_many_permissive (line 208)
src/trivial.rs - trivial::transmute_trivial (line 182)
src/trivial.rs - trivial::transmute_trivial_many (line 255)
src/trivial.rs - trivial::transmute_trivial_many_mut (line 292)
src/trivial.rs - trivial::transmute_trivial_pedantic (line 220)

The error messages are exactly the same for all of them (stack trace is long and not very interesting):

Test executable failed (signal: 6 (SIGABRT) (core dumped)).
stderr:
thread 'main' panicked at library/core/src/panicking.rs:156:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
@nabijaczleweli
Copy link
Owner

Host? norepro on rust 1.78 x86_64-pc-windows-gnu

@decathorpe
Copy link
Author

I got this failure on x86_64-unknown-linux-gnu (see issue title) - with Rust 1.78.0 (stable), on Fedora.

I forgot to mention that the failure is happening in v0.11.2, but not in git master. So this commit looks like it fixes the failure: 6e9520a

Would it be possible to get a new release with those fixes? Or should I backport them to the Fedora package?

@decathorpe decathorpe changed the title doctests fail with Rust 1.78+ due to violated unsafe preconditions on x86_64-unknow-linux-gnu v0.11.2 doctests fail with Rust 1.78+ due to violated unsafe preconditions on x86_64-unknow-linux-gnu May 21, 2024
@nabijaczleweli
Copy link
Owner

Released as v0.11.3

@nabijaczleweli nabijaczleweli changed the title v0.11.2 doctests fail with Rust 1.78+ due to violated unsafe preconditions on x86_64-unknow-linux-gnu v0.11.2 doctests fail with Rust 1.78+ due to violated unsafe preconditions on x86_64-unknown-linux-gnu May 21, 2024
@decathorpe
Copy link
Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants