Skip to content

Commit 857d27f

Browse files
authored
Rollup merge of #57658 - nnethercote:rm-hir-P-Lit, r=michaelwoerister
Two HIR tweaks Two HIR tweaks that make things slightly simpler and faster.
2 parents 0eb4bdc + dc45528 commit 857d27f

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3775,7 +3775,7 @@ impl<'a> LoweringContext<'a> {
37753775
let ohs = P(self.lower_expr(ohs));
37763776
hir::ExprKind::Unary(op, ohs)
37773777
}
3778-
ExprKind::Lit(ref l) => hir::ExprKind::Lit(P((*l).clone())),
3778+
ExprKind::Lit(ref l) => hir::ExprKind::Lit((*l).clone()),
37793779
ExprKind::Cast(ref expr, ref ty) => {
37803780
let expr = P(self.lower_expr(expr));
37813781
hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed()))

src/librustc/hir/mod.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
1919
use syntax::source_map::{self, Spanned};
2020
use rustc_target::spec::abi::Abi;
2121
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
22-
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy};
22+
use syntax::ast::{Attribute, Label, Lit, StrStyle, FloatTy, IntTy, UintTy};
2323
use syntax::attr::InlineAttr;
2424
use syntax::ext::hygiene::SyntaxContext;
2525
use syntax::ptr::P;
@@ -142,17 +142,6 @@ pub const DUMMY_HIR_ID: HirId = HirId {
142142

143143
pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX;
144144

145-
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
146-
pub struct Label {
147-
pub ident: Ident,
148-
}
149-
150-
impl fmt::Debug for Label {
151-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
152-
write!(f, "label({:?})", self.ident)
153-
}
154-
}
155-
156145
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
157146
pub struct Lifetime {
158147
pub id: NodeId,
@@ -1466,7 +1455,7 @@ pub enum ExprKind {
14661455
/// A unary operation (For example: `!x`, `*x`)
14671456
Unary(UnOp, P<Expr>),
14681457
/// A literal (For example: `1`, `"foo"`)
1469-
Lit(P<Lit>),
1458+
Lit(Lit),
14701459
/// A cast (`foo as f64`)
14711460
Cast(P<Expr>, P<Ty>),
14721461
Type(P<Expr>, P<Ty>),

src/librustc/ich/impls_hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl_stable_hash_for!(enum hir::LifetimeName {
153153
Error,
154154
});
155155

156-
impl_stable_hash_for!(struct hir::Label {
156+
impl_stable_hash_for!(struct ast::Label {
157157
ident
158158
});
159159

0 commit comments

Comments
 (0)