Remove derive(HashStable_Generic).

It's now just a synonym for `derive(HashStable)`.
This commit is contained in:
Nicholas Nethercote
2026-04-08 13:40:45 +10:00
parent 36c9d23902
commit 087b422ec7
41 changed files with 412 additions and 478 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
#[cfg(feature = "nightly")]
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use crate::{Align, HasDataLayout, Integer, Primitive, Size};
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum RegKind {
Integer,
@@ -16,7 +16,7 @@ pub enum RegKind {
},
}
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct Reg {
pub kind: RegKind,
+5 -5
View File
@@ -1,7 +1,7 @@
use std::fmt;
#[cfg(feature = "nightly")]
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use crate::ExternAbi;
@@ -18,7 +18,7 @@
/// rather than picking the "actual" ABI.
#[derive(Copy, Clone, Debug)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum CanonAbi {
// NOTE: the use of nested variants for some ABIs is for many targets they don't matter,
// and this pushes the complexity of their reasoning to target-specific code,
@@ -111,7 +111,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// These only affect callee codegen. making their categorization as distinct ABIs a bit peculiar.
#[derive(Copy, Clone, Debug)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum InterruptKind {
Avr,
AvrNonBlocking,
@@ -126,7 +126,7 @@ pub enum InterruptKind {
/// One of SysV64 or Win64 may alias the C ABI, and arguably Win64 is cross-platform now?
#[derive(Clone, Copy, Debug)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum X86Call {
/// "fastcall" has both GNU and Windows variants
Fastcall,
@@ -141,7 +141,7 @@ pub enum X86Call {
/// ABIs defined for 32-bit Arm
#[derive(Copy, Clone, Debug)]
#[derive(PartialOrd, Ord, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum ArmCall {
Aapcs,
CCmseNonSecureCall,
+3 -3
View File
@@ -2,7 +2,7 @@
use std::ops::Deref;
use rustc_data_structures::intern::Interned;
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use crate::layout::{FieldIdx, VariantIdx};
use crate::{
@@ -12,7 +12,7 @@
// Explicitly import `Float` to avoid ambiguity with `Primitive::Float`.
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
#[rustc_pass_by_value]
pub struct Layout<'a>(pub Interned<'a, LayoutData<FieldIdx, VariantIdx>>);
@@ -71,7 +71,7 @@ pub fn unadjusted_abi_align(self) -> Align {
/// to that obtained from `layout_of(ty)`, as we need to produce
/// layouts for which Rust types do not exist, such as enum variants
/// or synthetic fields of enums (i.e., discriminants) and wide pointers.
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable)]
pub struct TyAndLayout<'a, Ty> {
pub ty: Ty,
pub layout: Layout<'a>,
+21 -42
View File
@@ -53,7 +53,7 @@
use rustc_hashes::Hash64;
use rustc_index::{Idx, IndexSlice, IndexVec};
#[cfg(feature = "nightly")]
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_Generic};
use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable};
#[cfg(feature = "nightly")]
use rustc_span::{Symbol, sym};
@@ -74,10 +74,7 @@
pub use layout::{Layout, TyAbiInterface, TyAndLayout};
#[derive(Clone, Copy, PartialEq, Eq, Default)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub struct ReprFlags(u8);
bitflags! {
@@ -114,10 +111,7 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub enum IntegerType {
/// Pointer-sized integer type, i.e. `isize` and `usize`. The field shows signedness, e.g.
/// `Pointer(true)` means `isize`.
@@ -137,10 +131,7 @@ pub fn is_signed(&self) -> bool {
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub enum ScalableElt {
/// `N` in `rustc_scalable_vector(N)` - the element count of the scalable vector
ElementCount(u16),
@@ -151,10 +142,7 @@ pub enum ScalableElt {
/// Represents the repr options provided by the user.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub struct ReprOptions {
pub int: Option<IntegerType>,
pub align: Option<Align>,
@@ -804,10 +792,7 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
/// Size of a type in bytes.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub struct Size {
raw: u64,
}
@@ -1032,10 +1017,7 @@ unsafe fn backward_unchecked(start: Self, count: usize) -> Self {
/// Alignment of a type in bytes (always a power of two).
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub struct Align {
pow2: u8,
}
@@ -1168,7 +1150,7 @@ pub fn restrict_for_offset(self, size: Size) -> Align {
/// An example of a rare thing actually affected by preferred alignment is aligning of statics.
/// It is of effectively no consequence for layout in structs and on the stack.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct AbiAlign {
pub abi: Align,
}
@@ -1200,10 +1182,7 @@ fn deref(&self) -> &Self::Target {
/// Integers, also used for enum discriminants.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(
feature = "nightly",
derive(Encodable_NoContext, Decodable_NoContext, HashStable_Generic)
)]
#[cfg_attr(feature = "nightly", derive(Encodable_NoContext, Decodable_NoContext, HashStable))]
pub enum Integer {
I8,
I16,
@@ -1363,7 +1342,7 @@ pub fn from_size(size: Size) -> Result<Self, String> {
/// Floating-point types.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum Float {
F16,
F32,
@@ -1398,7 +1377,7 @@ pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAlign {
/// Fundamental unit of memory access and layout.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum Primitive {
/// The `bool` is the signedness of the `Integer` type.
///
@@ -1446,7 +1425,7 @@ pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAlign {
///
/// This is intended specifically to mirror LLVMs `!range` metadata semantics.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct WrappingRange {
pub start: u128,
pub end: u128,
@@ -1558,7 +1537,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// Information about one scalar component of a Rust type.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum Scalar {
Initialized {
value: Primitive,
@@ -1662,7 +1641,7 @@ pub fn is_signed(&self) -> bool {
// NOTE: This struct is generic over the FieldIdx for rust-analyzer usage.
/// Describes how the fields of a type are located in memory.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum FieldsShape<FieldIdx: Idx> {
/// Scalar primitives and `!`, which never have fields.
Primitive,
@@ -1747,7 +1726,7 @@ pub fn index_by_increasing_offset(&self) -> impl ExactSizeIterator<Item = usize>
/// should operate on. Special address spaces have an effect on code generation,
/// depending on the target and the address spaces it implements.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct AddressSpace(pub u32);
impl AddressSpace {
@@ -1760,7 +1739,7 @@ impl AddressSpace {
/// How many scalable vectors are in a `BackendRepr::ScalableVector`?
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct NumScalableVectors(pub u8);
impl NumScalableVectors {
@@ -1809,7 +1788,7 @@ fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
/// Generally, a codegen backend will prefer to handle smaller values as a scalar or short vector,
/// and larger values will usually prefer to be represented as memory.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum BackendRepr {
Scalar(Scalar),
ScalarPair(Scalar, Scalar),
@@ -1953,7 +1932,7 @@ pub fn eq_up_to_validity(&self, other: &Self) -> bool {
// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
/// A type with no valid variants. Must be uninhabited.
Empty,
@@ -1980,7 +1959,7 @@ pub enum Variants<FieldIdx: Idx, VariantIdx: Idx> {
// NOTE: This struct is generic over the VariantIdx for rust-analyzer usage.
#[derive(PartialEq, Eq, Hash, Clone, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub enum TagEncoding<VariantIdx: Idx> {
/// The tag directly stores the discriminant, but possibly with a smaller layout
/// (so converting the tag to the discriminant can require sign extension).
@@ -2021,7 +2000,7 @@ pub enum TagEncoding<VariantIdx: Idx> {
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct Niche {
pub offset: Size,
pub value: Primitive,
@@ -2118,7 +2097,7 @@ pub fn reserve<C: HasDataLayout>(&self, cx: &C, count: u128) -> Option<(u128, Sc
// NOTE: This struct is generic over the FieldIdx and VariantIdx for rust-analyzer usage.
#[derive(PartialEq, Eq, Hash, Clone)]
#[cfg_attr(feature = "nightly", derive(HashStable_Generic))]
#[cfg_attr(feature = "nightly", derive(HashStable))]
pub struct LayoutData<FieldIdx: Idx, VariantIdx: Idx> {
/// Says where the fields are located within the layout.
pub fields: FieldsShape<FieldIdx>,
+36 -36
View File
@@ -28,7 +28,7 @@
use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher};
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::tagged_ptr::Tag;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
use rustc_macros::{Decodable, Encodable, HashStable, Walkable};
pub use rustc_span::AttrId;
use rustc_span::{
ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym,
@@ -52,7 +52,7 @@
/// ```
///
/// `'outer` is a label.
#[derive(Clone, Encodable, Decodable, Copy, HashStable_Generic, Eq, PartialEq, Walkable)]
#[derive(Clone, Encodable, Decodable, Copy, HashStable, Eq, PartialEq, Walkable)]
pub struct Label {
pub ident: Ident,
}
@@ -564,7 +564,7 @@ pub struct Crate {
/// for most built-in attributes.
///
/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable)]
pub struct MetaItem {
pub unsafety: Safety,
pub path: Path,
@@ -573,7 +573,7 @@ pub struct MetaItem {
}
/// The meta item kind, containing the data after the initial path.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable)]
pub enum MetaItemKind {
/// Word meta item.
///
@@ -594,7 +594,7 @@ pub enum MetaItemKind {
/// Values inside meta item lists.
///
/// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy)]`.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable)]
pub enum MetaItemInner {
/// A full MetaItem, for recursive meta items.
MetaItem(MetaItem),
@@ -792,7 +792,7 @@ pub struct PatField {
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub enum ByRef {
Yes(Pinnedness, Mutability),
No,
@@ -814,7 +814,7 @@ pub fn cap_ref_mutability(mut self, mutbl: Mutability) -> Self {
/// `.0` is the by-reference mode (`ref`, `ref mut`, or by value),
/// `.1` is the mutability of the binding.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub struct BindingMode(pub ByRef, pub Mutability);
impl BindingMode {
@@ -964,7 +964,7 @@ pub enum PatFieldsRest {
/// The kind of borrow in an `AddrOf` expression,
/// e.g., `&place` or `&raw const place`.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub enum BorrowKind {
/// A normal borrow, `&$expr` or `&mut $expr`.
/// The resulting type is either `&'a T` or `&'a mut T`
@@ -980,7 +980,7 @@ pub enum BorrowKind {
Pin,
}
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)]
pub enum BinOpKind {
/// The `+` operator (addition)
Add,
@@ -1110,7 +1110,7 @@ fn from(op: AssignOpKind) -> BinOpKind {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)]
pub enum AssignOpKind {
/// The `+=` operator (addition)
AddAssign,
@@ -1162,7 +1162,7 @@ pub fn is_by_value(self) -> bool {
/// Unary operator.
///
/// Note that `&data` is not an operator, it's an `AddrOf` expression.
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable, Walkable)]
pub enum UnOp {
/// The `*` operator for dereferencing
Deref,
@@ -1961,7 +1961,7 @@ pub fn modifier(&self) -> &'static str {
/// Whether we're unwrapping or wrapping an unsafe binder
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub enum UnsafeBinderCastKind {
// e.g. `&i32` -> `unsafe<'a> &'a i32`
Wrap,
@@ -1995,7 +1995,7 @@ pub struct QSelf {
}
/// A capture clause used in closures and `async` blocks.
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)]
pub enum CaptureBy {
/// `move |x| y + x`.
Value {
@@ -2090,7 +2090,7 @@ pub fn inner_tokens(&self) -> TokenStream {
}
/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)]
pub struct DelimArgs {
pub dspan: DelimSpan,
pub delim: Delimiter, // Note: `Delimiter::Invisible` never occurs
@@ -2106,7 +2106,7 @@ pub fn need_semicolon(&self) -> bool {
}
/// Represents a macro definition.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)]
pub struct MacroDef {
pub body: Box<DelimArgs>,
/// `true` if macro was defined with `macro_rules`.
@@ -2120,7 +2120,7 @@ pub struct MacroDef {
pub eii_declaration: Option<EiiDecl>,
}
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable, Walkable)]
pub struct EiiDecl {
/// path to the extern item we're targeting
pub foreign_item: Path,
@@ -2128,7 +2128,7 @@ pub struct EiiDecl {
}
#[derive(Clone, Encodable, Decodable, Debug, Copy, Hash, Eq, PartialEq)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum StrStyle {
/// A regular string, like `"foo"`.
Cooked,
@@ -2186,7 +2186,7 @@ pub const fn same_kind(&self, other: &Self) -> bool {
}
/// A literal in a meta item.
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable)]
pub struct MetaItemLit {
/// The original literal as written in the source code.
pub symbol: Symbol,
@@ -2223,7 +2223,7 @@ pub fn as_token_lit(&self) -> token::Lit {
/// Type of the integer literal based on provided suffix.
#[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum LitIntType {
/// e.g. `42_i32`.
Signed(IntTy),
@@ -2235,7 +2235,7 @@ pub enum LitIntType {
/// Type of the float literal based on provided suffix.
#[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum LitFloatType {
/// A float literal with a suffix (`1f32` or `1E10f32`).
Suffixed(FloatTy),
@@ -2249,7 +2249,7 @@ pub enum LitFloatType {
/// deciding the `LitKind`. This means that float literals like `1f32` are
/// classified by this type as `Float`. This is different to `token::LitKind`
/// which does *not* consider the suffix.
#[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq, HashStable_Generic)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, Hash, Eq, PartialEq, HashStable)]
pub enum LitKind {
/// A string literal (`"foo"`). The symbol is unescaped, and so may differ
/// from the original token's symbol.
@@ -2652,7 +2652,7 @@ pub enum TyPatKind {
}
/// Syntax used to declare a trait object.
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)]
#[repr(u8)]
pub enum TraitObjectSyntax {
// SAFETY: When adding new variants make sure to update the `Tag` impl.
@@ -2696,7 +2696,7 @@ pub enum InlineAsmRegOrRegClass {
RegClass(Symbol),
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub struct InlineAsmOptions(u16);
bitflags::bitflags! {
impl InlineAsmOptions: u16 {
@@ -2759,7 +2759,7 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
}
}
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic, Walkable)]
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable, Walkable)]
pub enum InlineAsmTemplatePiece {
String(Cow<'static, str>),
Placeholder { operand_idx: usize, modifier: Option<char>, span: Span },
@@ -2862,7 +2862,7 @@ pub fn reg(&self) -> Option<&InlineAsmRegOrRegClass> {
}
}
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable_Generic, Walkable, PartialEq, Eq)]
#[derive(Clone, Copy, Encodable, Decodable, Debug, HashStable, Walkable, PartialEq, Eq)]
pub enum AsmMacro {
/// The `asm!` macro
Asm,
@@ -3060,7 +3060,7 @@ pub fn c_variadic(&self) -> bool {
}
/// Is the trait definition an auto trait?
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)]
pub enum IsAuto {
Yes,
No,
@@ -3068,7 +3068,7 @@ pub enum IsAuto {
/// Safety of items.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum Safety {
/// `unsafe` an item is explicitly marked as `unsafe`.
Unsafe(Span),
@@ -3133,7 +3133,7 @@ pub fn return_id(self) -> (NodeId, Span) {
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, Debug)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum Const {
Yes(Span),
No,
@@ -3141,7 +3141,7 @@ pub enum Const {
/// Item defaultness.
/// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532).
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, Walkable)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, Walkable)]
pub enum Defaultness {
/// Item is unmarked. Implicitly determined based off of position.
/// For impls, this is `final`; for traits, this is `default`.
@@ -3155,7 +3155,7 @@ pub enum Defaultness {
Final(Span),
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable, Walkable)]
pub enum ImplPolarity {
/// `impl Trait for Type`
Positive,
@@ -3174,7 +3174,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// The polarity of a trait bound.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum BoundPolarity {
/// `Type: Trait`
Positive,
@@ -3196,7 +3196,7 @@ pub fn as_str(self) -> &'static str {
/// The constness of a trait bound.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum BoundConstness {
/// `Type: Trait`
Never,
@@ -3218,7 +3218,7 @@ pub fn as_str(self) -> &'static str {
/// The asyncness of a trait bound.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
#[derive(HashStable_Generic, Walkable)]
#[derive(HashStable, Walkable)]
pub enum BoundAsyncness {
/// `Type: Trait`
Normal,
@@ -3387,7 +3387,7 @@ pub fn hi_span(&self) -> Span {
/// are contained as statements within items. These two cases need to be
/// distinguished for pretty-printing.
#[derive(Clone, PartialEq, Eq, Hash, Debug, Copy)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub enum AttrStyle {
Outer,
Inner,
@@ -3484,7 +3484,7 @@ pub fn span(&self) -> Option<Span> {
///
/// Currently all early parsed attributes are excluded from pretty printing at rustc_ast_pretty::pprust::state::print_attribute_inline.
/// When adding new early parsed attributes, consider whether they should be pretty printed.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, HashStable)]
pub enum EarlyParsedAttribute {
CfgTrace(CfgEntry),
CfgAttrTrace,
@@ -3607,7 +3607,7 @@ pub struct FieldDef {
}
/// Was parsing recovery performed?
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, Walkable)]
pub enum Recovered {
No,
Yes(ErrorGuaranteed),
@@ -1,12 +1,12 @@
use std::fmt;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::{Span, Symbol};
use thin_vec::ThinVec;
use crate::attr::version::RustcVersion;
#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
pub enum CfgEntry {
All(ThinVec<CfgEntry>, Span),
Any(ThinVec<CfgEntry>, Span),
+2 -2
View File
@@ -1,10 +1,10 @@
use std::fmt::{self, Display};
use std::sync::OnceLock;
use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic, current_rustc_version};
use rustc_macros::{BlobDecodable, Encodable, HashStable, current_rustc_version};
#[derive(Encodable, BlobDecodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub struct RustcVersion {
pub major: u16,
pub minor: u16,
+2 -2
View File
@@ -1,7 +1,7 @@
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use rustc_span::{Symbol, sym};
#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)]
#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable)]
pub enum AllocatorKind {
/// Use `#[global_allocator]` as global allocator.
Global,
@@ -8,7 +8,7 @@
use rustc_span::{Symbol, sym};
use crate::expand::{Decodable, Encodable, HashStable_Generic};
use crate::expand::{Decodable, Encodable, HashStable};
use crate::{Ty, TyKind};
/// Forward and Reverse Mode are well known names for automatic differentiation implementations.
@@ -20,7 +20,7 @@
///
/// Documentation for using [reverse](https://enzyme.mit.edu/rust/rev.html) and
/// [forward](https://enzyme.mit.edu/rust/fwd.html) mode is available online.
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub enum DiffMode {
/// No autodiff is applied (used during error handling).
Error,
@@ -42,7 +42,7 @@ pub fn all_modes() -> &'static [Symbol] {
/// However, under forward mode we overwrite the previous shadow value, while for reverse mode
/// we add to the previous shadow value. To not surprise users, we picked different names.
/// Dual numbers is also a quite well known name for forward mode AD types.
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub enum DiffActivity {
/// Implicit or Explicit () return type, so a special case of Const.
None,
+1 -1
View File
@@ -1,6 +1,6 @@
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
pub mod allocator;
pub mod autodiff_attrs;
+5 -5
View File
@@ -21,9 +21,9 @@
use std::fmt;
use crate::expand::{Decodable, Encodable, HashStable_Generic};
use crate::expand::{Decodable, Encodable, HashStable};
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub enum Kind {
Anything,
Integer,
@@ -35,7 +35,7 @@ pub enum Kind {
Unknown,
}
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub struct TypeTree(pub Vec<Type>);
impl TypeTree {
@@ -59,13 +59,13 @@ pub fn int(size: usize) -> Self {
}
}
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub struct FncTree {
pub args: Vec<TypeTree>,
pub ret: TypeTree,
}
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub struct Type {
pub offset: isize,
pub size: usize,
+14 -14
View File
@@ -5,7 +5,7 @@
pub use NtExprKind::*;
pub use NtPatKind::*;
pub use TokenKind::*;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::edition::Edition;
use rustc_span::symbol::IdentPrintMode;
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, kw, sym};
@@ -17,7 +17,7 @@
use crate::util::case::Case;
/// Represents the kind of doc comment it is, ie `///` or `#[doc = ""]`.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub enum DocFragmentKind {
/// A sugared doc comment: `///` or `//!` or `/**` or `/*!`.
Sugared(CommentKind),
@@ -40,13 +40,13 @@ pub fn comment_kind(self) -> CommentKind {
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)]
pub enum CommentKind {
Line,
Block,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable)]
pub enum InvisibleOrigin {
// From the expansion of a metavariable in a declarative macro.
MetaVar(MetaVarKind),
@@ -69,7 +69,7 @@ pub fn skip(&self) -> bool {
}
/// Annoyingly similar to `NonterminalKind`, but the slight differences are important.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub enum MetaVarKind {
Item,
Block,
@@ -125,7 +125,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// Describes how a sequence of token trees is delimited.
/// Cannot use `proc_macro::Delimiter` directly because this
/// structure should implement some additional traits.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub enum Delimiter {
/// `( ... )`
Parenthesis,
@@ -188,7 +188,7 @@ pub fn as_close_token_kind(&self) -> TokenKind {
// type. This means that float literals like `1f32` are classified by this type
// as `Int`. Only upon conversion to `ast::LitKind` will such a literal be
// given the `Float` kind.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)]
pub enum LitKind {
Bool, // AST only, must never appear in a `Token`
Byte,
@@ -205,7 +205,7 @@ pub enum LitKind {
}
/// A literal token.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)]
pub struct Lit {
pub kind: LitKind,
pub symbol: Symbol,
@@ -351,7 +351,7 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: IdentIsRaw) -> bool {
.contains(&name)
}
#[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, HashStable_Generic)]
#[derive(PartialEq, Eq, Encodable, Decodable, Hash, Debug, Copy, Clone, HashStable)]
pub enum IdentIsRaw {
No,
Yes,
@@ -378,7 +378,7 @@ fn from(b: bool) -> Self {
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)]
pub enum TokenKind {
/* Expression-operator symbols. */
/// `=`
@@ -528,7 +528,7 @@ pub enum TokenKind {
Eof,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Debug, HashStable)]
pub struct Token {
pub kind: TokenKind,
pub span: Span,
@@ -1090,7 +1090,7 @@ fn eq(&self, rhs: &TokenKind) -> bool {
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub enum NtPatKind {
// Matches or-patterns. Was written using `pat` in edition 2021 or later.
PatWithOr,
@@ -1100,7 +1100,7 @@ pub enum NtPatKind {
PatParam { inferred: bool },
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub enum NtExprKind {
// Matches expressions using the post-edition 2024. Was written using
// `expr` in edition 2024 or later.
@@ -1112,7 +1112,7 @@ pub enum NtExprKind {
}
/// A macro nonterminal, known in documentation as a fragment specifier.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, HashStable)]
pub enum NonterminalKind {
Item,
Block,
+5 -5
View File
@@ -12,7 +12,7 @@
use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher};
use rustc_data_structures::sync;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
use rustc_macros::{Decodable, Encodable, HashStable, Walkable};
use rustc_serialize::{Decodable, Encodable};
use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym};
use thin_vec::ThinVec;
@@ -23,7 +23,7 @@
use crate::{AttrVec, Attribute};
/// Part of a `TokenStream`.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub enum TokenTree {
/// A single token. Should never be `OpenDelim` or `CloseDelim`, because
/// delimiters are implicitly represented by `Delimited`.
@@ -545,7 +545,7 @@ pub struct AttrsTarget {
/// compound token. Used for conversions to `proc_macro::Spacing`. Also used to
/// guide pretty-printing, which is where the `JointHidden` value (which isn't
/// part of `proc_macro::Spacing`) comes in useful.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub enum Spacing {
/// The token cannot join with the following token to form a compound
/// token.
@@ -967,7 +967,7 @@ pub fn inlined_next(&mut self) -> (Token, Spacing) {
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[derive(Encodable, Decodable, HashStable_Generic, Walkable)]
#[derive(Encodable, Decodable, HashStable, Walkable)]
pub struct DelimSpan {
pub open: Span,
pub close: Span,
@@ -991,7 +991,7 @@ pub fn entire(self) -> Span {
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub struct DelimSpacing {
pub open: Spacing,
pub close: Spacing,
+3 -3
View File
@@ -7,7 +7,7 @@
pub use fluent_bundle::types::FluentType;
pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::Span;
pub use unic_langid::{LanguageIdentifier, langid};
@@ -28,7 +28,7 @@ pub fn register_functions<R, M>(bundle: &mut fluent_bundle::bundle::FluentBundle
/// diagnostic messages.
///
/// Intended to be removed once diagnostics are entirely translatable.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
#[rustc_diagnostic_item = "DiagMessage"]
pub enum DiagMessage {
/// Non-translatable diagnostic message or a message that has been translated eagerly.
@@ -89,7 +89,7 @@ pub struct SpanLabel {
/// the error, and would be rendered with `^^^`.
/// - They can have a *label*. In this case, the label is written next
/// to the mark in the snippet when we render.
#[derive(Clone, Debug, Hash, PartialEq, Eq, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, Hash, PartialEq, Eq, Encodable, Decodable, HashStable)]
pub struct MultiSpan {
primary_spans: Vec<Span>,
span_labels: Vec<(Span, DiagMessage)>,
+46 -66
View File
@@ -12,7 +12,7 @@
use rustc_data_structures::fx::FxIndexMap;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_hir::LangItem;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute};
use rustc_macros::{Decodable, Encodable, HashStable, PrintAttribute};
use rustc_span::def_id::DefId;
use rustc_span::hygiene::Transparency;
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
@@ -24,7 +24,7 @@
use crate::limit::Limit;
use crate::{DefaultBodyStability, PartialConstStability, RustcVersion, Stability};
#[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum EiiImplResolution {
/// Usually, finding the extern item that an EII implementation implements means finding
/// the defid of the associated attribute macro, and looking at *its* attributes to find
@@ -37,7 +37,7 @@ pub enum EiiImplResolution {
Error(ErrorGuaranteed),
}
#[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct EiiImpl {
pub resolution: EiiImplResolution,
pub impl_marked_unsafe: bool,
@@ -46,7 +46,7 @@ pub struct EiiImpl {
pub is_default: bool,
}
#[derive(Copy, Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Copy, Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct EiiDecl {
pub foreign_item: DefId,
/// whether or not it is unsafe to implement this EII
@@ -54,7 +54,7 @@ pub struct EiiDecl {
pub name: Ident,
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)]
pub enum CguKind {
No,
PreDashLto,
@@ -62,7 +62,7 @@ pub enum CguKind {
Any,
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)]
pub enum CguFields {
PartitionReused { cfg: Symbol, module: Symbol },
PartitionCodegened { cfg: Symbol, module: Symbol },
@@ -70,7 +70,7 @@ pub enum CguFields {
}
#[derive(Copy, Clone, PartialEq, Debug, PrintAttribute)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum DivergingFallbackBehavior {
/// Always fallback to `()` (aka "always spontaneous decay")
ToUnit,
@@ -82,7 +82,7 @@ pub enum DivergingFallbackBehavior {
}
#[derive(Copy, Clone, PartialEq, Debug, PrintAttribute, Default)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum DivergingBlockBehavior {
/// This is the current stable behavior:
///
@@ -105,7 +105,7 @@ pub enum DivergingBlockBehavior {
Unit,
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic, PrintAttribute)]
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable, PrintAttribute)]
pub enum InlineAttr {
None,
Hint,
@@ -129,24 +129,14 @@ pub fn always(&self) -> bool {
}
}
#[derive(
Copy,
Clone,
Encodable,
Decodable,
Debug,
PartialEq,
Eq,
HashStable_Generic,
PrintAttribute
)]
#[derive(Copy, Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable, PrintAttribute)]
pub enum InstructionSetAttr {
ArmA32,
ArmT32,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default, PrintAttribute)]
#[derive(Encodable, Decodable, HashStable_Generic)]
#[derive(Encodable, Decodable, HashStable)]
pub enum OptimizeAttr {
/// No `#[optimize(..)]` attribute
#[default]
@@ -165,7 +155,7 @@ pub fn do_not_optimize(&self) -> bool {
}
}
#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable_Generic, PrintAttribute)]
#[derive(PartialEq, Debug, Encodable, Decodable, Copy, Clone, HashStable, PrintAttribute)]
pub enum ReprAttr {
ReprInt(IntType),
ReprRust,
@@ -182,13 +172,13 @@ pub enum TransparencyError {
}
#[derive(Eq, PartialEq, Debug, Copy, Clone)]
#[derive(Encodable, Decodable, HashStable_Generic, PrintAttribute)]
#[derive(Encodable, Decodable, HashStable, PrintAttribute)]
pub enum IntType {
SignedInt(ast::IntTy),
UnsignedInt(ast::UintTy),
}
#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)]
pub struct Deprecation {
pub since: DeprecatedSince,
/// The note to issue a reason.
@@ -200,7 +190,7 @@ pub struct Deprecation {
}
/// Release in which an API is deprecated.
#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
#[derive(Copy, Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)]
pub enum DeprecatedSince {
RustcVersion(RustcVersion),
/// Deprecated in the future ("to be determined").
@@ -217,7 +207,7 @@ pub enum DeprecatedSince {
/// Successfully-parsed value of a `#[coverage(..)]` attribute.
#[derive(Copy, Debug, Eq, PartialEq, Encodable, Decodable, Clone)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum CoverageAttrKind {
On,
Off,
@@ -225,7 +215,7 @@ pub enum CoverageAttrKind {
/// Successfully-parsed value of a `#[rustc_abi(..)]` attribute.
#[derive(Copy, Debug, Eq, PartialEq, Encodable, Decodable, Clone)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum RustcAbiAttrKind {
Debug,
AssertEq,
@@ -256,7 +246,7 @@ pub fn is_since_rustc_version(&self) -> bool {
/// `#[used(compiler)]`
/// `#[used(linker)]`
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum UsedBy {
Default,
Compiler,
@@ -264,7 +254,7 @@ pub enum UsedBy {
}
#[derive(Encodable, Decodable, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum MacroUseArgs {
UseAll,
UseSpecific(ThinVec<Ident>),
@@ -276,7 +266,7 @@ fn default() -> Self {
}
}
#[derive(Debug, Clone, Encodable, Decodable, HashStable_Generic)]
#[derive(Debug, Clone, Encodable, Decodable, HashStable)]
pub struct StrippedCfgItem<ScopeId = DefId> {
pub parent_scope: ScopeId,
pub ident: Ident,
@@ -294,7 +284,7 @@ pub fn map_scope_id<New>(self, f: impl FnOnce(ScopeId) -> New) -> StrippedCfgIte
///
/// See <https://llvm.org/docs/LangRef.html#linkage-types> for more details about these variants.
#[derive(Encodable, Decodable, Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum Linkage {
AvailableExternally,
Common,
@@ -308,7 +298,7 @@ pub enum Linkage {
}
#[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum MirDialect {
Analysis,
Built,
@@ -327,7 +317,7 @@ fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
}
#[derive(Clone, Copy, Decodable, Debug, Encodable, PartialEq)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum MirPhase {
Initial,
PostCleanup,
@@ -347,17 +337,7 @@ fn into_diag_arg(self, _path: &mut Option<PathBuf>) -> DiagArgValue {
/// Different ways that the PE Format can decorate a symbol name.
/// From <https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-name-type>
#[derive(
Copy,
Clone,
Debug,
Encodable,
Decodable,
HashStable_Generic,
PartialEq,
Eq,
PrintAttribute
)]
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, PartialEq, Eq, PrintAttribute)]
pub enum PeImportNameType {
/// IMPORT_ORDINAL
/// Uses the ordinal (i.e., a number) rather than the name.
@@ -387,7 +367,7 @@ pub enum PeImportNameType {
Decodable,
PrintAttribute
)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum NativeLibKind {
/// Static library (e.g. `libfoo.a` on Linux or `foo.lib` on Windows/MSVC)
Static {
@@ -455,7 +435,7 @@ pub fn is_dllimport(&self) -> bool {
}
}
#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
#[derive(Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)]
pub struct LinkEntry {
pub span: Span,
pub kind: NativeLibKind,
@@ -465,14 +445,14 @@ pub struct LinkEntry {
pub import_name_type: Option<(PeImportNameType, Span)>,
}
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug, Encodable, Decodable)]
pub enum DebuggerVisualizerType {
Natvis,
GdbPrettyPrinter,
}
#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)]
#[derive(Debug, Encodable, Decodable, Clone, HashStable, PrintAttribute)]
pub struct DebugVisualizer {
pub span: Span,
pub visualizer_type: DebuggerVisualizerType,
@@ -480,7 +460,7 @@ pub struct DebugVisualizer {
}
#[derive(Clone, Copy, Debug, Decodable, Encodable, Eq, PartialEq)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
#[derive_const(Default)]
pub enum RtsanSetting {
Nonblocking,
@@ -490,7 +470,7 @@ pub enum RtsanSetting {
}
#[derive(Eq, PartialEq, Debug, Copy, Clone)]
#[derive(Encodable, Decodable, HashStable_Generic, PrintAttribute)]
#[derive(Encodable, Decodable, HashStable, PrintAttribute)]
pub enum WindowsSubsystemKind {
Console,
Windows,
@@ -506,20 +486,20 @@ pub fn as_str(&self) -> &'static str {
}
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub enum DocInline {
Inline,
NoInline,
}
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub enum HideOrShow {
Hide,
Show,
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct CfgInfo {
pub name: Symbol,
pub name_span: Span,
@@ -536,13 +516,13 @@ pub fn span_for_name_and_value(&self) -> Span {
}
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct CfgHideShow {
pub kind: HideOrShow,
pub values: ThinVec<CfgInfo>,
}
#[derive(Clone, Debug, Default, HashStable_Generic, Decodable, PrintAttribute)]
#[derive(Clone, Debug, Default, HashStable, Decodable, PrintAttribute)]
pub struct DocAttribute {
pub first_span: Span,
@@ -646,7 +626,7 @@ fn encode(&self, encoder: &mut E) {
/// | external | no | if-ext | if-ext | yes |
/// | yes | yes | yes | yes | yes |
#[derive(Copy, Clone, Debug, Hash, PartialEq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub enum CollapseMacroDebuginfo {
/// Don't collapse debuginfo for the macro
No = 0,
@@ -660,7 +640,7 @@ pub enum CollapseMacroDebuginfo {
/// Crate type, as specified by `#![crate_type]`
#[derive(Copy, Clone, Debug, Hash, PartialEq, Default, PartialOrd, Eq, Ord)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub enum CrateType {
/// `#![crate_type = "bin"]`
Executable,
@@ -760,7 +740,7 @@ fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
}
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum RustcDumpLayoutKind {
Align,
BackendRepr,
@@ -769,7 +749,7 @@ pub enum RustcDumpLayoutKind {
Size,
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
pub enum RustcMirKind {
PeekMaybeInit,
PeekMaybeUninit,
@@ -779,13 +759,13 @@ pub enum RustcMirKind {
BorrowckGraphvizFormat { format: BorrowckGraphvizFormatKind },
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
pub enum BorrowckGraphvizFormatKind {
TwoPhase,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub struct RustcCleanAttribute {
pub span: Span,
pub cfg: Symbol,
@@ -795,14 +775,14 @@ pub struct RustcCleanAttribute {
/// Represents the `except=` or `loaded_from_disk=` argument of `#[rustc_clean]`
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub struct RustcCleanQueries {
pub entries: ThinVec<Symbol>,
pub span: Span,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[derive(HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(HashStable, Encodable, Decodable, PrintAttribute)]
pub struct RustcAutodiff {
/// Conceptually either forward or reverse mode AD, as described in various autodiff papers and
/// e.g. in the [JAX
@@ -878,7 +858,7 @@ pub fn into_item(
}
/// We generate one of these structs for each `#[autodiff(...)]` attribute.
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Eq, PartialEq, Encodable, Decodable, Debug, HashStable)]
pub struct AutoDiffItem {
/// The name of the function getting differentiated
pub source: String,
@@ -898,7 +878,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct UnstableRemovedFeature {
pub feature: Symbol,
pub reason: Symbol,
@@ -955,7 +935,7 @@ pub struct UnstableRemovedFeature {
/// [`rustc_parse`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
/// [`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
/// [`rustc_attr_parsing`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_attr_parsing/index.html
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum AttributeKind {
// tidy-alphabetical-start
/// Represents `#[allow_internal_unsafe]`.
+12 -12
View File
@@ -3,14 +3,14 @@
use std::fmt::Debug;
pub use rustc_ast::attr::data_structures::*;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, PrintAttribute};
use rustc_macros::{Decodable, Encodable, HashStable, PrintAttribute};
use rustc_span::{DesugaringKind, Span, Symbol, kw};
use thin_vec::ThinVec;
use tracing::debug;
use crate::attrs::PrintAttribute;
#[derive(Clone, Default, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Default, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct Directive {
pub is_rustc_attr: bool,
pub condition: Option<OnUnimplementedCondition>,
@@ -123,7 +123,7 @@ pub struct CustomDiagnostic {
/// Like [std::fmt::Arguments] this is a string that has been parsed into "pieces",
/// either as string pieces or dynamic arguments.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct FormatString {
pub input: Symbol,
pub span: Span,
@@ -225,13 +225,13 @@ pub struct FormatArgs {
pub generic_args: Vec<(Symbol, String)> = Vec::new(),
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum Piece {
Lit(Symbol),
Arg(FormatArg),
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum FormatArg {
// A generic parameter, like `{T}` if we're on the `From<T>` trait.
GenericParam {
@@ -251,7 +251,7 @@ pub enum FormatArg {
}
/// Represents the `on` filter in `#[rustc_on_unimplemented]`.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct OnUnimplementedCondition {
pub span: Span,
pub pred: Predicate,
@@ -276,7 +276,7 @@ pub fn visit_params(&self, visit: &mut impl FnMut(Symbol, Span)) {
///
/// It is similar to the predicate in the `cfg` attribute,
/// and may contain nested predicates.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum Predicate {
/// A condition like `on(crate_local)`.
Flag(Flag),
@@ -314,7 +314,7 @@ pub fn visit_params(&self, span: Span, visit: &mut impl FnMut(Symbol, Span)) {
}
/// Represents a `MetaWord` in an `on`-filter.
#[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum Flag {
/// Whether the code causing the trait bound to not be fulfilled
/// is part of the user's crate.
@@ -329,7 +329,7 @@ pub enum Flag {
/// A `MetaNameValueStr` in an `on`-filter.
///
/// For example, `#[rustc_on_unimplemented(on(name = "value", message = "hello"))]`.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct NameValue {
pub name: Name,
/// Something like `"&str"` or `"alloc::string::String"`,
@@ -348,7 +348,7 @@ pub fn visit_params(&self, span: Span, visit: &mut impl FnMut(Symbol, Span)) {
}
/// The valid names of the `on` filter.
#[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum Name {
Cause,
FromDesugaring,
@@ -368,7 +368,7 @@ pub enum FlagOrNv<'p> {
/// If it is a simple literal like this then `pieces` will be `[LitOrArg::Lit("value")]`.
/// The `Arg` variant is used when it contains formatting like
/// `#[rustc_on_unimplemented(on(Self = "&[{A}]", message = "hello"))]`.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub struct FilterFormatString {
pub pieces: ThinVec<LitOrArg>,
}
@@ -400,7 +400,7 @@ pub fn visit_params(&self, span: Span, visit: &mut impl FnMut(Symbol, Span)) {
}
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable, PrintAttribute)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable, PrintAttribute)]
pub enum LitOrArg {
Lit(Symbol),
Arg(Symbol),
+9 -9
View File
@@ -7,7 +7,7 @@
use rustc_data_structures::stable_hasher::ToStableHashKey;
use rustc_data_structures::unord::UnordMap;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::Symbol;
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::hygiene::MacroKind;
@@ -16,7 +16,7 @@
use crate::hir;
/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum CtorOf {
/// This `DefKind::Ctor` is a synthesized constructor of a tuple or unit struct.
Struct,
@@ -25,7 +25,7 @@ pub enum CtorOf {
}
/// What kind of constructor something is.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum CtorKind {
/// Constructor function automatically created by a tuple struct/variant.
Fn,
@@ -35,7 +35,7 @@ pub enum CtorKind {
/// A set of macro kinds, for macros that can have more than one kind
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub struct MacroKinds(u8);
bitflags::bitflags! {
impl MacroKinds: u8 {
@@ -81,7 +81,7 @@ pub fn article(self) -> &'static str {
}
/// An attribute that is not a macro; e.g., `#[inline]` or `#[rustfmt::skip]`.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum NonMacroAttrKind {
/// Single-segment attribute defined by the language (`#[inline]`)
Builtin(Symbol),
@@ -96,7 +96,7 @@ pub enum NonMacroAttrKind {
/// What kind of definition something is; e.g., `mod` vs `struct`.
/// `enum DefPathData` may need to be updated if a new variant is added here.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum DefKind {
// Type namespace
Mod,
@@ -511,7 +511,7 @@ pub fn is_typeck_child(self) -> bool {
/// - the call to `str_to_string` will resolve to [`Res::Def`], with the [`DefId`]
/// pointing to the definition of `str_to_string` in the current crate.
//
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum Res<Id = hir::HirId> {
/// Definition having a unique ID (`DefId`), corresponds to something defined in user code.
///
@@ -679,7 +679,7 @@ pub fn expect_full_res(&self) -> Res<NodeId> {
/// Different kinds of symbols can coexist even if they share the same textual name.
/// Therefore, they each have a separate universe (known as a "namespace").
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Encodable, Decodable)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum Namespace {
/// The type namespace includes `struct`s, `enum`s, `union`s, `trait`s, and `mod`s
/// (and, by extension, crates).
@@ -722,7 +722,7 @@ fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> Namespace {
}
/// Just a helper separate structure for each namespace.
#[derive(Copy, Clone, Default, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Default, Debug, HashStable)]
pub struct PerNS<T> {
pub value_ns: T,
pub type_ns: T,
+2 -2
View File
@@ -1,11 +1,11 @@
use rustc_data_structures::fx::FxIndexMap;
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use rustc_span::Symbol;
use rustc_span::def_id::DefIdMap;
use crate::def_id::DefId;
#[derive(Debug, Default, HashStable_Generic)]
#[derive(Debug, Default, HashStable)]
pub struct DiagnosticItems {
#[stable_hasher(ignore)]
pub id_to_name: DefIdMap<Symbol>,
+141 -141
View File
@@ -21,7 +21,7 @@
use rustc_data_structures::tagged_ptr::TaggedRef;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::def_id::LocalDefId;
use rustc_span::{
BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, sym,
@@ -38,7 +38,7 @@
use crate::intravisit::{FnKind, VisitorExt};
use crate::lints::DelayedLints;
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)]
pub enum AngleBrackets {
/// E.g. `Path`.
Missing,
@@ -48,7 +48,7 @@ pub enum AngleBrackets {
Full,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)]
pub enum LifetimeSource {
/// E.g. `&Type`, `&'_ Type`, `&'a Type`, `&mut Type`, `&'_ mut Type`, `&'a mut Type`
Reference,
@@ -72,7 +72,7 @@ pub enum LifetimeSource {
Other,
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable)]
pub enum LifetimeSyntax {
/// E.g. `&Type`, `ContainsLifetime`
Implicit,
@@ -149,7 +149,7 @@ fn from(ident: Ident) -> Self {
/// Some combinations that cannot occur are `LifetimeSyntax::Implicit` with
/// `LifetimeSource::OutlivesBound` or `LifetimeSource::PreciseCapturing`
/// — there's no way to "elide" these lifetimes.
#[derive(Debug, Copy, Clone, HashStable_Generic)]
#[derive(Debug, Copy, Clone, HashStable)]
// Raise the alignment to at least 4 bytes.
// This is relied on in other parts of the compiler (for pointer tagging):
// <https://github.com/rust-lang/rust/blob/ce5fdd7d42aba9a2925692e11af2bd39cf37798a/compiler/rustc_data_structures/src/tagged_ptr.rs#L163>
@@ -179,7 +179,7 @@ pub struct Lifetime {
pub syntax: LifetimeSyntax,
}
#[derive(Debug, Copy, Clone, HashStable_Generic)]
#[derive(Debug, Copy, Clone, HashStable)]
pub enum ParamName {
/// Some user-given name like `T` or `'x`.
Plain(Ident),
@@ -217,7 +217,7 @@ pub fn ident(&self) -> Ident {
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable)]
pub enum LifetimeKind {
/// User-given names or fresh (synthetic) names.
Param(LocalDefId),
@@ -344,7 +344,7 @@ pub fn suggestion(&self, new_lifetime: &str) -> (Span, String) {
/// A `Path` is essentially Rust's notion of a name; for instance,
/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
/// along with a bunch of supporting information.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Path<'hir, R = Res> {
pub span: Span,
/// The resolution for the path.
@@ -364,7 +364,7 @@ pub fn is_global(&self) -> bool {
/// A segment of a path: an identifier, an optional lifetime, and a set of
/// types.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct PathSegment<'hir> {
/// The identifier portion of this path segment.
pub ident: Ident,
@@ -401,7 +401,7 @@ pub fn args(&self) -> &GenericArgs<'hir> {
}
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub enum ConstItemRhs<'hir> {
Body(BodyId),
TypeConst(&'hir ConstArg<'hir>),
@@ -436,7 +436,7 @@ pub fn span<'tcx>(&self, tcx: impl crate::intravisit::HirTyCtxt<'tcx>) -> Span {
///
/// For an explanation of the `Unambig` generic parameter see the dev-guide:
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
#[repr(C)]
pub struct ConstArg<'hir, Unambig = ()> {
#[stable_hasher(ignore)]
@@ -493,7 +493,7 @@ pub fn anon_const_hir_id(&self) -> Option<HirId> {
}
/// See [`ConstArg`].
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
#[repr(u8, C)]
pub enum ConstArgKind<'hir, Unambig = ()> {
Tup(&'hir [&'hir ConstArg<'hir, Unambig>]),
@@ -521,7 +521,7 @@ pub enum ConstArgKind<'hir, Unambig = ()> {
},
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub struct ConstArgExprField<'hir> {
pub hir_id: HirId,
pub span: Span,
@@ -529,13 +529,13 @@ pub struct ConstArgExprField<'hir> {
pub expr: &'hir ConstArg<'hir>,
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub struct ConstArgArrayExpr<'hir> {
pub span: Span,
pub elems: &'hir [&'hir ConstArg<'hir>],
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub struct InferArg {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -548,7 +548,7 @@ pub fn to_ty(&self) -> Ty<'static> {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum GenericArg<'hir> {
Lifetime(&'hir Lifetime),
Type(&'hir Ty<'hir, AmbigArg>),
@@ -611,7 +611,7 @@ pub fn is_ty_or_const(&self) -> bool {
}
/// The generic arguments and associated item constraints of a path segment.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct GenericArgs<'hir> {
/// The generic arguments for this path segment.
pub args: &'hir [GenericArg<'hir>],
@@ -735,7 +735,7 @@ pub fn is_empty(&self) -> bool {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Debug, HashStable)]
pub enum GenericArgsParentheses {
No,
/// Bounds for `feature(return_type_notation)`, like `T: Trait<method(..): Send>`,
@@ -746,7 +746,7 @@ pub enum GenericArgsParentheses {
}
/// The modifiers on a trait bound.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub struct TraitBoundModifiers {
pub constness: BoundConstness,
pub polarity: BoundPolarity,
@@ -757,7 +757,7 @@ impl TraitBoundModifiers {
TraitBoundModifiers { constness: BoundConstness::Never, polarity: BoundPolarity::Positive };
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub enum GenericBound<'hir> {
Trait(PolyTraitRef<'hir>),
Outlives(&'hir Lifetime),
@@ -783,7 +783,7 @@ pub fn span(&self) -> Span {
pub type GenericBounds<'hir> = &'hir [GenericBound<'hir>];
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, Debug)]
pub enum MissingLifetimeKind {
/// An explicit `'_`.
Underscore,
@@ -795,7 +795,7 @@ pub enum MissingLifetimeKind {
Brackets,
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum LifetimeParamKind {
// Indicates that the lifetime definition was explicitly declared (e.g., in
// `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`).
@@ -809,7 +809,7 @@ pub enum LifetimeParamKind {
Error,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum GenericParamKind<'hir> {
/// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
Lifetime {
@@ -826,7 +826,7 @@ pub enum GenericParamKind<'hir> {
},
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct GenericParam<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -865,7 +865,7 @@ pub fn is_lifetime(&self) -> bool {
/// early-bound (but can be a late-bound lifetime in functions, for example),
/// or from a `for<...>` binder, in which case it's late-bound (and notably,
/// does not show up in the parent item's generics).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum GenericParamSource {
// Early or late-bound parameters defined on an item
Generics,
@@ -883,7 +883,7 @@ pub struct GenericParamCount {
/// Represents lifetimes and type parameters attached to a declaration
/// of a function, enum, trait, etc.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Generics<'hir> {
pub params: &'hir [GenericParam<'hir>],
pub predicates: &'hir [WherePredicate<'hir>],
@@ -1090,7 +1090,7 @@ pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) ->
}
/// A single predicate in a where-clause.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct WherePredicate<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -1099,7 +1099,7 @@ pub struct WherePredicate<'hir> {
}
/// The kind of a single predicate in a where-clause.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum WherePredicateKind<'hir> {
/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
BoundPredicate(WhereBoundPredicate<'hir>),
@@ -1127,7 +1127,7 @@ pub fn bounds(&self) -> GenericBounds<'hir> {
}
}
#[derive(Copy, Clone, Debug, HashStable_Generic, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, HashStable, PartialEq, Eq)]
pub enum PredicateOrigin {
WhereClause,
GenericParam,
@@ -1135,7 +1135,7 @@ pub enum PredicateOrigin {
}
/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct WhereBoundPredicate<'hir> {
/// Origin of the predicate.
pub origin: PredicateOrigin,
@@ -1155,7 +1155,7 @@ pub fn is_param_bound(&self, param_def_id: DefId) -> bool {
}
/// A lifetime predicate (e.g., `'a: 'b + 'c`).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct WhereRegionPredicate<'hir> {
pub in_where_clause: bool,
pub lifetime: &'hir Lifetime,
@@ -1170,7 +1170,7 @@ fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
}
/// An equality predicate (e.g., `T = int`); currently unsupported.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct WhereEqPredicate<'hir> {
pub lhs_ty: &'hir Ty<'hir>,
pub rhs_ty: &'hir Ty<'hir>,
@@ -1186,7 +1186,7 @@ pub struct ParentedNode<'tcx> {
}
/// Arguments passed to an attribute macro.
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable)]
pub enum AttrArgs {
/// No arguments: `#[attr]`.
Empty,
@@ -1201,7 +1201,7 @@ pub enum AttrArgs {
},
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable)]
pub struct AttrPath {
pub segments: Box<[Symbol]>,
pub span: Span,
@@ -1237,7 +1237,7 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
}
}
#[derive(Clone, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Debug, HashStable, Encodable, Decodable)]
pub struct AttrItem {
// Not lowered to hir::Path because we have no NodeId to resolve to.
pub path: AttrPath,
@@ -1259,7 +1259,7 @@ pub struct HashIgnoredAttrId {
/// Many functions on this type have their documentation in the [`AttributeExt`] trait,
/// since they defer their implementation directly to that trait.
#[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
pub enum Attribute {
/// A parsed built-in attribute.
///
@@ -1618,7 +1618,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
/// Full information resulting from lowering an AST node.
#[derive(Debug, HashStable_Generic)]
#[derive(Debug, HashStable)]
pub struct OwnerInfo<'hir> {
/// Contents of the HIR.
pub nodes: OwnerNodes<'hir>,
@@ -1646,7 +1646,7 @@ pub fn node(&self) -> OwnerNode<'tcx> {
}
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum MaybeOwner<'tcx> {
Owner(&'tcx OwnerInfo<'tcx>),
NonOwner(HirId),
@@ -1667,7 +1667,7 @@ pub fn unwrap(self) -> &'tcx OwnerInfo<'tcx> {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Closure<'hir> {
pub def_id: LocalDefId,
pub binder: ClosureBinder,
@@ -1683,7 +1683,7 @@ pub struct Closure<'hir> {
pub kind: ClosureKind,
}
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)]
pub enum ClosureKind {
/// This is a plain closure expression.
Closure,
@@ -1702,7 +1702,7 @@ pub enum ClosureKind {
/// 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
/// the `rules` being anything but `DefaultBlock`.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Block<'hir> {
/// Statements in a block.
pub stmts: &'hir [Stmt<'hir>],
@@ -1731,13 +1731,13 @@ pub fn innermost_block(&self) -> &Block<'hir> {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct TyFieldPath {
pub variant: Option<Ident>,
pub field: Ident,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct TyPat<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -1745,7 +1745,7 @@ pub struct TyPat<'hir> {
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Pat<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -1893,7 +1893,7 @@ pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool {
/// 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`,
/// except `is_shorthand` is true.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct PatField<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -1905,7 +1905,7 @@ pub struct PatField<'hir> {
pub span: Span,
}
#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic, Hash, Eq, Encodable, Decodable)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable, Hash, Eq, Encodable, Decodable)]
pub enum RangeEnd {
Included,
Excluded,
@@ -1923,7 +1923,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Equivalent to `Option<usize>`. That type takes up 16 bytes on 64-bit, but
// this type only takes up 4 bytes, at the cost of being restricted to a
// maximum value of `u32::MAX - 1`. In practice, this is more than enough.
#[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable)]
pub struct DotDotPos(u32);
impl DotDotPos {
@@ -1949,7 +1949,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct PatExpr<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -1957,7 +1957,7 @@ pub struct PatExpr<'hir> {
pub kind: PatExprKind<'hir>,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum PatExprKind<'hir> {
Lit {
lit: Lit,
@@ -1967,7 +1967,7 @@ pub enum PatExprKind<'hir> {
Path(QPath<'hir>),
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum TyPatKind<'hir> {
/// A range pattern (e.g., `1..=2` or `1..2`).
Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>),
@@ -1982,7 +1982,7 @@ pub enum TyPatKind<'hir> {
Err(ErrorGuaranteed),
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum PatKind<'hir> {
/// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`.
Missing,
@@ -2057,7 +2057,7 @@ pub enum PatKind<'hir> {
}
/// A statement.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Stmt<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2066,7 +2066,7 @@ pub struct Stmt<'hir> {
}
/// The contents of a statement.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum StmtKind<'hir> {
/// A local (`let`) binding.
Let(&'hir LetStmt<'hir>),
@@ -2082,7 +2082,7 @@ pub enum StmtKind<'hir> {
}
/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct LetStmt<'hir> {
/// Span of `super` in `super let`.
pub super_: Option<Span>,
@@ -2104,7 +2104,7 @@ pub struct LetStmt<'hir> {
/// Represents a single arm of a `match` expression, e.g.
/// `<pat> (if <guard>) => <body>`.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Arm<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2122,7 +2122,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 desugaring to if-let. Only let-else supports the type annotation at present.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct LetExpr<'hir> {
pub span: Span,
pub pat: &'hir Pat<'hir>,
@@ -2133,7 +2133,7 @@ pub struct LetExpr<'hir> {
pub recovered: ast::Recovered,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct ExprField<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2143,19 +2143,19 @@ pub struct ExprField<'hir> {
pub is_shorthand: bool,
}
#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub enum BlockCheckMode {
DefaultBlock,
UnsafeBlock(UnsafeSource),
}
#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub enum UnsafeSource {
CompilerGenerated,
UserProvided,
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub struct BodyId {
pub hir_id: HirId,
}
@@ -2181,7 +2181,7 @@ pub struct BodyId {
///
/// All bodies have an **owner**, which can be accessed via the HIR
/// map using `body_owner_def_id()`.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Body<'hir> {
pub params: &'hir [Param<'hir>],
pub value: &'hir Expr<'hir>,
@@ -2194,7 +2194,7 @@ pub fn id(&self) -> BodyId {
}
/// The type of source expression that caused this coroutine to be created.
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)]
pub enum CoroutineKind {
/// A coroutine that comes from a desugaring.
Desugared(CoroutineDesugaring, CoroutineSource),
@@ -2244,7 +2244,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
///
/// This helps error messages but is also used to drive coercions in
/// type-checking (see #60424).
#[derive(Clone, PartialEq, Eq, Hash, Debug, Copy, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, Copy, HashStable, Encodable, Decodable)]
pub enum CoroutineSource {
/// An explicit `async`/`gen` block written by the user.
Block,
@@ -2267,7 +2267,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, PartialEq, Eq, Debug, Copy, Hash, HashStable, Encodable, Decodable)]
pub enum CoroutineDesugaring {
/// An explicit `async` block or the body of an `async` function.
Async,
@@ -2407,7 +2407,7 @@ fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
///
/// You can check if this anon const is a default in a const param
/// `const N: usize = { ... }` with `tcx.hir_opt_const_param_default_param_def_id(..)`
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub struct AnonConst {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2417,7 +2417,7 @@ pub struct AnonConst {
}
/// An inline constant expression `const { something }`.
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub struct ConstBlock {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2433,7 +2433,7 @@ pub struct ConstBlock {
/// the compiler and the reference.
///
/// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Expr<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -2792,7 +2792,7 @@ pub fn expr_needs_parens(expr: &Expr<'_>) -> bool {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum ExprKind<'hir> {
/// Allow anonymous constants from an inline `const` block
ConstBlock(ConstBlock),
@@ -2931,7 +2931,7 @@ pub enum ExprKind<'hir> {
Err(rustc_span::ErrorGuaranteed),
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum StructTailExpr<'hir> {
/// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`.
None,
@@ -2955,7 +2955,7 @@ pub enum StructTailExpr<'hir> {
/// To resolve the path to a `DefId`, call [`qpath_res`].
///
/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum QPath<'hir> {
/// Path to a definition, optionally "fully-qualified" with a `Self`
/// type, if the path points to an associated item in a trait.
@@ -2994,7 +2994,7 @@ pub fn qself_span(&self) -> Span {
}
/// Hints at the original code for a let statement.
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum LocalSource {
/// A `match _ { .. }`.
Normal,
@@ -3018,7 +3018,7 @@ pub enum LocalSource {
}
/// Hints at the original code for a `match _ { .. }`.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable, Encodable, Decodable)]
pub enum MatchSource {
/// A `match _ { .. }`.
Normal,
@@ -3050,7 +3050,7 @@ pub const fn name(self) -> &'static str {
}
/// The loop type that yielded an `ExprKind::Loop`.
#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub enum LoopSource {
/// A `loop { .. }` loop.
Loop,
@@ -3070,7 +3070,7 @@ pub fn name(self) -> &'static str {
}
}
#[derive(Copy, Clone, Debug, PartialEq, HashStable_Generic)]
#[derive(Copy, Clone, Debug, PartialEq, HashStable)]
pub enum LoopIdError {
OutsideLoopScope,
UnlabeledCfInWhileCondition,
@@ -3089,7 +3089,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Copy, Clone, Debug, PartialEq, HashStable_Generic)]
#[derive(Copy, Clone, Debug, PartialEq, HashStable)]
pub struct Destination {
/// This is `Some(_)` iff there is an explicit user-specified 'label
pub label: Option<Label>,
@@ -3100,7 +3100,7 @@ pub struct Destination {
}
/// The yield kind that caused an `ExprKind::Yield`.
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum YieldSource {
/// An `<expr>.await`.
Await { expr: Option<HirId> },
@@ -3119,7 +3119,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// N.B., if you change this, you'll probably want to change the corresponding
// type structure in middle/ty.rs as well.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct MutTy<'hir> {
pub ty: &'hir Ty<'hir>,
pub mutbl: Mutability,
@@ -3127,7 +3127,7 @@ pub struct MutTy<'hir> {
/// Represents a function's signature in a trait declaration,
/// trait implementation, or a free function.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct FnSig<'hir> {
pub header: FnHeader,
pub decl: &'hir FnDecl<'hir>,
@@ -3137,7 +3137,7 @@ pub struct FnSig<'hir> {
// The bodies for items are stored "out of line", in a separate
// hashmap in the `Crate`. Here we just record the hir-id of the item
// so it can fetched later.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub struct TraitItemId {
pub owner_id: OwnerId,
}
@@ -3154,7 +3154,7 @@ pub fn hir_id(&self) -> HirId {
/// possibly including a default implementation. A trait item is
/// either required (meaning it doesn't have an implementation, just a
/// signature) or provided (meaning it has a default implementation).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct TraitItem<'hir> {
pub ident: Ident,
pub owner_id: OwnerId,
@@ -3218,7 +3218,7 @@ pub fn trait_item_id(&self) -> TraitItemId {
}
/// Represents a trait method's body (or just argument names).
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum TraitFn<'hir> {
/// No default body in the trait, just a signature.
Required(&'hir [Option<Ident>]),
@@ -3227,7 +3227,7 @@ pub enum TraitFn<'hir> {
Provided(BodyId),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)]
pub enum IsTypeConst {
No,
Yes,
@@ -3246,7 +3246,7 @@ fn from(value: IsTypeConst) -> Self {
}
/// Represents a trait method or associated constant or type
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum TraitItemKind<'hir> {
// FIXME(mgca) eventually want to move the option that is around `ConstItemRhs<'hir>`
// into `ConstItemRhs`, much like `ast::ConstItemRhsKind`, but for now mark whether
@@ -3263,7 +3263,7 @@ pub enum TraitItemKind<'hir> {
// The bodies for items are stored "out of line", in a separate
// hashmap in the `Crate`. Here we just record the hir-id of the item
// so it can fetched later.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub struct ImplItemId {
pub owner_id: OwnerId,
}
@@ -3279,7 +3279,7 @@ pub fn hir_id(&self) -> HirId {
/// Represents an associated item within an impl block.
///
/// Refer to [`Impl`] for an impl block declaration.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct ImplItem<'hir> {
pub ident: Ident,
pub owner_id: OwnerId,
@@ -3290,7 +3290,7 @@ pub struct ImplItem<'hir> {
pub has_delayed_lints: bool,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum ImplItemImplKind {
Inherent {
vis_span: Span,
@@ -3328,7 +3328,7 @@ pub fn vis_span(&self) -> Option<Span> {
}
/// Represents various kinds of content within an `impl`.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum ImplItemKind<'hir> {
/// An associated constant of the given type, set to the constant result
/// of the expression.
@@ -3349,7 +3349,7 @@ pub enum ImplItemKind<'hir> {
/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`)
/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct AssocItemConstraint<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -3377,7 +3377,7 @@ pub fn ct(self) -> Option<&'hir ConstArg<'hir>> {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum Term<'hir> {
Ty(&'hir Ty<'hir>),
Const(&'hir ConstArg<'hir>),
@@ -3396,7 +3396,7 @@ fn from(c: &'hir ConstArg<'hir>) -> Self {
}
/// The kind of [associated item constraint][AssocItemConstraint].
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum AssocItemConstraintKind<'hir> {
/// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait<AssocTy = Ty>`).
///
@@ -3421,14 +3421,14 @@ pub fn descr(&self) -> &'static str {
/// An uninhabited enum used to make `Infer` variants on [`Ty`] and [`ConstArg`] be
/// unreachable. Zero-Variant enums are guaranteed to have the same layout as the never
/// type.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum AmbigArg {}
/// Represents a type in the `HIR`.
///
/// For an explanation of the `Unambig` generic parameter see the dev-guide:
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
#[repr(C)]
pub struct Ty<'hir, Unambig = ()> {
#[stable_hasher(ignore)]
@@ -3568,7 +3568,7 @@ fn are_suggestable_generic_args(generic_args: &[GenericArg<'_>]) -> bool {
}
/// Not represented directly in the AST; referred to by name through a `ty_path`.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable)]
pub enum PrimTy {
Int(IntTy),
Uint(UintTy),
@@ -3658,7 +3658,7 @@ pub fn from_name(name: Symbol) -> Option<Self> {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct FnPtrTy<'hir> {
pub safety: Safety,
pub abi: ExternAbi,
@@ -3669,13 +3669,13 @@ pub struct FnPtrTy<'hir> {
pub param_idents: &'hir [Option<Ident>],
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct UnsafeBinderTy<'hir> {
pub generic_params: &'hir [GenericParam<'hir>],
pub inner_ty: &'hir Ty<'hir>,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct OpaqueTy<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -3685,7 +3685,7 @@ pub struct OpaqueTy<'hir> {
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic, Encodable, Decodable)]
#[derive(Debug, Clone, Copy, HashStable, Encodable, Decodable)]
pub enum PreciseCapturingArgKind<T, U> {
Lifetime(T),
/// Non-lifetime argument (type or const)
@@ -3715,7 +3715,7 @@ pub fn name(self) -> Symbol {
/// resolution to. Lifetimes don't have this problem, and for them, it's actually
/// kind of detrimental to use a custom node type versus just using [`Lifetime`],
/// since resolve_bound_vars operates on `Lifetime`s.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct PreciseCapturingNonLifetimeArg {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -3724,7 +3724,7 @@ pub struct PreciseCapturingNonLifetimeArg {
}
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum RpitContext {
Trait,
TraitImpl,
@@ -3732,7 +3732,7 @@ pub enum RpitContext {
/// From whence the opaque type came.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum OpaqueTyOrigin<D> {
/// `-> impl Trait`
FnReturn {
@@ -3758,7 +3758,7 @@ pub enum OpaqueTyOrigin<D> {
}
// Ids of parent (or child) path segment that contains user-specified args
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)]
pub struct DelegationGenerics {
pub parent_args_segment_id: Option<HirId>,
pub child_args_segment_id: Option<HirId>,
@@ -3766,14 +3766,14 @@ pub struct DelegationGenerics {
pub propagate_self_ty: bool,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)]
pub enum InferDelegationSig<'hir> {
Input(usize),
// Place generics info here, as we always specify output type for delegations.
Output(&'hir DelegationGenerics),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable)]
pub enum InferDelegation<'hir> {
/// Infer the type of this `DefId` through `tcx.type_of(def_id).instantiate_identity()`,
/// used for const types propagation.
@@ -3788,7 +3788,7 @@ pub enum InferDelegation<'hir> {
/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
// SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible
#[repr(u8, C)]
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum TyKind<'hir, Unambig = ()> {
/// Actual type should be inherited from `DefId` signature
InferDelegation(InferDelegation<'hir>),
@@ -3839,7 +3839,7 @@ pub enum TyKind<'hir, Unambig = ()> {
Infer(Unambig),
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum InlineAsmOperand<'hir> {
In {
reg: InlineAsmRegOrRegClass,
@@ -3898,7 +3898,7 @@ pub fn is_clobber(&self) -> bool {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct InlineAsm<'hir> {
pub asm_macro: ast::AsmMacro,
pub template: &'hir [InlineAsmTemplatePiece],
@@ -3915,7 +3915,7 @@ pub fn contains_label(&self) -> bool {
}
/// Represents a parameter in a function header.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Param<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
@@ -3927,7 +3927,7 @@ pub struct Param<'hir> {
/// Contains the packed non-type fields of a function declaration.
// FIXME(splat): add the splatted argument index as a u16
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Encodable, Decodable, HashStable_Generic)]
#[derive(Encodable, Decodable, HashStable)]
pub struct FnDeclFlags {
/// Holds the c_variadic and lifetime_elision_allowed bitflags, and 3 bits for the `ImplicitSelfKind`.
flags: u8,
@@ -4036,7 +4036,7 @@ pub const fn lifetime_elision_allowed(self) -> bool {
}
/// Represents the header (not the body) of a function declaration.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct FnDecl<'hir> {
/// The types of the function's parameters.
///
@@ -4090,7 +4090,7 @@ pub fn dummy(span: Span) -> Self {
}
/// Represents what type of implicit self a function has, if any.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub enum ImplicitSelfKind {
/// Represents a `fn x(self);`.
Imm,
@@ -4112,7 +4112,7 @@ pub fn has_implicit_self(&self) -> bool {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub enum IsAsync {
Async(Span),
NotAsync,
@@ -4124,7 +4124,7 @@ pub fn is_async(self) -> bool {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable)]
#[derive(Default)]
pub enum Defaultness {
Default {
@@ -4151,7 +4151,7 @@ pub fn is_default(&self) -> bool {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum FnRetTy<'hir> {
/// Return type is not specified.
///
@@ -4183,7 +4183,7 @@ pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
}
/// Represents `for<...>` binder before a closure
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum ClosureBinder {
/// Binder is not specified.
Default,
@@ -4193,13 +4193,13 @@ pub enum ClosureBinder {
For { span: Span },
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Mod<'hir> {
pub spans: ModSpans,
pub item_ids: &'hir [ItemId],
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub struct ModSpans {
/// A span from the first token past `{` to the last token until `}`.
/// For `mod foo;`, the inner span ranges from the first token
@@ -4208,12 +4208,12 @@ pub struct ModSpans {
pub inject_use_span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct EnumDef<'hir> {
pub variants: &'hir [Variant<'hir>],
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Variant<'hir> {
/// Name of the variant.
pub ident: Ident,
@@ -4229,7 +4229,7 @@ pub struct Variant<'hir> {
pub span: Span,
}
#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub enum UseKind {
/// One import, e.g., `use foo::bar` or `use foo::bar as baz`.
/// Also produced for each element of a list `use`, e.g.
@@ -4254,7 +4254,7 @@ pub enum UseKind {
/// 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
/// within the resolution map.
#[derive(Clone, Debug, Copy, HashStable_Generic)]
#[derive(Clone, Debug, Copy, HashStable)]
pub struct TraitRef<'hir> {
pub path: &'hir Path<'hir>,
// Don't hash the `ref_id`. It is tracked via the thing it is used to access.
@@ -4273,7 +4273,7 @@ pub fn trait_def_id(&self) -> Option<DefId> {
}
}
#[derive(Clone, Debug, Copy, HashStable_Generic)]
#[derive(Clone, Debug, Copy, HashStable)]
pub struct PolyTraitRef<'hir> {
/// The `'a` in `for<'a> Foo<&'a T>`.
pub bound_generic_params: &'hir [GenericParam<'hir>],
@@ -4289,7 +4289,7 @@ pub struct PolyTraitRef<'hir> {
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct FieldDef<'hir> {
pub span: Span,
pub vis_span: Span,
@@ -4310,7 +4310,7 @@ pub fn is_positional(&self) -> bool {
}
/// Fields and constructor IDs of enum variants and structs.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum VariantData<'hir> {
/// A struct variant.
///
@@ -4364,7 +4364,7 @@ pub fn ctor_def_id(&self) -> Option<LocalDefId> {
// The bodies for items are stored "out of line", in a separate
// hashmap in the `Crate`. Here we just record the hir-id of the item
// so it can fetched later.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, Hash, HashStable)]
pub struct ItemId {
pub owner_id: OwnerId,
}
@@ -4385,7 +4385,7 @@ pub fn hir_id(&self) -> HirId {
/// the compiler and the reference.
///
/// [rust lang reference]: https://doc.rust-lang.org/reference/items.html
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Item<'hir> {
pub owner_id: OwnerId,
pub kind: ItemKind<'hir>,
@@ -4478,7 +4478,7 @@ pub fn is_struct_or_union(&self) -> bool {
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[derive(Encodable, Decodable, HashStable_Generic, Default)]
#[derive(Encodable, Decodable, HashStable, Default)]
pub enum Safety {
/// This is the default variant, because the compiler messing up
/// metadata encoding and failing to encode a `Safe` flag, means
@@ -4520,7 +4520,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Debug, Encodable, Decodable, HashStable)]
#[derive(Default)]
pub enum Constness {
#[default]
@@ -4537,13 +4537,13 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct ImplRestriction<'hir> {
pub kind: RestrictionKind<'hir>,
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum RestrictionKind<'hir> {
/// The restriction does not affect the item.
Unrestricted,
@@ -4555,7 +4555,7 @@ pub enum RestrictionKind<'hir> {
/// its safety different within the type system to create a
/// "sound by default" system that needs checking this enum
/// explicitly to allow unsafe operations.
#[derive(Copy, Clone, Debug, HashStable_Generic, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, HashStable, PartialEq, Eq)]
pub enum HeaderSafety {
/// A safe function annotated with `#[target_features]`.
/// The type system treats this function as an unsafe function,
@@ -4572,7 +4572,7 @@ fn from(v: Safety) -> Self {
}
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub struct FnHeader {
pub safety: HeaderSafety,
pub constness: Constness,
@@ -4605,7 +4605,7 @@ pub fn safety(&self) -> Safety {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum ItemKind<'hir> {
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
///
@@ -4680,7 +4680,7 @@ pub enum ItemKind<'hir> {
///
/// E.g., `impl $Type { .. }` or `impl $Trait for $Type { .. }`
/// Refer to [`ImplItem`] for an associated item within an impl block.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct Impl<'hir> {
pub generics: &'hir Generics<'hir>,
pub of_trait: Option<&'hir TraitImplHeader<'hir>>,
@@ -4689,7 +4689,7 @@ pub struct Impl<'hir> {
pub constness: Constness,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct TraitImplHeader<'hir> {
pub safety: Safety,
pub polarity: ImplPolarity,
@@ -4763,7 +4763,7 @@ pub fn recovered(&self) -> bool {
// The bodies for items are stored "out of line", in a separate
// hashmap in the `Crate`. Here we just record the hir-id of the item
// so it can fetched later.
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug, HashStable)]
pub struct ForeignItemId {
pub owner_id: OwnerId,
}
@@ -4776,7 +4776,7 @@ pub fn hir_id(&self) -> HirId {
}
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct ForeignItem<'hir> {
pub ident: Ident,
pub kind: ForeignItemKind<'hir>,
@@ -4799,7 +4799,7 @@ pub fn foreign_item_id(&self) -> ForeignItemId {
}
/// An item within an `extern` block.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub enum ForeignItemKind<'hir> {
/// A foreign function.
///
@@ -4815,7 +4815,7 @@ pub enum ForeignItemKind<'hir> {
}
/// A variable captured by a closure.
#[derive(Debug, Copy, Clone, HashStable_Generic)]
#[derive(Debug, Copy, Clone, HashStable)]
pub struct Upvar {
/// First span where it is accessed (there can be multiple).
pub span: Span,
@@ -4824,7 +4824,7 @@ pub struct Upvar {
// 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
// import/use statement in the scope where the trait is used.
#[derive(Debug, Clone, Copy, HashStable_Generic)]
#[derive(Debug, Clone, Copy, HashStable)]
pub struct TraitCandidate<'hir> {
pub def_id: DefId,
pub import_ids: &'hir [LocalDefId],
@@ -4835,7 +4835,7 @@ pub struct TraitCandidate<'hir> {
pub lint_ambiguous: bool,
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum OwnerNode<'hir> {
Item(&'hir Item<'hir>),
ForeignItem(&'hir ForeignItem<'hir>),
@@ -4969,7 +4969,7 @@ fn from(val: OwnerNode<'hir>) -> Self {
}
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum Node<'hir> {
Param(&'hir Param<'hir>),
Item(&'hir Item<'hir>),
+2 -2
View File
@@ -9,7 +9,7 @@
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::{HashStable, HashStableContext, StableHasher};
use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic, PrintAttribute};
use rustc_macros::{BlobDecodable, Encodable, HashStable, PrintAttribute};
use rustc_span::{Symbol, kw, sym};
use crate::attrs::PrintAttribute;
@@ -18,7 +18,7 @@
/// All of the lang items, defined or not.
/// Defined lang items can come from the current crate or its dependencies.
#[derive(HashStable_Generic, Debug)]
#[derive(HashStable, Debug)]
pub struct LanguageItems {
/// Mappings from lang items to their possibly found [`DefId`]s.
/// The index corresponds to the order in [`LangItem`].
+2 -2
View File
@@ -2,11 +2,11 @@
use std::ops::{Div, Mul};
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
/// New-type wrapper around `usize` for representing limits. Ensures that comparisons against
/// limits are consistent throughout the compiler.
#[derive(Clone, Copy, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Copy, Debug, HashStable, Encodable, Decodable)]
pub struct Limit(pub usize);
impl Limit {
+8 -8
View File
@@ -1,6 +1,6 @@
use std::num::NonZero;
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic, PrintAttribute};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable, PrintAttribute};
use rustc_span::{ErrorGuaranteed, Symbol, sym};
use crate::RustcVersion;
@@ -22,7 +22,7 @@
/// - `#[stable]`
/// - `#[unstable]`
#[derive(Encodable, BlobDecodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub struct Stability {
pub level: StabilityLevel,
pub feature: Symbol,
@@ -44,7 +44,7 @@ pub fn stable_since(&self) -> Option<StableSince> {
/// Represents the `#[rustc_const_unstable]` and `#[rustc_const_stable]` attributes.
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub struct ConstStability {
pub level: StabilityLevel,
pub feature: Symbol,
@@ -84,7 +84,7 @@ pub fn is_const_stable(&self) -> bool {
/// Excludes `const_stable_indirect`. This is necessary because when `-Zforce-unstable-if-unmarked`
/// is set, we need to encode standalone `#[rustc_const_stable_indirect]` attributes
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub struct PartialConstStability {
pub level: StabilityLevel,
pub feature: Symbol,
@@ -104,7 +104,7 @@ pub fn is_const_stable(&self) -> bool {
/// The available stability levels.
#[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum StabilityLevel {
/// `#[unstable]`
Unstable {
@@ -146,7 +146,7 @@ pub enum StabilityLevel {
/// Rust release in which a feature is stabilized.
#[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, PartialOrd, Ord, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum StableSince {
/// also stores the original symbol for printing
Version(RustcVersion),
@@ -172,7 +172,7 @@ pub fn stable_since(&self) -> Option<StableSince> {
}
#[derive(Encodable, BlobDecodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub enum UnstableReason {
None,
Default,
@@ -181,7 +181,7 @@ pub enum UnstableReason {
/// Represents the `#[rustc_default_body_unstable]` attribute.
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic, PrintAttribute)]
#[derive(HashStable, PrintAttribute)]
pub struct DefaultBodyStability {
pub level: StabilityLevel,
pub feature: Symbol,
+4 -4
View File
@@ -4,19 +4,19 @@
use rustc_ast::visit::AssocCtxt;
use rustc_ast::{AssocItemKind, ForeignItemKind, ast};
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use crate::def::DefKind;
use crate::{Item, ItemKind, TraitItem, TraitItemKind, hir};
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)]
pub enum GenericParamKind {
Type,
Lifetime,
Const,
}
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)]
pub enum MethodKind {
/// Method in a `trait Trait` block
Trait {
@@ -29,7 +29,7 @@ pub enum MethodKind {
Inherent,
}
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Debug, Eq, HashStable)]
pub enum Target {
ExternCrate,
Use,
+2 -2
View File
@@ -9,7 +9,7 @@
use rustc_data_structures::stable_hasher::{
HashStable, HashStableContext, StableHasher, StableOrd, ToStableHashKey,
};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::def_id::{CRATE_DEF_ID, DefId, DefIndex, DefPathHash, LocalDefId};
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
@@ -81,7 +81,7 @@ fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> DefPathHa
/// the `local_id` part of the `HirId` changing, which is a very useful property in
/// incremental compilation where we have to persist things through changes to
/// the code base.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
#[rustc_pass_by_value]
pub struct HirId {
pub owner: OwnerId,
+1 -2
View File
@@ -25,8 +25,7 @@
/// The impls provided by default are Clone, Copy, PartialEq, Eq, and Hash.
///
/// Accepted attributes for customization:
/// - `#[derive(HashStable_Generic)]`/`#[derive(HashStable)]`: derives
/// `HashStable`, as normal.
/// - `#[derive(HashStable)]`: derives `HashStable`, as normal.
/// - `#[encodable]`: derives `Encodable`/`Decodable`.
/// - `#[orderable]`: derives `PartialOrd`/`Ord`, plus step-related methods.
/// - `#[debug_format = "Foo({})"]`: derives `Debug` with particular output.
+2 -12
View File
@@ -9,7 +9,7 @@
};
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_hir_id::{HirId, ItemLocalId};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::def_id::DefPathHash;
pub use rustc_span::edition::Edition;
use rustc_span::{Ident, Symbol, sym};
@@ -177,17 +177,7 @@ fn to_stable_hash_key<Hcx: HashStableContext>(&self, hcx: &mut Hcx) -> Self::Key
///
/// See: <https://doc.rust-lang.org/rustc/lints/levels.html>
#[derive(
Clone,
Copy,
PartialEq,
PartialOrd,
Eq,
Ord,
Debug,
Hash,
Encodable,
Decodable,
HashStable_Generic
Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash, Encodable, Decodable, HashStable
)]
pub enum Level {
/// The `allow` level will not issue any message.
-4
View File
@@ -61,10 +61,6 @@ pub fn extension(attr: TokenStream, input: TokenStream) -> TokenStream {
decl_derive!(
[HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive
);
decl_derive!(
// FIXME: synonym of `HashStable`, will be removed shortly
[HashStable_Generic, attributes(stable_hasher)] => hash_stable::hash_stable_derive
);
decl_derive!(
[HashStable_NoContext, attributes(stable_hasher)] => hash_stable::hash_stable_no_context_derive
);
+8 -8
View File
@@ -19,7 +19,7 @@
use rustc_errors::{ColorConfig, DiagCtxtFlags};
use rustc_feature::UnstableFeatures;
use rustc_hashes::Hash64;
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable};
use rustc_span::edition::{DEFAULT_EDITION, EDITION_NAME_LIST, Edition, LATEST_STABLE_EDITION};
use rustc_span::source_map::FilePathMapping;
use rustc_span::{
@@ -88,7 +88,7 @@ pub enum CFProtection {
Full,
}
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable, Encodable, Decodable)]
pub enum OptLevel {
/// `-Copt-level=0`
No,
@@ -543,7 +543,7 @@ pub fn enabled(&self) -> bool {
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable_Generic)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
#[derive(Encodable, BlobDecodable)]
pub enum SymbolManglingVersion {
Legacy,
@@ -619,7 +619,7 @@ macro_rules! define_output_types {
}
),* $(,)?
) => {
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord, HashStable)]
#[derive(Encodable, Decodable)]
pub enum OutputType {
$(
@@ -840,7 +840,7 @@ pub enum ResolveDocLinks {
/// *Do not* switch `BTreeMap` out for an unsorted container type! That would break
/// dependency tracking for command-line arguments. Also only hash keys, since tracking
/// should only depend on the output types, not the paths they're written to.
#[derive(Clone, Debug, Hash, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Debug, Hash, HashStable, Encodable, Decodable)]
pub struct OutputTypes(BTreeMap<OutputType, Option<OutFileName>>);
impl OutputTypes {
@@ -1054,7 +1054,7 @@ pub fn opt_path(&self) -> Option<&Path> {
}
}
#[derive(Clone, Hash, Debug, HashStable_Generic, PartialEq, Eq, Encodable, Decodable)]
#[derive(Clone, Hash, Debug, HashStable, PartialEq, Eq, Encodable, Decodable)]
pub enum OutFileName {
Real(PathBuf),
Stdout,
@@ -1129,7 +1129,7 @@ pub fn overwrite(&self, content: &str, sess: &Session) {
}
}
#[derive(Clone, Hash, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(Clone, Hash, Debug, HashStable, Encodable, Decodable)]
pub struct OutputFilenames {
pub(crate) out_directory: PathBuf,
/// Crate name. Never contains '-'.
@@ -1523,7 +1523,7 @@ pub fn checksum_hash_algorithm(&self) -> Option<SourceFileHashAlgorithm> {
}
// The type of entry function, so users can have their own entry functions
#[derive(Copy, Clone, PartialEq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Hash, Debug, HashStable)]
pub enum EntryFnType {
Main {
/// Specifies what to do with `SIGPIPE` before calling `fn main()`.
+11 -11
View File
@@ -12,14 +12,14 @@
CrateNum, DefId, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap,
};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable};
use rustc_span::{Span, Symbol};
// lonely orphan structs and enums looking for a better home
/// Where a crate came from on the local filesystem. One of these three options
/// must be non-None.
#[derive(PartialEq, Clone, Debug, HashStable_Generic, Encodable, Decodable)]
#[derive(PartialEq, Clone, Debug, HashStable, Encodable, Decodable)]
pub struct CrateSource {
pub dylib: Option<PathBuf>,
pub rlib: Option<PathBuf>,
@@ -35,7 +35,7 @@ pub fn paths(&self) -> impl Iterator<Item = &PathBuf> {
}
#[derive(Encodable, BlobDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum CrateDepKind {
/// A dependency that is only used for its macros.
MacrosOnly,
@@ -58,13 +58,13 @@ pub fn macros_only(self) -> bool {
}
}
#[derive(Copy, Debug, PartialEq, Clone, Encodable, BlobDecodable, HashStable_Generic)]
#[derive(Copy, Debug, PartialEq, Clone, Encodable, BlobDecodable, HashStable)]
pub enum LinkagePreference {
RequireDynamic,
RequireStatic,
}
#[derive(Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Debug, Encodable, Decodable, HashStable)]
pub struct NativeLib {
pub kind: NativeLibKind,
pub name: Symbol,
@@ -86,7 +86,7 @@ pub fn wasm_import_module(&self) -> Option<Symbol> {
}
}
#[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
pub struct DllImport {
pub name: Symbol,
pub import_name_type: Option<PeImportNameType>,
@@ -101,7 +101,7 @@ pub struct DllImport {
pub size: rustc_abi::Size,
}
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable_Generic, PartialEq)]
#[derive(Copy, Clone, Debug, Encodable, Decodable, HashStable, PartialEq)]
pub enum DllImportSymbolType {
Function,
Static,
@@ -127,7 +127,7 @@ pub fn is_missing_decorations(&self) -> bool {
///
/// The usize value, where present, indicates the size of the function's argument list
/// in bytes.
#[derive(Clone, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, PartialEq, Debug, Encodable, Decodable, HashStable)]
pub enum DllCallingConvention {
C,
Stdcall(usize),
@@ -135,14 +135,14 @@ pub enum DllCallingConvention {
Vectorcall(usize),
}
#[derive(Clone, Encodable, Decodable, HashStable_Generic, Debug)]
#[derive(Clone, Encodable, Decodable, HashStable, Debug)]
pub struct ForeignModule {
pub foreign_items: Vec<DefId>,
pub def_id: DefId,
pub abi: ExternAbi,
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub struct ExternCrate {
pub src: ExternCrateSource,
@@ -175,7 +175,7 @@ pub fn rank(&self) -> impl PartialOrd {
}
}
#[derive(Copy, Clone, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Debug, HashStable)]
pub enum ExternCrateSource {
/// Crate is loaded by `extern crate`.
Extern(
+2 -2
View File
@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};
use std::sync::Arc;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_target::spec::TargetTuple;
use crate::EarlyDiagCtxt;
@@ -71,7 +71,7 @@ pub fn path(&self, dir: &Path) -> PathBuf {
}
}
#[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable, HashStable_Generic)]
#[derive(PartialEq, Clone, Copy, Debug, Hash, Eq, Encodable, Decodable, HashStable)]
pub enum PathKind {
Native,
Crate,
+2 -2
View File
@@ -24,7 +24,7 @@
};
use rustc_feature::UnstableFeatures;
use rustc_hir::limit::Limit;
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
pub use rustc_span::def_id::StableCrateId;
use rustc_span::edition::Edition;
use rustc_span::source_map::{FilePathMapping, SourceMap};
@@ -61,7 +61,7 @@ pub enum CtfeBacktrace {
Immediate,
}
#[derive(Clone, Copy, Debug, HashStable_Generic)]
#[derive(Clone, Copy, Debug, HashStable)]
pub struct Limits {
/// The maximum recursion limit for potentially infinitely recursive
/// operations such as auto-dereference and monomorphization.
+2 -2
View File
@@ -4,7 +4,7 @@
use rustc_data_structures::profiling::VerboseTimingGuard;
use rustc_fs_util::try_canonicalize;
use rustc_hir::attrs::NativeLibKind;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use crate::session::Session;
@@ -19,7 +19,7 @@ pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R {
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub struct NativeLib {
pub name: String,
pub new_name: Option<String>,
+5 -5
View File
@@ -10,7 +10,7 @@
use rustc_data_structures::unhash::Unhasher;
use rustc_hashes::Hash64;
use rustc_index::Idx;
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable};
use rustc_serialize::{Decodable, Encodable};
use crate::{SpanDecoder, SpanEncoder, Symbol};
@@ -94,7 +94,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// collision occurring. For a big crate graph with 1000 crates in it, there is
/// a probability of 1 in 36,890,000,000,000 of a `StableCrateId` collision.
#[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub struct DefPathHash(pub Fingerprint);
impl DefPathHash {
@@ -154,7 +154,7 @@ impl StableOrd for DefPathHash {
/// For more information on the possibility of hash collisions in rustc,
/// see the discussion in [`DefId`].
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
#[derive(Hash, HashStable_Generic, Encodable, BlobDecodable)]
#[derive(Hash, HashStable, Encodable, BlobDecodable)]
pub struct StableCrateId(pub(crate) Hash64);
impl StableCrateId {
@@ -486,7 +486,7 @@ fn to_stable_hash_key<Hcx>(&self, _: &mut Hcx) -> DefPathHash {
macro_rules! typed_def_id {
($Name:ident, $LocalName:ident) => {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub struct $Name(DefId);
impl $Name {
@@ -525,7 +525,7 @@ fn from(typed: $Name) -> Self {
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub struct $LocalName(LocalDefId);
impl !Ord for $LocalName {}
+2 -2
View File
@@ -1,11 +1,11 @@
use std::fmt;
use std::str::FromStr;
use rustc_macros::{BlobDecodable, Encodable, HashStable_Generic};
use rustc_macros::{BlobDecodable, Encodable, HashStable};
/// The edition of the compiler. (See [RFC 2052](https://github.com/rust-lang/rfcs/blob/master/text/2052-epochs.md).)
#[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, Encodable, BlobDecodable, Eq)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum Edition {
// When adding new editions, be sure to do the following:
//
+8 -8
View File
@@ -37,7 +37,7 @@
use rustc_data_structures::unhash::UnhashMap;
use rustc_hashes::Hash64;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use tracing::{debug, trace};
@@ -129,7 +129,7 @@ impl !Ord for LocalExpnId {}
impl !PartialOrd for LocalExpnId {}
/// A unique hash value associated to an expansion.
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Encodable, Decodable, HashStable)]
pub struct ExpnHash(Fingerprint);
impl ExpnHash {
@@ -163,7 +163,7 @@ fn new(stable_crate_id: StableCrateId, local_hash: Hash64) -> ExpnHash {
/// A property of a macro expansion that determines how identifiers
/// produced by that expansion are resolved.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug, Encodable, Decodable)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum Transparency {
/// Identifier produced by a transparent expansion is always resolved at call-site.
/// Call-site spans in procedural macros, hygiene opt-out in `macro` should use this.
@@ -965,7 +965,7 @@ pub fn mark_with_reason(
/// A subset of properties from both macro definition and macro call available through global data.
/// Avoid using this if you have access to the original definition or call structures.
#[derive(Clone, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, Encodable, Decodable, HashStable)]
pub struct ExpnData {
// --- The part unique to each expansion.
pub kind: ExpnKind,
@@ -1112,7 +1112,7 @@ fn hash_expn(&self, hcx: &mut impl HashStableContext) -> Hash64 {
}
/// Expansion kind.
#[derive(Clone, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Debug, PartialEq, Encodable, Decodable, HashStable)]
pub enum ExpnKind {
/// No expansion, aka root expansion. Only `ExpnId::root()` has this kind.
Root,
@@ -1141,7 +1141,7 @@ pub fn descr(&self) -> String {
/// The kind of macro invocation or definition.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum MacroKind {
/// A bang macro `foo!()`.
Bang,
@@ -1176,7 +1176,7 @@ pub fn article(self) -> &'static str {
}
/// The kind of AST transform.
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Copy, Debug, PartialEq, Encodable, Decodable, HashStable)]
pub enum AstPass {
StdImports,
TestHarness,
@@ -1194,7 +1194,7 @@ pub fn descr(self) -> &'static str {
}
/// The kind of compiler desugaring.
#[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable)]
pub enum DesugaringKind {
QuestionMark,
TryBlock,
+9 -19
View File
@@ -33,7 +33,7 @@
use derive_where::derive_where;
use rustc_data_structures::stable_hasher::HashStableContext;
use rustc_data_structures::{AtomicRef, outline};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_serialize::opaque::{FileEncoder, MemDecoder};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use tracing::debug;
@@ -91,7 +91,7 @@
#[cfg(test)]
mod tests;
#[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, Copy, PartialEq, Hash, HashStable)]
pub struct Spanned<T> {
pub node: T,
pub span: Span,
@@ -1614,7 +1614,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
/// Identifies an offset of a multi-byte character in a `SourceFile`.
#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable)]
pub struct MultiByteChar {
/// The relative offset of the character in the `SourceFile`.
pub pos: RelativeBytePos,
@@ -1623,7 +1623,7 @@ pub struct MultiByteChar {
}
/// Identifies an offset of a character that was normalized away from `SourceFile`.
#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)]
#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable)]
pub struct NormalizedPos {
/// The relative offset of the character in the `SourceFile`.
pub pos: RelativeBytePos,
@@ -1666,7 +1666,7 @@ pub fn get_source(&self) -> Option<&str> {
pub struct OffsetOverflowError;
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Encodable, Decodable)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub enum SourceFileHashAlgorithm {
Md5,
Sha1,
@@ -1701,7 +1701,7 @@ fn from_str(s: &str) -> Result<SourceFileHashAlgorithm, ()> {
/// The hash of the on-disk source file used for debug info and cargo freshness checks.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub struct SourceFileHash {
pub kind: SourceFileHashAlgorithm,
value: [u8; 32],
@@ -2084,17 +2084,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// When `SourceFile`s are exported in crate metadata, the `StableSourceFileId`
/// is updated to incorporate the `StableCrateId` of the exporting crate.
#[derive(
Debug,
Clone,
Copy,
Hash,
PartialEq,
Eq,
HashStable_Generic,
Encodable,
Decodable,
Default,
PartialOrd,
Debug, Clone, Copy, Hash, PartialEq, Eq, HashStable, Encodable, Decodable, Default, PartialOrd,
Ord
)]
pub struct StableSourceFileId(Hash128);
@@ -2666,7 +2656,7 @@ fn sub(self, rhs: $ident) -> $ident {
pub struct BytePos(pub u32);
/// A byte offset relative to file beginning.
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, HashStable)]
pub struct RelativeBytePos(pub u32);
/// A character offset.
@@ -2810,7 +2800,7 @@ fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut Stable
/// The `()` field is necessary: it is non-`pub`, which means values of this
/// type cannot be constructed outside of this crate.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[derive(HashStable_Generic)]
#[derive(HashStable)]
pub struct ErrorGuaranteed(());
impl ErrorGuaranteed {
+2 -2
View File
@@ -11,7 +11,7 @@
HashStable, HashStableContext, StableCompare, StableHasher, ToStableHashKey,
};
use rustc_data_structures::sync::Lock;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, symbols};
use rustc_macros::{Decodable, Encodable, HashStable, symbols};
use crate::edit_distance::find_best_match_for_name;
use crate::{DUMMY_SP, Edition, Span, with_session_globals};
@@ -2308,7 +2308,7 @@
/// `proc_macro`.
pub const STDLIB_STABLE_CRATES: &[Symbol] = &[sym::std, sym::core, sym::alloc, sym::proc_macro];
#[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)]
#[derive(Copy, Clone, Eq, HashStable, Encodable, Decodable)]
pub struct Ident {
/// `name` should never be the empty symbol. If you are considering that,
/// you are probably conflating "empty identifier with "no identifier" and
+7 -7
View File
@@ -2,7 +2,7 @@
use rustc_abi::Size;
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::Symbol;
use crate::spec::{Arch, CfgAbi, RelocModel, Target};
@@ -25,7 +25,7 @@ macro_rules! def_reg_class {
$class:ident,
)*
}) => {
#[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable_Generic)]
#[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable)]
#[allow(non_camel_case_types)]
pub enum $arch_regclass {
$($class,)*
@@ -74,7 +74,7 @@ macro_rules! def_regs {
)*
}) => {
#[allow(unreachable_code)]
#[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable_Generic)]
#[derive(Copy, Clone, rustc_macros::Encodable, rustc_macros::Decodable, Debug, Eq, PartialEq, PartialOrd, Hash, rustc_macros::HashStable)]
#[allow(non_camel_case_types)]
pub enum $arch_reg {
$($reg,)*
@@ -279,7 +279,7 @@ pub fn from_arch(arch: &Arch) -> Option<Self> {
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum InlineAsmReg {
X86(X86InlineAsmReg),
Arm(ArmInlineAsmReg),
@@ -467,7 +467,7 @@ pub fn overlapping_regs(self, mut cb: impl FnMut(InlineAsmReg)) {
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum InlineAsmRegClass {
X86(X86InlineAsmRegClass),
Arm(ArmInlineAsmRegClass),
@@ -712,7 +712,7 @@ pub fn is_clobber_only(self, arch: InlineAsmArch, allow_experimental_reg: bool)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum InlineAsmRegOrRegClass {
Reg(InlineAsmReg),
RegClass(InlineAsmRegClass),
@@ -922,7 +922,7 @@ pub fn allocatable_registers(
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Hash)]
#[derive(HashStable_Generic, Encodable, Decodable)]
#[derive(HashStable, Encodable, Decodable)]
pub enum InlineAsmClobberAbi {
X86,
X86_64Win,
+11 -11
View File
@@ -4,7 +4,7 @@
AddressSpace, Align, BackendRepr, CanonAbi, ExternAbi, FieldsShape, HasDataLayout, Primitive,
Reg, RegKind, Scalar, Size, TyAbiInterface, TyAndLayout, Variants,
};
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
pub use crate::spec::AbiMap;
use crate::spec::{Arch, HasTargetSpec, HasX86AbiOpt};
@@ -35,7 +35,7 @@
mod x86_win64;
mod xtensa;
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub enum PassMode {
/// Ignore the argument.
///
@@ -106,10 +106,10 @@ pub fn eq_abi(&self, other: &Self) -> bool {
#[allow(non_upper_case_globals)]
#[allow(unused)]
mod attr_impl {
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
// The subset of llvm::Attribute needed for arguments, packed into a bitfield.
#[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable_Generic)]
#[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable)]
pub struct ArgAttribute(u16);
bitflags::bitflags! {
impl ArgAttribute: u16 {
@@ -130,7 +130,7 @@ impl ArgAttribute: u16 {
/// Sometimes an ABI requires small integers to be extended to a full or partial register. This enum
/// defines if this extension should be zero-extension or sign-extension when necessary. When it is
/// not necessary to extend the argument, this enum is ignored.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub enum ArgExtension {
None,
Zext,
@@ -139,7 +139,7 @@ pub enum ArgExtension {
/// A compact representation of LLVM attributes (at least those relevant for this module)
/// that can be manipulated without interacting with LLVM's Attribute machinery.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub struct ArgAttributes {
pub regular: ArgAttribute,
pub arg_ext: ArgExtension,
@@ -213,7 +213,7 @@ fn from(value: ArgAttribute) -> Self {
/// An argument passed entirely registers with the
/// same kind (e.g., HFA / HVA on PPC64 and AArch64).
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, HashStable)]
pub struct Uniform {
pub unit: Reg,
@@ -262,7 +262,7 @@ pub fn consecutive(unit: Reg, total: Size) -> Self {
/// `rest.unit` register type gets repeated often enough to cover `rest.size`. This describes the
/// actual type used for the call; the Rust type of the argument is then transmuted to this ABI type
/// (and all data in the padding between the registers is dropped).
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub struct CastTarget {
pub prefix: [Option<Reg>; 8],
/// The offset of `rest` from the start of the value. Currently only implemented for a `Reg`
@@ -363,7 +363,7 @@ pub fn eq_abi(&self, other: &Self) -> bool {
/// Information about how to pass an argument to,
/// or return a value from, a function, under some ABI.
#[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, HashStable)]
pub struct ArgAbi<'a, Ty> {
pub layout: TyAndLayout<'a, Ty>,
pub mode: PassMode,
@@ -564,7 +564,7 @@ pub fn eq_abi(&self, other: &Self) -> bool
}
}
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable)]
pub enum RiscvInterruptKind {
Machine,
Supervisor,
@@ -589,7 +589,7 @@ pub fn as_str(&self) -> &'static str {
///
/// I will do my best to describe this structure, but these
/// comments are reverse-engineered and may be inaccurate. -NDM
#[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)]
#[derive(Clone, PartialEq, Eq, Hash, HashStable)]
pub struct FnAbi<'a, Ty> {
/// The type, layout, and information about how each argument is passed.
pub args: Box<[ArgAbi<'a, Ty>]>,
+5 -5
View File
@@ -52,7 +52,7 @@
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
use rustc_error_messages::{DiagArgValue, IntoDiagArg, into_diag_arg_using_display};
use rustc_fs_util::try_canonicalize;
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable_Generic};
use rustc_macros::{BlobDecodable, Decodable, Encodable, HashStable};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
use rustc_span::{Symbol, kw, sym};
use serde_json::Value;
@@ -830,7 +830,7 @@ pub fn is_cc_enabled(self) -> bool {
}
crate::target_spec_enum! {
#[derive(Encodable, BlobDecodable, HashStable_Generic)]
#[derive(Encodable, BlobDecodable, HashStable)]
pub enum PanicStrategy {
Unwind = "unwind",
Abort = "abort",
@@ -840,7 +840,7 @@ pub enum PanicStrategy {
parse_error_type = "panic strategy";
}
#[derive(Clone, Copy, Debug, PartialEq, Hash, Encodable, BlobDecodable, HashStable_Generic)]
#[derive(Clone, Copy, Debug, PartialEq, Hash, Encodable, BlobDecodable, HashStable)]
pub enum OnBrokenPipe {
Default,
Kill,
@@ -1161,7 +1161,7 @@ fn to_json(&self) -> Json {
}
}
#[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
#[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable)]
pub struct SanitizerSet(u16);
bitflags::bitflags! {
impl SanitizerSet: u16 {
@@ -1347,7 +1347,7 @@ pub fn ratchet(&mut self, rhs: FramePointer) -> FramePointer {
crate::target_spec_enum! {
/// Controls use of stack canaries.
#[derive(Encodable, BlobDecodable, HashStable_Generic)]
#[derive(Encodable, BlobDecodable, HashStable)]
pub enum StackProtector {
/// Disable stack canary generation.
None = "none",
+2 -2
View File
@@ -2,7 +2,7 @@
//! Note that these are similar to but not always identical to LLVM's feature names,
//! and Rust adds some features that do not correspond to LLVM features at all.
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_macros::HashStable_Generic;
use rustc_macros::HashStable;
use rustc_span::{Symbol, sym};
use crate::spec::{Arch, FloatAbi, LlvmAbi, RustcAbi, Target};
@@ -12,7 +12,7 @@
pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"];
/// Stability information for target features.
#[derive(Debug, Copy, Clone, HashStable_Generic)]
#[derive(Debug, Copy, Clone, HashStable)]
pub enum Stability {
/// This target feature is stable, it can be used in `#[target_feature]` and
/// `#[cfg(target_feature)]`.