Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe#95256
Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe#95256bors merged 3 commits intorust-lang:masterfrom
Conversation
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
Oh, maybe a compile_fail doctest. |
|
Maybe you can introduce the static_assertion::assert_no_impl_all!(std::io::Error: UnwindSafe) or write the const item yourself like: const _: fn() = || {
trait AmbiguousIfImpl<A> {
fn some_item() {}
}
impl<T: ?Sized> AmbiguousIfImpl<()> for T {}
impl<T: ?Sized + UnwindSafe> AmbiguousIfImpl<i32> for T {}
let _ = <io::Error as AmbiguousIfImpl<_>>::some_item;
};
}; |
|
Up to the reviewer. I'd rather not add a dependency to fix this if we aren't already depending on it. As it is, the compile_fail doctest does cover it, I've tested that it |
|
I think this could be tested with UI test, see tests in |
|
A downside of using UI tests (compared to the This is not a dealbreaker, but FWIW, I almost never run the full tests, and just let CI get them, but do run the tests for a specific area. |
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
|
@bors r+ |
|
📌 Commit 3ac93ab has been approved by |
|
(FWIW: We have compile_fail doctests on private types/fields in more places in core and std, for similar things.) |
Rollup of 4 pull requests Successful merges: - rust-lang#93840 (Stabilize Termination and ExitCode) - rust-lang#95256 (Ensure io::Error's bitpacked repr doesn't accidentally impl UnwindSafe) - rust-lang#95386 (Suggest wrapping patterns in enum variants) - rust-lang#95437 (diagnostics: regression test for derive bounds) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…roalbini Prepare 1.60.0 stable release This PR bumps the channel to stable, and backports the following PRs: * Miscellaneous release notes updates. * rust-lang#94817 * rust-lang#95256 r? `@ghost`
Sadly, I'm not sure how to easily test that we don't impl a trait, though (or can libstd use
where io::Error: !UnwindSafeor something).Fixes #95203