-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc_typeck: Allow reification from fn item to unsafe ptr #37389
rustc_typeck: Allow reification from fn item to unsafe ptr #37389
Conversation
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
@@ -196,6 +196,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { | |||
// Function items are coercible to any closure | |||
// type; function pointers are not (that would | |||
// require double indirection). | |||
// Additionally, we permit coercin of function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: coercin -> coercion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
-> CoerceResult<'tcx> { | ||
if let ty::TyFnPtr(fn_ty_b) = b.sty { | ||
match (fn_ty_a.unsafety, fn_ty_b.unsafety) { | ||
(hir::Unsafety::Normal, hir::Unsafety::Unsafe) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks coercing from an I'm dumb!unsafe fn
item to an unsafe fn
pointer.
@bors r+ Thanks! |
📌 Commit 4bb6d4e has been approved by |
@bors r+ |
📌 Commit ab6119a has been approved by |
…-ptr, r=eddyb rustc_typeck: Allow reification from fn item to unsafe ptr See rust-lang/rfcs#1762. I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.
⌛ Testing commit ab6119a with merge 2b262cf... |
rustc_typeck: Allow reification from fn item to unsafe ptr See rust-lang/rfcs#1762. I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.
This feature enhancement landed insta-stable. I don't see any discussion of why that decision was made. Can somebody explain? |
@brson I opened up rust-lang/rfcs#1762 for discussion, but my impression from the comments there was that this was simply a missing implementation. The appropriate conversions already existed ( However, if this requires more discussion, I'd be happy to revert and open a more formal RFC. |
@brson |
I agree that this feels more like a bugfix than a language change. |
See rust-lang/rfcs#1762.
I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.