-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Box
is marked as "dereferenceable" for the duration of the call
#66600
Comments
triage: P-high. Leaving nominated tag on it for now. |
The T-lang design team discussed this last night in their weekly meeting. It seems like we should indeed look into taking the short-term action of ceasing our emission of Some members of the Rust team should try to follow the LLVM-dev discussion of
But that is a much broader topic than the relatively limited issue at hand here in #66600. Regarding removal of (We generally believe that passing around a |
I can write the patch to remove |
@RalfJung well lets start with that and go from there. I bet another community member can handle the benchmarking if you provide a PR with the patch. |
Turns out I was a bit too quick to promise this... I think I traced the attribute to this part of codegen, but unfortunately that code ties "nonnull" and "dereferencable" together. (Though, interestingly, the type The goal is to make |
The code you linked doesn't seem like an obstacle for this change? As long as you can arrange for |
Ah, I didn't realize that And I am also not sure if that is right... the |
That would be super wrong, but empirically we don't get |
rust/src/librustc/ty/layout.rs Line 2214 in 083b5a0
There's also a The rust/src/librustc/ty/layout.rs Lines 2316 to 2322 in 083b5a0
Notice how it doesn't set any size. But it previously recursively traversed the field of |
But that (edit: meaning rust/src/librustc/ty/layout.rs Line 2214 in 083b5a0
PointeeInfo::size field, not ArgAttribute::pointee_size .
|
Yeah I know, but |
Here it is: rust/src/librustc/ty/layout.rs Line 2529 in 083b5a0
|
That's the line I linked earlier! Although I edited in, so I guess that's why you didn't see it. |
Yes so? |
Also you asked where |
Ask @eddyb, I guess 🤷♀
But crucially it doesn't get put there for raw pointers. So |
Ah, because that line copying it is guarded by So I guess that's what you meant. |
Yeah. Glad we're finally on the same page :) |
I just had to unfold some spaghetti first. ;) |
PR open at #66645 |
Box
is marked as "dereferencable" for the duration of the callBox
is marked as "dereferenceable" for the duration of the call
This function
compiles to
Notice the
dereferenceable
attribute! Under current LLVM semantics, this means "dereferenceable for the entire duration of this function body". That is, clearly, not accurate.This issue is closely related to #55005, but affects all
Box
instead of just a few uses of references, so I felt it is a separate discussion.I propose we remove the
dereferencable
attribute fromBox
for now. It seems like the situation might improve with future LLVM versions, but we should first make things sound.Thanks to @HadrienG2 for pointing this out. Cc @rust-lang/wg-unsafe-code-guidelines
The text was updated successfully, but these errors were encountered: