Conversation
There was a problem hiding this comment.
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
exprparsing - Add
unsafe_kwmethod 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
LazyBlockExprSpanand add a method to be able to getunsafespan
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
unsafeexpressions.e.g.