use rustc_index::vec::IndexVec;
use rustc_middle::infer::canonical::Canonical;
use rustc_middle::middle::region;
+use rustc_middle::mir::interpret::AllocId;
use rustc_middle::mir::{
BinOp, BorrowKind, FakeReadCause, Field, Mutability, UnOp, UserTypeProjection,
};
#[derive(Debug, HashStable)]
pub enum ExprKind<'tcx> {
- /// `Scope`s are used to explicitely mark destruction scopes,
+ /// `Scope`s are used to explicitly mark destruction scopes,
/// and to track the `HirId` of the expressions within the scope.
Scope {
region_scope: region::Scope,
},
/// An inline `const` block, e.g. `const {}`.
ConstBlock {
- value: &'tcx Const<'tcx>,
+ value: Const<'tcx>,
},
/// An array literal constructed from one repeated element, e.g. `[1; 5]`.
Repeat {
value: ExprId,
- count: &'tcx Const<'tcx>,
+ count: Const<'tcx>,
},
/// An array, e.g. `[a, b, c, d]`.
Array {
},
/// A literal.
Literal {
- literal: &'tcx Const<'tcx>,
+ literal: Const<'tcx>,
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
/// The `DefId` of the `const` item this literal
/// was produced from, if this is not a user-written
/// This is only distinguished from `Literal` so that we can register some
/// info for diagnostics.
StaticRef {
- literal: &'tcx Const<'tcx>,
+ alloc_id: AllocId,
+ ty: Ty<'tcx>,
def_id: DefId,
},
/// Inline assembly, i.e. `asm!()`.
},
/// An expression taking a reference to a thread local.
ThreadLocalRef(DefId),
- /// Inline LLVM assembly, i.e. `llvm_asm!()`.
- LlvmInlineAsm {
- asm: &'tcx hir::LlvmInlineAsmInner,
- outputs: Box<[ExprId]>,
- inputs: Box<[ExprId]>,
- },
/// A `yield` expression.
Yield {
value: ExprId,
out_expr: Option<ExprId>,
},
Const {
- value: &'tcx Const<'tcx>,
+ value: Const<'tcx>,
span: Span,
},
SymFn {
/// * Opaque constants, that must not be matched structurally. So anything that does not derive
/// `PartialEq` and `Eq`.
Constant {
- value: &'tcx ty::Const<'tcx>,
+ value: ty::Const<'tcx>,
},
Range(PatRange<'tcx>),
#[derive(Copy, Clone, Debug, PartialEq, HashStable)]
pub struct PatRange<'tcx> {
- pub lo: &'tcx ty::Const<'tcx>,
- pub hi: &'tcx ty::Const<'tcx>,
+ pub lo: ty::Const<'tcx>,
+ pub hi: ty::Const<'tcx>,
pub end: RangeEnd,
}
};
if let Some(variant) = variant {
- write!(f, "{}", variant.ident)?;
+ write!(f, "{}", variant.name)?;
// Only for Adt we can have `S {...}`,
// which we handle separately here.
if let PatKind::Wild = *p.pattern.kind {
continue;
}
- let name = variant.fields[p.field.index()].ident;
+ let name = variant.fields[p.field.index()].name;
write!(f, "{}{}: {}", start_or_comma(), name, p.pattern)?;
printed += 1;
}