-
Notifications
You must be signed in to change notification settings - Fork 188
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
unsafe
expr parsing
#991
base: fe-v2
Are you sure you want to change the base?
unsafe
expr parsing
#991
Conversation
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.
unsafe
should be applied to block
expression. Please consider this example.
let x = unsafe {
unsafe_fn()
}
So basically, what you need to do is
- Modify
expr
parsing - Add
unsafe_kw
method toast::BlockExpr
- Modify
hir::Expr::Block(Vec<StmtId>)
tohir::Expr::Block(Vec<StmtId>, bool)
orhir::Expr::Block{ stmts: Vec<StmtId>, is_unsafe: bool }
- Modify
hir::lower::expr::Expr::lower_ast
- Define
LazyBlockExprSpan
and add a method to be able to getunsafe
span
3ad97f3
to
c80078a
Compare
a5a1bfe
to
21cf6e9
Compare
c362d7d
to
e096a5a
Compare
da36247
to
1645bf6
Compare
I will add unsafe expr checking to this as well. |
It's still unclear to me what the |
In general, code should be labeled as |
Ok. So, in the v1 implementation, there are functions that don't cause undefined behavior (UB) but are still marked as unsafe, like |
That is correct. I agree that |
Ok, thanks! |
Implemented parsing for
unsafe
expressions.e.g.