1
Fork 0

Remove unnecessary unsafe block around calls to discriminant_value

Since 63793 the discriminant_value intrinsic is safe to call. Remove
unnecessary unsafe block around calls to this intrinsic in built-in
derive macros.
This commit is contained in:
Tomasz Miąsko 2020-10-11 00:00:00 +00:00
parent c38f001db5
commit 50da126557
2 changed files with 16 additions and 15 deletions

View file

@ -68,7 +68,14 @@ fn call_intrinsic(
) -> P<ast::Expr> {
let span = cx.with_def_site_ctxt(span);
let path = cx.std_path(&[sym::intrinsics, intrinsic]);
let call = cx.expr_call_global(span, path, args);
cx.expr_call_global(span, path, args)
}
/// Constructs an expression that calls the `unreachable` intrinsic.
fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P<ast::Expr> {
let span = cx.with_def_site_ctxt(span);
let path = cx.std_path(&[sym::intrinsics, sym::unreachable]);
let call = cx.expr_call_global(span, path, vec![]);
cx.expr_block(P(ast::Block {
stmts: vec![cx.stmt_expr(call)],