mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Remove #[rustc_box] attr during lowering
This commit is contained in:
parent
535e28b6c6
commit
0a24b9493b
@ -42,13 +42,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||||||
ExprKind::Tup(ref elts) => hir::ExprKind::Tup(self.lower_exprs(elts)),
|
ExprKind::Tup(ref elts) => hir::ExprKind::Tup(self.lower_exprs(elts)),
|
||||||
ExprKind::Call(ref f, ref args) => {
|
ExprKind::Call(ref f, ref args) => {
|
||||||
if e.attrs.get(0).map_or(false, |a| a.has_name(sym::rustc_box)) {
|
if e.attrs.get(0).map_or(false, |a| a.has_name(sym::rustc_box)) {
|
||||||
if let [inner] = &args[..] {
|
if let [inner] = &args[..] && e.attrs.len() == 1 {
|
||||||
hir::ExprKind::Box(self.lower_expr(&inner))
|
let kind = hir::ExprKind::Box(self.lower_expr(&inner));
|
||||||
|
let hir_id = self.lower_node_id(e.id);
|
||||||
|
return hir::Expr { hir_id, kind, span: self.lower_span(e.span) };
|
||||||
} else {
|
} else {
|
||||||
self.sess
|
self.sess
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
e.span,
|
e.span,
|
||||||
"rustc_box requires precisely one argument",
|
"#[rustc_box] requires precisely one argument \
|
||||||
|
and no other attributes are allowed",
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
hir::ExprKind::Err
|
hir::ExprKind::Err
|
||||||
|
Loading…
Reference in New Issue
Block a user