-
Notifications
You must be signed in to change notification settings - Fork 273
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
adjust for current reality wrt. wide raw pointers #162
Conversation
Turns out that for raw slices, the length condition can be violated in safe code. So maybe I should just remove the slice condition here, effectively making it part of the safety invariant but not the validity invariant? That would preclude layout optimizations but otherwise not make much of a difference. |
I fixed the slice situation. |
I am a bit confused: is it really UB to just call a function that you think is no-unwind, but actually can unwind? Like, you don't need to actually unwind for it to be UB? |
@gnzlbg see above. I used your wording, there are still open questions. |
I think this works in practice for most unwinding ABIs, I don't know if it works for all. Does any unwinding ABI require caller cooperation even when the callee does not unwind? (cc @comex ?).
Due to something like rust-lang/unsafe-code-guidelines#198 one doesn't even need to call it for it to be UB. For example, see https://rust.godbolt.org/z/HQ0fvA #![feature(unwind_attributes)]
pub mod bad0 {
extern "C" { fn foo(); }
pub unsafe fn call() -> usize { foo as usize }
}
pub mod bad1 {
extern "C" { #[unwind(allow)] fn foo(); }
pub unsafe fn call() { foo() } // UB because `foo` is nounwind because bad0::foo is nounwind
} We can probably fix that by never making extern declarations |
Co-Authored-By: gnzlbg <gnzlbg@users.noreply.github.com>
I don't know of any that do. Even the WebAssembly and JSBackend exception ABIs, which operate at a higher level than native ones, don't change the signature of the function itself. Of course, who knows what will be invented in the future. I remember someone (maybe even you?) proposing that Rust could invent its own portable unwinding mechanism based on effectively wrapping all function return values in |
since those would be new calling conventions, we can add define that UB if they ever come into existence, right? |
We would likely want to disallow The current |
Maybe? The problem is that Still, for the wording here, does changing "call ABI or unwinding ABI" to "call ABI" or even just "ABI" make a difference? We haven't written down anywhere whether the unwinding ABI is part of the call ABI or not, and it is arguably part of the "ABI" in general...
Are you referring to: https://github.com/CraneStation/cranelift/issues/553 ? |
In terms of wording I would propose something like
|
FWIW, the corresponding Reference PR landed (which is in sync with this one). |
PSA i am dealing with medecine issues atm and am completely out of my mind and in too much pain to think for the forseeable |
@Gankra I hope you get well soon, take care! |
@Gankra all the best! So how to we handle the nomicon in the mean time? Are there other editors? @Centril do you know? Are you fine landing this PR, to get Nomicon and reference in sync (now that we merged rust-lang/reference#659)? |
I don't have r+ in this repo myself but I think the reference editors + UCG + T-lang should have r+ here. That said I think I'd need to actually review the PR first myself. ;) |
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Reference editors + T-lang sounds reasonable; UCG doesn't really have a formal notion of "membership" but I guess we could suggest some people to T-lang and see if T-lang is happy giving them r+ for the Nomicon. Which team is the one to make such decisions? |
Could you give invite T-lang as maintainers of this repo, or at least @Centril ? |
I can make the changes to permissions, yes, but I shouldn't be the one deciding those. |
@Centril can T-lang decide whether they can give themselves permissions for this repo or shall that be decided by the core team? 😆 |
@pietroalbini As a start, can you grant the lang-team members, ehuss, matthewjasper, and RalfJung r+? |
@Centril have we considered the fact the lang team doesn't exist on the nursery? 🙃 |
@pietroalibini Yes, give the permissions to individuals for now instead. |
Invited some people. |
Maybe the nomicon and the reference shouldn't live on the nursery, but on rust-lang/rust proper? |
@pietroalbini seems like a good idea to move both the nomicon and the reference. |
Just want to throw my hat out there again that I think the nomicon should be in the rust-lang/rust repo so that unstable code examples can be atomically adjusted along with the APIs. |
Adjust for rust-lang/rust#63851