1
Fork 0

use NonHirLiteral instead of ScalarLiteral, move pattern related code to pat_is_poly in IsThirPolymorphic

This commit is contained in:
b-naber 2022-03-23 08:47:11 +01:00
parent 5e7f1380f6
commit 5fcccd1739
11 changed files with 28 additions and 24 deletions

View file

@ -45,7 +45,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Constant { span, user_ty: None, literal: literal.into() }
}
ExprKind::ScalarLiteral { lit, user_ty } => {
ExprKind::NonHirLiteral { lit, user_ty } => {
let user_ty = user_ty.map(|user_ty| {
this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation {
span,

View file

@ -567,7 +567,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
| ExprKind::Return { .. }
| ExprKind::Literal { .. }
| ExprKind::NamedConst { .. }
| ExprKind::ScalarLiteral { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ConstParam { .. }
| ExprKind::ConstBlock { .. }
| ExprKind::StaticRef { .. }

View file

@ -328,7 +328,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
ExprKind::Yield { .. }
| ExprKind::Literal { .. }
| ExprKind::NamedConst { .. }
| ExprKind::ScalarLiteral { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ConstParam { .. }
| ExprKind::ConstBlock { .. }
| ExprKind::StaticRef { .. }

View file

@ -70,8 +70,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
local_decl.local_info =
Some(Box::new(LocalInfo::StaticRef { def_id, is_thread_local: true }));
}
// FIXME Might have to include `ExprKind::ConstParam` here as well
ExprKind::NamedConst { def_id, .. } => {
ExprKind::NamedConst { def_id, .. } | ExprKind::ConstParam { def_id, .. } => {
local_decl.local_info = Some(Box::new(LocalInfo::ConstRef { def_id }));
}
_ => {}

View file

@ -71,7 +71,7 @@ impl Category {
ExprKind::ConstBlock { .. }
| ExprKind::Literal { .. }
| ExprKind::ScalarLiteral { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ConstParam { .. }
| ExprKind::StaticRef { .. }
| ExprKind::NamedConst { .. } => Some(Category::Constant),

View file

@ -534,7 +534,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
| ExprKind::ConstBlock { .. }
| ExprKind::Literal { .. }
| ExprKind::NamedConst { .. }
| ExprKind::ScalarLiteral { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ConstParam { .. }
| ExprKind::ThreadLocalRef(_)
| ExprKind::StaticRef { .. } => {

View file

@ -304,7 +304,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
| ExprKind::Borrow { .. }
| ExprKind::Literal { .. }
| ExprKind::NamedConst { .. }
| ExprKind::ScalarLiteral { .. }
| ExprKind::NonHirLiteral { .. }
| ExprKind::ConstParam { .. }
| ExprKind::ConstBlock { .. }
| ExprKind::Deref { .. }

View file

@ -695,7 +695,7 @@ impl<'tcx> Cx<'tcx> {
})
.size;
let lit = ScalarInt::try_from_uint(offset as u128, size).unwrap();
let kind = ExprKind::ScalarLiteral { lit, user_ty: None };
let kind = ExprKind::NonHirLiteral { lit, user_ty: None };
let offset = self.thir.exprs.push(Expr {
temp_lifetime,
ty: var_ty,