Skip to content

Commit 5fcccd1

Browse files
committed
use NonHirLiteral instead of ScalarLiteral, move pattern related code to pat_is_poly in IsThirPolymorphic
1 parent 5e7f138 commit 5fcccd1

File tree

11 files changed

+28
-24
lines changed

11 files changed

+28
-24
lines changed

compiler/rustc_middle/src/thir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ pub enum ExprKind<'tcx> {
413413
neg: bool,
414414
},
415415
/// For literals that don't correspond to anything in the HIR
416-
ScalarLiteral {
416+
NonHirLiteral {
417417
lit: ty::ScalarInt,
418418
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
419419
},
@@ -454,7 +454,7 @@ pub enum ExprKind<'tcx> {
454454

455455
impl<'tcx> ExprKind<'tcx> {
456456
pub fn zero_sized_literal(user_ty: Option<Canonical<'tcx, UserType<'tcx>>>) -> Self {
457-
ExprKind::ScalarLiteral { lit: ty::ScalarInt::ZST, user_ty }
457+
ExprKind::NonHirLiteral { lit: ty::ScalarInt::ZST, user_ty }
458458
}
459459
}
460460

compiler/rustc_middle/src/thir/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
119119
}
120120
Closure { closure_id: _, substs: _, upvars: _, movability: _, fake_reads: _ } => {}
121121
Literal { lit: _, neg: _ } => {}
122-
ScalarLiteral { lit: _, user_ty: _ } => {}
122+
NonHirLiteral { lit: _, user_ty: _ } => {}
123123
NamedConst { def_id: _, substs: _, user_ty: _ } => {}
124124
ConstParam { param: _, def_id: _ } => {}
125125
StaticRef { alloc_id: _, ty: _, def_id: _ } => {}

compiler/rustc_mir_build/src/build/expr/as_constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
4545

4646
Constant { span, user_ty: None, literal: literal.into() }
4747
}
48-
ExprKind::ScalarLiteral { lit, user_ty } => {
48+
ExprKind::NonHirLiteral { lit, user_ty } => {
4949
let user_ty = user_ty.map(|user_ty| {
5050
this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
5151
span,

compiler/rustc_mir_build/src/build/expr/as_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
567567
| ExprKind::Return { .. }
568568
| ExprKind::Literal { .. }
569569
| ExprKind::NamedConst { .. }
570-
| ExprKind::ScalarLiteral { .. }
570+
| ExprKind::NonHirLiteral { .. }
571571
| ExprKind::ConstParam { .. }
572572
| ExprKind::ConstBlock { .. }
573573
| ExprKind::StaticRef { .. }

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
328328
ExprKind::Yield { .. }
329329
| ExprKind::Literal { .. }
330330
| ExprKind::NamedConst { .. }
331-
| ExprKind::ScalarLiteral { .. }
331+
| ExprKind::NonHirLiteral { .. }
332332
| ExprKind::ConstParam { .. }
333333
| ExprKind::ConstBlock { .. }
334334
| ExprKind::StaticRef { .. }

compiler/rustc_mir_build/src/build/expr/as_temp.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7070
local_decl.local_info =
7171
Some(Box::new(LocalInfo::StaticRef { def_id, is_thread_local: true }));
7272
}
73-
// FIXME Might have to include `ExprKind::ConstParam` here as well
74-
ExprKind::NamedConst { def_id, .. } => {
73+
ExprKind::NamedConst { def_id, .. } | ExprKind::ConstParam { def_id, .. } => {
7574
local_decl.local_info = Some(Box::new(LocalInfo::ConstRef { def_id }));
7675
}
7776
_ => {}

compiler/rustc_mir_build/src/build/expr/category.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Category {
7171

7272
ExprKind::ConstBlock { .. }
7373
| ExprKind::Literal { .. }
74-
| ExprKind::ScalarLiteral { .. }
74+
| ExprKind::NonHirLiteral { .. }
7575
| ExprKind::ConstParam { .. }
7676
| ExprKind::StaticRef { .. }
7777
| ExprKind::NamedConst { .. } => Some(Category::Constant),

compiler/rustc_mir_build/src/build/expr/into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
534534
| ExprKind::ConstBlock { .. }
535535
| ExprKind::Literal { .. }
536536
| ExprKind::NamedConst { .. }
537-
| ExprKind::ScalarLiteral { .. }
537+
| ExprKind::NonHirLiteral { .. }
538538
| ExprKind::ConstParam { .. }
539539
| ExprKind::ThreadLocalRef(_)
540540
| ExprKind::StaticRef { .. } => {

compiler/rustc_mir_build/src/check_unsafety.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
304304
| ExprKind::Borrow { .. }
305305
| ExprKind::Literal { .. }
306306
| ExprKind::NamedConst { .. }
307-
| ExprKind::ScalarLiteral { .. }
307+
| ExprKind::NonHirLiteral { .. }
308308
| ExprKind::ConstParam { .. }
309309
| ExprKind::ConstBlock { .. }
310310
| ExprKind::Deref { .. }

compiler/rustc_mir_build/src/thir/cx/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ impl<'tcx> Cx<'tcx> {
695695
})
696696
.size;
697697
let lit = ScalarInt::try_from_uint(offset as u128, size).unwrap();
698-
let kind = ExprKind::ScalarLiteral { lit, user_ty: None };
698+
let kind = ExprKind::NonHirLiteral { lit, user_ty: None };
699699
let offset = self.thir.exprs.push(Expr {
700700
temp_lifetime,
701701
ty: var_ty,

0 commit comments

Comments
 (0)