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

io::Error is UnwindSafe, but only on 64-bit platforms #95203

Closed
KamilaBorowska opened this issue Mar 22, 2022 · 6 comments · Fixed by #95256
Closed

io::Error is UnwindSafe, but only on 64-bit platforms #95203

KamilaBorowska opened this issue Mar 22, 2022 · 6 comments · Fixed by #95256
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@KamilaBorowska
Copy link
Contributor

KamilaBorowska commented Mar 22, 2022

Code

I tried this code:

use std::io;
use std::panic::UnwindSafe;

pub fn is_unwind_safe<T: UnwindSafe>() {}

fn main() {
    is_unwind_safe::<io::Error>();
}

I expected to see this happen: either it to compile or not compile.

Instead, this happened: it compiled but only on 64-bit platforms.

Version it worked on

It most recently worked on: Rust 1.59 (where it did not compile no matter what platform)

Version with regression

rustc --version --verbose:

rustc 1.60.0-beta.5 (6ee5a408a 2022-03-18)
binary: rustc
commit-hash: 6ee5a408a3bbc76598637d50450165917f8756bb
commit-date: 2022-03-18
host: x86_64-unknown-linux-gnu
release: 1.60.0-beta.5
LLVM version: 14.0.0

Backtrace

Backtrace

<backtrace>

@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged

@KamilaBorowska KamilaBorowska added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Mar 22, 2022
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-untriaged Untriaged performance or correctness regression. labels Mar 22, 2022
@compiler-errors
Copy link
Member

Not sure what the best approach is here.

We could just impl !UnwindSafe for io::Error to restore consistency from #87869 which made io::Error auto-implement UnwindSafe.

cc #94791

@apiraino
Copy link
Contributor

apiraino commented Mar 23, 2022

@xfix which non-64bit platform does reproduce the issue (not sure if this question matters a lot)?

@KamilaBorowska
Copy link
Contributor Author

KamilaBorowska commented Mar 23, 2022

@xfix which non-64bit platform does reproduce the issue (not sure if this question matters a lot)?

All platforms that have std and not(target_pointer_width = "64"). For example, i686-unknown-linux-gnu. This is caused by this code:

#[cfg(target_pointer_width = "64")]
mod repr_bitpacked;
#[cfg(target_pointer_width = "64")]
use repr_bitpacked::Repr;
#[cfg(not(target_pointer_width = "64"))]
mod repr_unpacked;
#[cfg(not(target_pointer_width = "64"))]
use repr_unpacked::Repr;

@thomcc
Copy link
Member

thomcc commented Mar 23, 2022

Ah, repr_bitpacked::Repr should have PhantomData<ErrorData<Box<Custom>>> or something along those lines. I'll get a fix for this up later this evening or tomorrow.

@thomcc
Copy link
Member

thomcc commented Mar 29, 2022

Hmm, this should probably not be closed, unless prioritization will still see it if it is closed.

@compiler-errors
Copy link
Member

Yeah, for backports I think the issue stays open until the backport is landed or decided against. Reopened for tracking.

@apiraino apiraino added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Mar 30, 2022
@m-ou-se m-ou-se added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 30, 2022
@m-ou-se m-ou-se closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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.

6 participants