Auto merge of #109590 - Nilstrieb:copy-hir, r=oli-obk
Impl `Copy` for most HIR types This simplifies the invocation of the `arena_types` macro and probably makes working with HIR nicer in general. Based on #109588
This commit is contained in:
commit
f65615f02d
4 changed files with 72 additions and 111 deletions
|
@ -443,7 +443,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||||
ItemKind::MacroDef(MacroDef { body, macro_rules }) => {
|
ItemKind::MacroDef(MacroDef { body, macro_rules }) => {
|
||||||
let body = P(self.lower_delim_args(body));
|
let body = P(self.lower_delim_args(body));
|
||||||
let macro_kind = self.resolver.decl_macro_kind(self.local_def_id(id));
|
let macro_kind = self.resolver.decl_macro_kind(self.local_def_id(id));
|
||||||
hir::ItemKind::Macro(ast::MacroDef { body, macro_rules: *macro_rules }, macro_kind)
|
let macro_def = self.arena.alloc(ast::MacroDef { body, macro_rules: *macro_rules });
|
||||||
|
hir::ItemKind::Macro(macro_def, macro_kind)
|
||||||
}
|
}
|
||||||
ItemKind::MacCall(..) => {
|
ItemKind::MacCall(..) => {
|
||||||
panic!("`TyMac` should have been expanded by now")
|
panic!("`TyMac` should have been expanded by now")
|
||||||
|
|
|
@ -1,57 +1,17 @@
|
||||||
/// This higher-order macro declares a list of types which can be allocated by `Arena`.
|
/// This higher-order macro declares a list of types which can be allocated by `Arena`.
|
||||||
///
|
/// Note that all `Copy` types can be allocated by default and need not be specified here.
|
||||||
/// Specifying the `decode` modifier will add decode impls for `&T` and `&[T]`,
|
|
||||||
/// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! arena_types {
|
macro_rules! arena_types {
|
||||||
($macro:path) => (
|
($macro:path) => (
|
||||||
$macro!([
|
$macro!([
|
||||||
// HIR types
|
// HIR types
|
||||||
[] hir_krate: rustc_hir::Crate<'tcx>,
|
[] hir_krate: rustc_hir::Crate<'tcx>,
|
||||||
[] arm: rustc_hir::Arm<'tcx>,
|
|
||||||
[] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, rustc_span::Span),
|
|
||||||
[] asm_template: rustc_ast::InlineAsmTemplatePiece,
|
[] asm_template: rustc_ast::InlineAsmTemplatePiece,
|
||||||
[] attribute: rustc_ast::Attribute,
|
[] attribute: rustc_ast::Attribute,
|
||||||
[] closure: rustc_hir::Closure<'tcx>,
|
|
||||||
[] block: rustc_hir::Block<'tcx>,
|
|
||||||
[] bare_fn_ty: rustc_hir::BareFnTy<'tcx>,
|
|
||||||
[] body: rustc_hir::Body<'tcx>,
|
|
||||||
[] generics: rustc_hir::Generics<'tcx>,
|
|
||||||
[] generic_arg: rustc_hir::GenericArg<'tcx>,
|
|
||||||
[] generic_args: rustc_hir::GenericArgs<'tcx>,
|
|
||||||
[] generic_bound: rustc_hir::GenericBound<'tcx>,
|
|
||||||
[] generic_param: rustc_hir::GenericParam<'tcx>,
|
|
||||||
[] expr: rustc_hir::Expr<'tcx>,
|
|
||||||
[] impl_: rustc_hir::Impl<'tcx>,
|
|
||||||
[] let_expr: rustc_hir::Let<'tcx>,
|
|
||||||
[] expr_field: rustc_hir::ExprField<'tcx>,
|
|
||||||
[] pat_field: rustc_hir::PatField<'tcx>,
|
|
||||||
[] fn_decl: rustc_hir::FnDecl<'tcx>,
|
|
||||||
[] foreign_item: rustc_hir::ForeignItem<'tcx>,
|
|
||||||
[] foreign_item_ref: rustc_hir::ForeignItemRef,
|
|
||||||
[] impl_item: rustc_hir::ImplItem<'tcx>,
|
|
||||||
[] impl_item_ref: rustc_hir::ImplItemRef,
|
|
||||||
[] item: rustc_hir::Item<'tcx>,
|
|
||||||
[] inline_asm: rustc_hir::InlineAsm<'tcx>,
|
|
||||||
[] local: rustc_hir::Local<'tcx>,
|
|
||||||
[] mod_: rustc_hir::Mod<'tcx>,
|
|
||||||
[] owner_info: rustc_hir::OwnerInfo<'tcx>,
|
[] owner_info: rustc_hir::OwnerInfo<'tcx>,
|
||||||
[] param: rustc_hir::Param<'tcx>,
|
|
||||||
[] pat: rustc_hir::Pat<'tcx>,
|
|
||||||
[] path: rustc_hir::Path<'tcx>,
|
|
||||||
[] use_path: rustc_hir::UsePath<'tcx>,
|
[] use_path: rustc_hir::UsePath<'tcx>,
|
||||||
[] path_segment: rustc_hir::PathSegment<'tcx>,
|
|
||||||
[] poly_trait_ref: rustc_hir::PolyTraitRef<'tcx>,
|
|
||||||
[] qpath: rustc_hir::QPath<'tcx>,
|
|
||||||
[] stmt: rustc_hir::Stmt<'tcx>,
|
|
||||||
[] field_def: rustc_hir::FieldDef<'tcx>,
|
|
||||||
[] trait_item: rustc_hir::TraitItem<'tcx>,
|
|
||||||
[] trait_item_ref: rustc_hir::TraitItemRef,
|
|
||||||
[] ty: rustc_hir::Ty<'tcx>,
|
|
||||||
[] type_binding: rustc_hir::TypeBinding<'tcx>,
|
|
||||||
[] variant: rustc_hir::Variant<'tcx>,
|
|
||||||
[] where_predicate: rustc_hir::WherePredicate<'tcx>,
|
|
||||||
[] lit: rustc_hir::Lit,
|
[] lit: rustc_hir::Lit,
|
||||||
|
[] macro_def: rustc_ast::MacroDef,
|
||||||
]);
|
]);
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ impl Lifetime {
|
||||||
/// A `Path` is essentially Rust's notion of a name; for instance,
|
/// A `Path` is essentially Rust's notion of a name; for instance,
|
||||||
/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
|
/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
|
||||||
/// along with a bunch of supporting information.
|
/// along with a bunch of supporting information.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Path<'hir, R = Res> {
|
pub struct Path<'hir, R = Res> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// The resolution for the path.
|
/// The resolution for the path.
|
||||||
|
@ -202,7 +202,7 @@ impl Path<'_> {
|
||||||
|
|
||||||
/// A segment of a path: an identifier, an optional lifetime, and a set of
|
/// A segment of a path: an identifier, an optional lifetime, and a set of
|
||||||
/// types.
|
/// types.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct PathSegment<'hir> {
|
pub struct PathSegment<'hir> {
|
||||||
/// The identifier portion of this path segment.
|
/// The identifier portion of this path segment.
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -243,13 +243,13 @@ impl<'hir> PathSegment<'hir> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Clone, Copy, Debug, HashStable_Generic)]
|
||||||
pub struct ConstArg {
|
pub struct ConstArg {
|
||||||
pub value: AnonConst,
|
pub value: AnonConst,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Clone, Copy, Debug, HashStable_Generic)]
|
||||||
pub struct InferArg {
|
pub struct InferArg {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -261,7 +261,7 @@ impl InferArg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum GenericArg<'hir> {
|
pub enum GenericArg<'hir> {
|
||||||
Lifetime(&'hir Lifetime),
|
Lifetime(&'hir Lifetime),
|
||||||
Type(&'hir Ty<'hir>),
|
Type(&'hir Ty<'hir>),
|
||||||
|
@ -318,7 +318,7 @@ impl GenericArg<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct GenericArgs<'hir> {
|
pub struct GenericArgs<'hir> {
|
||||||
/// The generic arguments for this path segment.
|
/// The generic arguments for this path segment.
|
||||||
pub args: &'hir [GenericArg<'hir>],
|
pub args: &'hir [GenericArg<'hir>],
|
||||||
|
@ -447,7 +447,7 @@ pub enum TraitBoundModifier {
|
||||||
/// `typeck::collect::compute_bounds` matches these against
|
/// `typeck::collect::compute_bounds` matches these against
|
||||||
/// the "special" built-in traits (see `middle::lang_items`) and
|
/// the "special" built-in traits (see `middle::lang_items`) and
|
||||||
/// detects `Copy`, `Send` and `Sync`.
|
/// detects `Copy`, `Send` and `Sync`.
|
||||||
#[derive(Clone, Debug, HashStable_Generic)]
|
#[derive(Clone, Copy, Debug, HashStable_Generic)]
|
||||||
pub enum GenericBound<'hir> {
|
pub enum GenericBound<'hir> {
|
||||||
Trait(PolyTraitRef<'hir>, TraitBoundModifier),
|
Trait(PolyTraitRef<'hir>, TraitBoundModifier),
|
||||||
// FIXME(davidtwco): Introduce `PolyTraitRef::LangItem`
|
// FIXME(davidtwco): Introduce `PolyTraitRef::LangItem`
|
||||||
|
@ -488,7 +488,7 @@ pub enum LifetimeParamKind {
|
||||||
Error,
|
Error,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum GenericParamKind<'hir> {
|
pub enum GenericParamKind<'hir> {
|
||||||
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
|
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
|
||||||
Lifetime {
|
Lifetime {
|
||||||
|
@ -505,7 +505,7 @@ pub enum GenericParamKind<'hir> {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct GenericParam<'hir> {
|
pub struct GenericParam<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub def_id: LocalDefId,
|
pub def_id: LocalDefId,
|
||||||
|
@ -557,7 +557,7 @@ pub struct GenericParamCount {
|
||||||
|
|
||||||
/// Represents lifetimes and type parameters attached to a declaration
|
/// Represents lifetimes and type parameters attached to a declaration
|
||||||
/// of a function, enum, trait, etc.
|
/// of a function, enum, trait, etc.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Generics<'hir> {
|
pub struct Generics<'hir> {
|
||||||
pub params: &'hir [GenericParam<'hir>],
|
pub params: &'hir [GenericParam<'hir>],
|
||||||
pub predicates: &'hir [WherePredicate<'hir>],
|
pub predicates: &'hir [WherePredicate<'hir>],
|
||||||
|
@ -729,7 +729,7 @@ impl<'hir> Generics<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single predicate in a where-clause.
|
/// A single predicate in a where-clause.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum WherePredicate<'hir> {
|
pub enum WherePredicate<'hir> {
|
||||||
/// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`).
|
/// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`).
|
||||||
BoundPredicate(WhereBoundPredicate<'hir>),
|
BoundPredicate(WhereBoundPredicate<'hir>),
|
||||||
|
@ -773,7 +773,7 @@ pub enum PredicateOrigin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
|
/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct WhereBoundPredicate<'hir> {
|
pub struct WhereBoundPredicate<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -795,7 +795,7 @@ impl<'hir> WhereBoundPredicate<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A lifetime predicate (e.g., `'a: 'b + 'c`).
|
/// A lifetime predicate (e.g., `'a: 'b + 'c`).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct WhereRegionPredicate<'hir> {
|
pub struct WhereRegionPredicate<'hir> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub in_where_clause: bool,
|
pub in_where_clause: bool,
|
||||||
|
@ -811,7 +811,7 @@ impl<'hir> WhereRegionPredicate<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An equality predicate (e.g., `T = int`); currently unsupported.
|
/// An equality predicate (e.g., `T = int`); currently unsupported.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct WhereEqPredicate<'hir> {
|
pub struct WhereEqPredicate<'hir> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub lhs_ty: &'hir Ty<'hir>,
|
pub lhs_ty: &'hir Ty<'hir>,
|
||||||
|
@ -821,7 +821,7 @@ pub struct WhereEqPredicate<'hir> {
|
||||||
/// HIR node coupled with its parent's id in the same HIR owner.
|
/// HIR node coupled with its parent's id in the same HIR owner.
|
||||||
///
|
///
|
||||||
/// The parent is trash when the node is a HIR owner.
|
/// The parent is trash when the node is a HIR owner.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct ParentedNode<'tcx> {
|
pub struct ParentedNode<'tcx> {
|
||||||
pub parent: ItemLocalId,
|
pub parent: ItemLocalId,
|
||||||
pub node: Node<'tcx>,
|
pub node: Node<'tcx>,
|
||||||
|
@ -959,7 +959,7 @@ pub struct Crate<'hir> {
|
||||||
pub opt_hir_hash: Option<Fingerprint>,
|
pub opt_hir_hash: Option<Fingerprint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Closure<'hir> {
|
pub struct Closure<'hir> {
|
||||||
pub def_id: LocalDefId,
|
pub def_id: LocalDefId,
|
||||||
pub binder: ClosureBinder,
|
pub binder: ClosureBinder,
|
||||||
|
@ -978,7 +978,7 @@ pub struct Closure<'hir> {
|
||||||
/// A block of statements `{ .. }`, which may have a label (in this case the
|
/// A block of statements `{ .. }`, which may have a label (in this case the
|
||||||
/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
|
/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
|
||||||
/// the `rules` being anything but `DefaultBlock`.
|
/// the `rules` being anything but `DefaultBlock`.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Block<'hir> {
|
pub struct Block<'hir> {
|
||||||
/// Statements in a block.
|
/// Statements in a block.
|
||||||
pub stmts: &'hir [Stmt<'hir>],
|
pub stmts: &'hir [Stmt<'hir>],
|
||||||
|
@ -1006,7 +1006,7 @@ impl<'hir> Block<'hir> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Pat<'hir> {
|
pub struct Pat<'hir> {
|
||||||
#[stable_hasher(ignore)]
|
#[stable_hasher(ignore)]
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -1085,7 +1085,7 @@ impl<'hir> Pat<'hir> {
|
||||||
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
||||||
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
||||||
/// except `is_shorthand` is true.
|
/// except `is_shorthand` is true.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct PatField<'hir> {
|
pub struct PatField<'hir> {
|
||||||
#[stable_hasher(ignore)]
|
#[stable_hasher(ignore)]
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -1141,7 +1141,7 @@ impl fmt::Debug for DotDotPos {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum PatKind<'hir> {
|
pub enum PatKind<'hir> {
|
||||||
/// Represents a wildcard pattern (i.e., `_`).
|
/// Represents a wildcard pattern (i.e., `_`).
|
||||||
Wild,
|
Wild,
|
||||||
|
@ -1351,7 +1351,7 @@ impl UnOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A statement.
|
/// A statement.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Stmt<'hir> {
|
pub struct Stmt<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub kind: StmtKind<'hir>,
|
pub kind: StmtKind<'hir>,
|
||||||
|
@ -1359,7 +1359,7 @@ pub struct Stmt<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The contents of a statement.
|
/// The contents of a statement.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum StmtKind<'hir> {
|
pub enum StmtKind<'hir> {
|
||||||
/// A local (`let`) binding.
|
/// A local (`let`) binding.
|
||||||
Local(&'hir Local<'hir>),
|
Local(&'hir Local<'hir>),
|
||||||
|
@ -1375,7 +1375,7 @@ pub enum StmtKind<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
|
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Local<'hir> {
|
pub struct Local<'hir> {
|
||||||
pub pat: &'hir Pat<'hir>,
|
pub pat: &'hir Pat<'hir>,
|
||||||
/// Type annotation, if any (otherwise the type will be inferred).
|
/// Type annotation, if any (otherwise the type will be inferred).
|
||||||
|
@ -1393,7 +1393,7 @@ pub struct Local<'hir> {
|
||||||
|
|
||||||
/// Represents a single arm of a `match` expression, e.g.
|
/// Represents a single arm of a `match` expression, e.g.
|
||||||
/// `<pat> (if <guard>) => <body>`.
|
/// `<pat> (if <guard>) => <body>`.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Arm<'hir> {
|
pub struct Arm<'hir> {
|
||||||
#[stable_hasher(ignore)]
|
#[stable_hasher(ignore)]
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -1411,7 +1411,7 @@ pub struct Arm<'hir> {
|
||||||
///
|
///
|
||||||
/// In an if-let, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of the
|
/// In an if-let, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of the
|
||||||
/// desugaring to if-let. Only let-else supports the type annotation at present.
|
/// desugaring to if-let. Only let-else supports the type annotation at present.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Let<'hir> {
|
pub struct Let<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -1420,7 +1420,7 @@ pub struct Let<'hir> {
|
||||||
pub init: &'hir Expr<'hir>,
|
pub init: &'hir Expr<'hir>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum Guard<'hir> {
|
pub enum Guard<'hir> {
|
||||||
If(&'hir Expr<'hir>),
|
If(&'hir Expr<'hir>),
|
||||||
IfLet(&'hir Let<'hir>),
|
IfLet(&'hir Let<'hir>),
|
||||||
|
@ -1440,7 +1440,7 @@ impl<'hir> Guard<'hir> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct ExprField<'hir> {
|
pub struct ExprField<'hir> {
|
||||||
#[stable_hasher(ignore)]
|
#[stable_hasher(ignore)]
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -1488,7 +1488,7 @@ pub struct BodyId {
|
||||||
///
|
///
|
||||||
/// All bodies have an **owner**, which can be accessed via the HIR
|
/// All bodies have an **owner**, which can be accessed via the HIR
|
||||||
/// map using `body_owner_def_id()`.
|
/// map using `body_owner_def_id()`.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Body<'hir> {
|
pub struct Body<'hir> {
|
||||||
pub params: &'hir [Param<'hir>],
|
pub params: &'hir [Param<'hir>],
|
||||||
pub value: &'hir Expr<'hir>,
|
pub value: &'hir Expr<'hir>,
|
||||||
|
@ -1679,7 +1679,7 @@ pub struct AnonConst {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An expression.
|
/// An expression.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Expr<'hir> {
|
pub struct Expr<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub kind: ExprKind<'hir>,
|
pub kind: ExprKind<'hir>,
|
||||||
|
@ -1922,7 +1922,7 @@ pub fn is_range_literal(expr: &Expr<'_>) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum ExprKind<'hir> {
|
pub enum ExprKind<'hir> {
|
||||||
/// Allow anonymous constants from an inline `const` block
|
/// Allow anonymous constants from an inline `const` block
|
||||||
ConstBlock(AnonConst),
|
ConstBlock(AnonConst),
|
||||||
|
@ -2051,7 +2051,7 @@ pub enum ExprKind<'hir> {
|
||||||
/// To resolve the path to a `DefId`, call [`qpath_res`].
|
/// To resolve the path to a `DefId`, call [`qpath_res`].
|
||||||
///
|
///
|
||||||
/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
|
/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum QPath<'hir> {
|
pub enum QPath<'hir> {
|
||||||
/// Path to a definition, optionally "fully-qualified" with a `Self`
|
/// Path to a definition, optionally "fully-qualified" with a `Self`
|
||||||
/// type, if the path points to an associated item in a trait.
|
/// type, if the path points to an associated item in a trait.
|
||||||
|
@ -2243,7 +2243,7 @@ impl From<GeneratorKind> for YieldSource {
|
||||||
|
|
||||||
// N.B., if you change this, you'll probably want to change the corresponding
|
// N.B., if you change this, you'll probably want to change the corresponding
|
||||||
// type structure in middle/ty.rs as well.
|
// type structure in middle/ty.rs as well.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct MutTy<'hir> {
|
pub struct MutTy<'hir> {
|
||||||
pub ty: &'hir Ty<'hir>,
|
pub ty: &'hir Ty<'hir>,
|
||||||
pub mutbl: Mutability,
|
pub mutbl: Mutability,
|
||||||
|
@ -2251,7 +2251,7 @@ pub struct MutTy<'hir> {
|
||||||
|
|
||||||
/// Represents a function's signature in a trait declaration,
|
/// Represents a function's signature in a trait declaration,
|
||||||
/// trait implementation, or a free function.
|
/// trait implementation, or a free function.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct FnSig<'hir> {
|
pub struct FnSig<'hir> {
|
||||||
pub header: FnHeader,
|
pub header: FnHeader,
|
||||||
pub decl: &'hir FnDecl<'hir>,
|
pub decl: &'hir FnDecl<'hir>,
|
||||||
|
@ -2278,7 +2278,7 @@ impl TraitItemId {
|
||||||
/// possibly including a default implementation. A trait item is
|
/// possibly including a default implementation. A trait item is
|
||||||
/// either required (meaning it doesn't have an implementation, just a
|
/// either required (meaning it doesn't have an implementation, just a
|
||||||
/// signature) or provided (meaning it has a default implementation).
|
/// signature) or provided (meaning it has a default implementation).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct TraitItem<'hir> {
|
pub struct TraitItem<'hir> {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub owner_id: OwnerId,
|
pub owner_id: OwnerId,
|
||||||
|
@ -2327,7 +2327,7 @@ impl<'hir> TraitItem<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a trait method's body (or just argument names).
|
/// Represents a trait method's body (or just argument names).
|
||||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum TraitFn<'hir> {
|
pub enum TraitFn<'hir> {
|
||||||
/// No default body in the trait, just a signature.
|
/// No default body in the trait, just a signature.
|
||||||
Required(&'hir [Ident]),
|
Required(&'hir [Ident]),
|
||||||
|
@ -2337,7 +2337,7 @@ pub enum TraitFn<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a trait method or associated constant or type
|
/// Represents a trait method or associated constant or type
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum TraitItemKind<'hir> {
|
pub enum TraitItemKind<'hir> {
|
||||||
/// An associated constant with an optional value (otherwise `impl`s must contain a value).
|
/// An associated constant with an optional value (otherwise `impl`s must contain a value).
|
||||||
Const(&'hir Ty<'hir>, Option<BodyId>),
|
Const(&'hir Ty<'hir>, Option<BodyId>),
|
||||||
|
@ -2365,7 +2365,7 @@ impl ImplItemId {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents anything within an `impl` block.
|
/// Represents anything within an `impl` block.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct ImplItem<'hir> {
|
pub struct ImplItem<'hir> {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub owner_id: OwnerId,
|
pub owner_id: OwnerId,
|
||||||
|
@ -2415,7 +2415,7 @@ impl<'hir> ImplItem<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents various kinds of content within an `impl`.
|
/// Represents various kinds of content within an `impl`.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum ImplItemKind<'hir> {
|
pub enum ImplItemKind<'hir> {
|
||||||
/// An associated constant of the given type, set to the constant result
|
/// An associated constant of the given type, set to the constant result
|
||||||
/// of the expression.
|
/// of the expression.
|
||||||
|
@ -2444,7 +2444,7 @@ pub const FN_OUTPUT_NAME: Symbol = sym::Output;
|
||||||
/// Binding(...),
|
/// Binding(...),
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct TypeBinding<'hir> {
|
pub struct TypeBinding<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -2453,7 +2453,7 @@ pub struct TypeBinding<'hir> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum Term<'hir> {
|
pub enum Term<'hir> {
|
||||||
Ty(&'hir Ty<'hir>),
|
Ty(&'hir Ty<'hir>),
|
||||||
Const(AnonConst),
|
Const(AnonConst),
|
||||||
|
@ -2472,7 +2472,7 @@ impl<'hir> From<AnonConst> for Term<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Represents the two kinds of type bindings.
|
// Represents the two kinds of type bindings.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum TypeBindingKind<'hir> {
|
pub enum TypeBindingKind<'hir> {
|
||||||
/// E.g., `Foo<Bar: Send>`.
|
/// E.g., `Foo<Bar: Send>`.
|
||||||
Constraint { bounds: &'hir [GenericBound<'hir>] },
|
Constraint { bounds: &'hir [GenericBound<'hir>] },
|
||||||
|
@ -2495,7 +2495,7 @@ impl TypeBinding<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Ty<'hir> {
|
pub struct Ty<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub kind: TyKind<'hir>,
|
pub kind: TyKind<'hir>,
|
||||||
|
@ -2640,7 +2640,7 @@ impl PrimTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct BareFnTy<'hir> {
|
pub struct BareFnTy<'hir> {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
|
@ -2649,7 +2649,7 @@ pub struct BareFnTy<'hir> {
|
||||||
pub param_names: &'hir [Ident],
|
pub param_names: &'hir [Ident],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct OpaqueTy<'hir> {
|
pub struct OpaqueTy<'hir> {
|
||||||
pub generics: &'hir Generics<'hir>,
|
pub generics: &'hir Generics<'hir>,
|
||||||
pub bounds: GenericBounds<'hir>,
|
pub bounds: GenericBounds<'hir>,
|
||||||
|
@ -2669,7 +2669,7 @@ pub enum OpaqueTyOrigin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The various kinds of types recognized by the compiler.
|
/// The various kinds of types recognized by the compiler.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum TyKind<'hir> {
|
pub enum TyKind<'hir> {
|
||||||
/// A variable length slice (i.e., `[T]`).
|
/// A variable length slice (i.e., `[T]`).
|
||||||
Slice(&'hir Ty<'hir>),
|
Slice(&'hir Ty<'hir>),
|
||||||
|
@ -2709,7 +2709,7 @@ pub enum TyKind<'hir> {
|
||||||
Err(rustc_span::ErrorGuaranteed),
|
Err(rustc_span::ErrorGuaranteed),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum InlineAsmOperand<'hir> {
|
pub enum InlineAsmOperand<'hir> {
|
||||||
In {
|
In {
|
||||||
reg: InlineAsmRegOrRegClass,
|
reg: InlineAsmRegOrRegClass,
|
||||||
|
@ -2762,7 +2762,7 @@ impl<'hir> InlineAsmOperand<'hir> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct InlineAsm<'hir> {
|
pub struct InlineAsm<'hir> {
|
||||||
pub template: &'hir [InlineAsmTemplatePiece],
|
pub template: &'hir [InlineAsmTemplatePiece],
|
||||||
pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
|
pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
|
||||||
|
@ -2772,7 +2772,7 @@ pub struct InlineAsm<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a parameter in a function header.
|
/// Represents a parameter in a function header.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Param<'hir> {
|
pub struct Param<'hir> {
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub pat: &'hir Pat<'hir>,
|
pub pat: &'hir Pat<'hir>,
|
||||||
|
@ -2781,7 +2781,7 @@ pub struct Param<'hir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the header (not the body) of a function declaration.
|
/// Represents the header (not the body) of a function declaration.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct FnDecl<'hir> {
|
pub struct FnDecl<'hir> {
|
||||||
/// The types of the function's parameters.
|
/// The types of the function's parameters.
|
||||||
///
|
///
|
||||||
|
@ -2854,7 +2854,7 @@ impl Defaultness {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum FnRetTy<'hir> {
|
pub enum FnRetTy<'hir> {
|
||||||
/// Return type is not specified.
|
/// Return type is not specified.
|
||||||
///
|
///
|
||||||
|
@ -2887,7 +2887,7 @@ pub enum ClosureBinder {
|
||||||
For { span: Span },
|
For { span: Span },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Mod<'hir> {
|
pub struct Mod<'hir> {
|
||||||
pub spans: ModSpans,
|
pub spans: ModSpans,
|
||||||
pub item_ids: &'hir [ItemId],
|
pub item_ids: &'hir [ItemId],
|
||||||
|
@ -2902,12 +2902,12 @@ pub struct ModSpans {
|
||||||
pub inject_use_span: Span,
|
pub inject_use_span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct EnumDef<'hir> {
|
pub struct EnumDef<'hir> {
|
||||||
pub variants: &'hir [Variant<'hir>],
|
pub variants: &'hir [Variant<'hir>],
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Variant<'hir> {
|
pub struct Variant<'hir> {
|
||||||
/// Name of the variant.
|
/// Name of the variant.
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -2944,7 +2944,7 @@ pub enum UseKind {
|
||||||
/// that the `ref_id` is for. Note that `ref_id`'s value is not the `HirId` of the
|
/// that the `ref_id` is for. Note that `ref_id`'s value is not the `HirId` of the
|
||||||
/// trait being referred to but just a unique `HirId` that serves as a key
|
/// trait being referred to but just a unique `HirId` that serves as a key
|
||||||
/// within the resolution map.
|
/// within the resolution map.
|
||||||
#[derive(Clone, Debug, HashStable_Generic)]
|
#[derive(Clone, Debug, Copy, HashStable_Generic)]
|
||||||
pub struct TraitRef<'hir> {
|
pub struct TraitRef<'hir> {
|
||||||
pub path: &'hir Path<'hir>,
|
pub path: &'hir Path<'hir>,
|
||||||
// Don't hash the `ref_id`. It is tracked via the thing it is used to access.
|
// Don't hash the `ref_id`. It is tracked via the thing it is used to access.
|
||||||
|
@ -2963,7 +2963,7 @@ impl TraitRef<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, HashStable_Generic)]
|
#[derive(Clone, Debug, Copy, HashStable_Generic)]
|
||||||
pub struct PolyTraitRef<'hir> {
|
pub struct PolyTraitRef<'hir> {
|
||||||
/// The `'a` in `for<'a> Foo<&'a T>`.
|
/// The `'a` in `for<'a> Foo<&'a T>`.
|
||||||
pub bound_generic_params: &'hir [GenericParam<'hir>],
|
pub bound_generic_params: &'hir [GenericParam<'hir>],
|
||||||
|
@ -2974,7 +2974,7 @@ pub struct PolyTraitRef<'hir> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct FieldDef<'hir> {
|
pub struct FieldDef<'hir> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub vis_span: Span,
|
pub vis_span: Span,
|
||||||
|
@ -2993,7 +2993,7 @@ impl FieldDef<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fields and constructor IDs of enum variants and structs.
|
/// Fields and constructor IDs of enum variants and structs.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum VariantData<'hir> {
|
pub enum VariantData<'hir> {
|
||||||
/// A struct variant.
|
/// A struct variant.
|
||||||
///
|
///
|
||||||
|
@ -3063,7 +3063,7 @@ impl ItemId {
|
||||||
/// An item
|
/// An item
|
||||||
///
|
///
|
||||||
/// The name might be a dummy name in case of anonymous items
|
/// The name might be a dummy name in case of anonymous items
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Item<'hir> {
|
pub struct Item<'hir> {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub owner_id: OwnerId,
|
pub owner_id: OwnerId,
|
||||||
|
@ -3271,7 +3271,7 @@ impl FnHeader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum ItemKind<'hir> {
|
pub enum ItemKind<'hir> {
|
||||||
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
||||||
///
|
///
|
||||||
|
@ -3292,7 +3292,7 @@ pub enum ItemKind<'hir> {
|
||||||
/// A function declaration.
|
/// A function declaration.
|
||||||
Fn(FnSig<'hir>, &'hir Generics<'hir>, BodyId),
|
Fn(FnSig<'hir>, &'hir Generics<'hir>, BodyId),
|
||||||
/// A MBE macro definition (`macro_rules!` or `macro`).
|
/// A MBE macro definition (`macro_rules!` or `macro`).
|
||||||
Macro(ast::MacroDef, MacroKind),
|
Macro(&'hir ast::MacroDef, MacroKind),
|
||||||
/// A module.
|
/// A module.
|
||||||
Mod(&'hir Mod<'hir>),
|
Mod(&'hir Mod<'hir>),
|
||||||
/// An external module, e.g. `extern { .. }`.
|
/// An external module, e.g. `extern { .. }`.
|
||||||
|
@ -3318,7 +3318,7 @@ pub enum ItemKind<'hir> {
|
||||||
Impl(&'hir Impl<'hir>),
|
Impl(&'hir Impl<'hir>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct Impl<'hir> {
|
pub struct Impl<'hir> {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub polarity: ImplPolarity,
|
pub polarity: ImplPolarity,
|
||||||
|
@ -3381,7 +3381,7 @@ impl ItemKind<'_> {
|
||||||
/// type or method, and whether it is public). This allows other
|
/// type or method, and whether it is public). This allows other
|
||||||
/// passes to find the impl they want without loading the ID (which
|
/// passes to find the impl they want without loading the ID (which
|
||||||
/// means fewer edges in the incremental compilation graph).
|
/// means fewer edges in the incremental compilation graph).
|
||||||
#[derive(Encodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct TraitItemRef {
|
pub struct TraitItemRef {
|
||||||
pub id: TraitItemId,
|
pub id: TraitItemId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -3395,7 +3395,7 @@ pub struct TraitItemRef {
|
||||||
/// type or method, and whether it is public). This allows other
|
/// type or method, and whether it is public). This allows other
|
||||||
/// passes to find the impl they want without loading the ID (which
|
/// passes to find the impl they want without loading the ID (which
|
||||||
/// means fewer edges in the incremental compilation graph).
|
/// means fewer edges in the incremental compilation graph).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct ImplItemRef {
|
pub struct ImplItemRef {
|
||||||
pub id: ImplItemId,
|
pub id: ImplItemId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -3434,14 +3434,14 @@ impl ForeignItemId {
|
||||||
/// type or method, and whether it is public). This allows other
|
/// type or method, and whether it is public). This allows other
|
||||||
/// passes to find the impl they want without loading the ID (which
|
/// passes to find the impl they want without loading the ID (which
|
||||||
/// means fewer edges in the incremental compilation graph).
|
/// means fewer edges in the incremental compilation graph).
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct ForeignItemRef {
|
pub struct ForeignItemRef {
|
||||||
pub id: ForeignItemId,
|
pub id: ForeignItemId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub struct ForeignItem<'hir> {
|
pub struct ForeignItem<'hir> {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub kind: ForeignItemKind<'hir>,
|
pub kind: ForeignItemKind<'hir>,
|
||||||
|
@ -3463,7 +3463,7 @@ impl ForeignItem<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An item within an `extern` block.
|
/// An item within an `extern` block.
|
||||||
#[derive(Debug, HashStable_Generic)]
|
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||||
pub enum ForeignItemKind<'hir> {
|
pub enum ForeignItemKind<'hir> {
|
||||||
/// A foreign function.
|
/// A foreign function.
|
||||||
Fn(&'hir FnDecl<'hir>, &'hir [Ident], &'hir Generics<'hir>),
|
Fn(&'hir FnDecl<'hir>, &'hir [Ident], &'hir Generics<'hir>),
|
||||||
|
@ -3483,7 +3483,7 @@ pub struct Upvar {
|
||||||
// The TraitCandidate's import_ids is empty if the trait is defined in the same module, and
|
// The TraitCandidate's import_ids is empty if the trait is defined in the same module, and
|
||||||
// has length > 0 if the trait is found through an chain of imports, starting with the
|
// has length > 0 if the trait is found through an chain of imports, starting with the
|
||||||
// import/use statement in the scope where the trait is used.
|
// import/use statement in the scope where the trait is used.
|
||||||
#[derive(Encodable, Decodable, Debug, HashStable_Generic)]
|
#[derive(Encodable, Decodable, Debug, Clone, HashStable_Generic)]
|
||||||
pub struct TraitCandidate {
|
pub struct TraitCandidate {
|
||||||
pub def_id: DefId,
|
pub def_id: DefId,
|
||||||
pub import_ids: SmallVec<[LocalDefId; 1]>,
|
pub import_ids: SmallVec<[LocalDefId; 1]>,
|
||||||
|
|
|
@ -327,7 +327,7 @@ impl<'tcx> IrMaps<'tcx> {
|
||||||
pats.extend(inner_pat.iter());
|
pats.extend(inner_pat.iter());
|
||||||
}
|
}
|
||||||
Struct(_, fields, _) => {
|
Struct(_, fields, _) => {
|
||||||
let (short, not_short): (Vec<_>, _) =
|
let (short, not_short): (Vec<hir::PatField<'_>>, _) =
|
||||||
fields.iter().partition(|f| f.is_shorthand);
|
fields.iter().partition(|f| f.is_shorthand);
|
||||||
shorthand_field_ids.extend(short.iter().map(|f| f.pat.hir_id));
|
shorthand_field_ids.extend(short.iter().map(|f| f.pat.hir_id));
|
||||||
pats.extend(not_short.iter().map(|f| f.pat));
|
pats.extend(not_short.iter().map(|f| f.pat));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue