-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement MIR lowering for unsafe binders #130514
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #130724) made this pull request unmergeable. Please resolve the merge conflicts. |
3aa766a
to
ce3fbcb
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #127117) made this pull request unmergeable. Please resolve the merge conflicts. |
…, r=oli-obk Add AST support for unsafe binders I'm splitting up rust-lang#130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later. r? `@oli-obk` cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
Rollup merge of rust-lang#134140 - compiler-errors:unsafe-binders-ast, r=oli-obk Add AST support for unsafe binders I'm splitting up rust-lang#130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later. r? `@oli-obk` cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
ce3fbcb
to
fab3984
Compare
This comment has been minimized.
This comment has been minimized.
…, r=oli-obk Add AST support for unsafe binders I'm splitting up rust-lang#130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later. r? `@oli-obk` cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
☔ The latest upstream changes (presumably #134414) made this pull request unmergeable. Please resolve the merge conflicts. |
9c432eb
to
b0f3844
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #134326) made this pull request unmergeable. Please resolve the merge conflicts. |
b0f3844
to
bfe01d2
Compare
bfe01d2
to
50d4440
Compare
// FIXME(unsafe_binders): Figure this out. | ||
Self::UnsafeBinderCast(..) => false, |
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.
My guess would be that since lifetimes are mono'd away, this is "allowed" in debug info because it's a no-op for the actual value?
Definitely don't trust me on that, though -- I know almost nothing about debug info.
.note = casting to or from an `unsafe<...>` binder type is unsafe since it erases lifetime | ||
information that may be required to uphold safety guarantees of a type |
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.
curiosity: I'm surprised that Foo<'specific>
to unsafe<'a> Foo<'a>
is unsafe.
Replacing the existential lifetime with a specific one is obviously unsafe to me, but I would have expected that "erasing" it was fine.
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.
When you cast something to an unsafe binder, you no longer require that casted region to be live (see: liveness), since it's erased. This certainly has implications on things like drop and other built-in impls of the type.
This is the final bit of the unsafe binders puzzle. It implement MIR and drop semantics for unsafe binders.
Namely, unsafe binders are implemented as a MIR projection.
Tracking: