Update to bitflags 2 in the compiler
This involves lots of breaking changes. There are two big changes that force changes. The first is that the bitflag types now don't automatically implement normal derive traits, so we need to derive them manually. Additionally, bitflags now have a hidden inner type by default, which breaks our custom derives. The bitflags docs recommend using the impl form in these cases, which I did.
This commit is contained in:
parent
d59f06fc64
commit
ffafcd8819
32
Cargo.lock
32
Cargo.lock
@ -285,9 +285,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
@ -3370,7 +3370,7 @@ dependencies = [
|
||||
name = "rustc_abi"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"rand",
|
||||
"rand_xoshiro",
|
||||
"rustc_data_structures",
|
||||
@ -3401,7 +3401,7 @@ dependencies = [
|
||||
name = "rustc_ast"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"memchr",
|
||||
"rustc_data_structures",
|
||||
"rustc_index",
|
||||
@ -3552,7 +3552,7 @@ dependencies = [
|
||||
name = "rustc_codegen_llvm"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"itertools",
|
||||
"libc",
|
||||
"measureme",
|
||||
@ -3587,7 +3587,7 @@ name = "rustc_codegen_ssa"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"ar_archive_writer",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"cc",
|
||||
"itertools",
|
||||
"jobserver",
|
||||
@ -3654,7 +3654,7 @@ name = "rustc_data_structures"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"elsa",
|
||||
"ena",
|
||||
"indexmap",
|
||||
@ -4121,7 +4121,7 @@ dependencies = [
|
||||
name = "rustc_metadata"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"libloading 0.7.4",
|
||||
"odht",
|
||||
"rustc_ast",
|
||||
@ -4151,7 +4151,7 @@ dependencies = [
|
||||
name = "rustc_middle"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"derive_more",
|
||||
"either",
|
||||
"field-offset",
|
||||
@ -4286,7 +4286,7 @@ dependencies = [
|
||||
name = "rustc_parse"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"rustc_ast",
|
||||
"rustc_ast_pretty",
|
||||
"rustc_data_structures",
|
||||
@ -4424,7 +4424,7 @@ dependencies = [
|
||||
name = "rustc_resolve"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"pulldown-cmark",
|
||||
"rustc_arena",
|
||||
"rustc_ast",
|
||||
@ -4463,7 +4463,7 @@ dependencies = [
|
||||
name = "rustc_session"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"getopts",
|
||||
"libc",
|
||||
"rustc_ast",
|
||||
@ -4521,7 +4521,7 @@ dependencies = [
|
||||
name = "rustc_symbol_mangling"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"punycode",
|
||||
"rustc-demangle",
|
||||
"rustc_data_structures",
|
||||
@ -4539,7 +4539,7 @@ dependencies = [
|
||||
name = "rustc_target"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"object",
|
||||
"rustc_abi",
|
||||
"rustc_data_structures",
|
||||
@ -4638,7 +4638,7 @@ dependencies = [
|
||||
name = "rustc_type_ir"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.4.1",
|
||||
"derivative",
|
||||
"rustc_data_structures",
|
||||
"rustc_index",
|
||||
@ -4768,7 +4768,7 @@ version = "0.38.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed"
|
||||
dependencies = [
|
||||
"bitflags 2.4.0",
|
||||
"bitflags 2.4.1",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
rand = { version = "0.8.4", default-features = false, optional = true }
|
||||
rand_xoshiro = { version = "0.6.0", optional = true }
|
||||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||
|
@ -29,10 +29,12 @@
|
||||
/// instead of implementing everything in `rustc_middle`.
|
||||
pub trait HashStableContext {}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
|
||||
pub struct ReprFlags: u8 {
|
||||
pub struct ReprFlags(u8);
|
||||
|
||||
bitflags! {
|
||||
impl ReprFlags: u8 {
|
||||
const IS_C = 1 << 0;
|
||||
const IS_SIMD = 1 << 1;
|
||||
const IS_TRANSPARENT = 1 << 2;
|
||||
@ -42,11 +44,12 @@ pub struct ReprFlags: u8 {
|
||||
// the seed stored in `ReprOptions.layout_seed`
|
||||
const RANDOMIZE_LAYOUT = 1 << 4;
|
||||
// Any of these flags being set prevent field reordering optimisation.
|
||||
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits
|
||||
| ReprFlags::IS_SIMD.bits
|
||||
| ReprFlags::IS_LINEAR.bits;
|
||||
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits()
|
||||
| ReprFlags::IS_SIMD.bits()
|
||||
| ReprFlags::IS_LINEAR.bits();
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { ReprFlags }
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
memchr = "2.5.0"
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_index = { path = "../rustc_index" }
|
||||
|
@ -2171,9 +2171,10 @@ pub enum InlineAsmRegOrRegClass {
|
||||
RegClass(Symbol),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
|
||||
pub struct InlineAsmOptions(u16);
|
||||
bitflags::bitflags! {
|
||||
#[derive(Encodable, Decodable, HashStable_Generic)]
|
||||
pub struct InlineAsmOptions: u16 {
|
||||
impl InlineAsmOptions: u16 {
|
||||
const PURE = 1 << 0;
|
||||
const NOMEM = 1 << 1;
|
||||
const READONLY = 1 << 2;
|
||||
@ -2186,6 +2187,12 @@ pub struct InlineAsmOptions: u16 {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for InlineAsmOptions {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
bitflags::parser::to_writer(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Encodable, Decodable, Debug, Hash, HashStable_Generic)]
|
||||
pub enum InlineAsmTemplatePiece {
|
||||
String(String),
|
||||
|
@ -8,7 +8,7 @@ test = false
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.0"
|
||||
bitflags = "2.4.1"
|
||||
itertools = "0.11"
|
||||
libc = "0.2"
|
||||
measureme = "10.0.0"
|
||||
|
@ -722,7 +722,7 @@ pub mod debuginfo {
|
||||
// These values **must** match with LLVMRustDIFlags!!
|
||||
bitflags! {
|
||||
#[repr(transparent)]
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
pub struct DIFlags: u32 {
|
||||
const FlagZero = 0;
|
||||
const FlagPrivate = 1;
|
||||
@ -751,7 +751,7 @@ pub struct DIFlags: u32 {
|
||||
// These values **must** match with LLVMRustDISPFlags!!
|
||||
bitflags! {
|
||||
#[repr(transparent)]
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Copy, Default)]
|
||||
pub struct DISPFlags: u32 {
|
||||
const SPFlagZero = 0;
|
||||
const SPFlagVirtual = 1;
|
||||
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
ar_archive_writer = "0.1.5"
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
cc = "1.0.69"
|
||||
itertools = "0.11"
|
||||
jobserver = "0.1.27"
|
||||
|
@ -110,6 +110,7 @@ pub enum ModuleKind {
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct MemFlags: u8 {
|
||||
const VOLATILE = 1 << 0;
|
||||
const NONTEMPORAL = 1 << 1;
|
||||
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
arrayvec = { version = "0.7", default-features = false }
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
elsa = "=1.7.1"
|
||||
ena = "0.14.2"
|
||||
indexmap = { version = "2.0.0" }
|
||||
|
@ -150,3 +150,14 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
// See comments in src/librustc_middle/lib.rs
|
||||
#[doc(hidden)]
|
||||
pub fn __noop_fix_for_27438() {}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! external_bitflags_debug {
|
||||
($Name:ident) => {
|
||||
impl ::std::fmt::Debug for $Name {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||
::bitflags::parser::to_writer(self, f)
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -101,6 +101,7 @@
|
||||
use smallvec::SmallVec;
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy)]
|
||||
struct EventFilter: u16 {
|
||||
const GENERIC_ACTIVITIES = 1 << 0;
|
||||
const QUERY_PROVIDERS = 1 << 1;
|
||||
@ -114,14 +115,14 @@ struct EventFilter: u16 {
|
||||
const INCR_RESULT_HASHING = 1 << 8;
|
||||
const ARTIFACT_SIZES = 1 << 9;
|
||||
|
||||
const DEFAULT = Self::GENERIC_ACTIVITIES.bits |
|
||||
Self::QUERY_PROVIDERS.bits |
|
||||
Self::QUERY_BLOCKED.bits |
|
||||
Self::INCR_CACHE_LOADS.bits |
|
||||
Self::INCR_RESULT_HASHING.bits |
|
||||
Self::ARTIFACT_SIZES.bits;
|
||||
const DEFAULT = Self::GENERIC_ACTIVITIES.bits() |
|
||||
Self::QUERY_PROVIDERS.bits() |
|
||||
Self::QUERY_BLOCKED.bits() |
|
||||
Self::INCR_CACHE_LOADS.bits() |
|
||||
Self::INCR_RESULT_HASHING.bits() |
|
||||
Self::ARTIFACT_SIZES.bits();
|
||||
|
||||
const ARGS = Self::QUERY_KEYS.bits | Self::FUNCTION_ARGS.bits;
|
||||
const ARGS = Self::QUERY_KEYS.bits() | Self::FUNCTION_ARGS.bits();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
libloading = "0.7.1"
|
||||
odht = { version = "0.3.1", features = ["nightly"] }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
derive_more = "0.99.17"
|
||||
either = "1.5.0"
|
||||
field-offset = "0.3.5"
|
||||
|
@ -45,9 +45,10 @@ pub struct CodegenFnAttrs {
|
||||
pub alignment: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, TyEncodable, TyDecodable, HashStable)]
|
||||
pub struct CodegenFnAttrFlags(u32);
|
||||
bitflags! {
|
||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
||||
pub struct CodegenFnAttrFlags: u32 {
|
||||
impl CodegenFnAttrFlags: u32 {
|
||||
/// `#[cold]`: a hint to LLVM that this function, when called, is never on
|
||||
/// the hot path.
|
||||
const COLD = 1 << 0;
|
||||
@ -104,6 +105,7 @@ pub struct CodegenFnAttrFlags: u32 {
|
||||
const NO_BUILTINS = 1 << 20;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { CodegenFnAttrFlags }
|
||||
|
||||
impl CodegenFnAttrs {
|
||||
pub const EMPTY: &'static Self = &Self::new();
|
||||
|
@ -24,9 +24,10 @@
|
||||
|
||||
use super::{Destructor, FieldDef, GenericPredicates, Ty, TyCtxt, VariantDef, VariantDiscr};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct AdtFlags(u16);
|
||||
bitflags! {
|
||||
#[derive(HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct AdtFlags: u16 {
|
||||
impl AdtFlags: u16 {
|
||||
const NO_ADT_FLAGS = 0;
|
||||
/// Indicates whether the ADT is an enum.
|
||||
const IS_ENUM = 1 << 0;
|
||||
@ -51,6 +52,7 @@ pub struct AdtFlags: u16 {
|
||||
const IS_UNSAFE_CELL = 1 << 9;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { AdtFlags }
|
||||
|
||||
/// The definition of a user-defined type, e.g., a `struct`, `enum`, or `union`.
|
||||
///
|
||||
|
@ -1771,9 +1771,10 @@ pub struct Destructor {
|
||||
pub constness: hir::Constness,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct VariantFlags(u8);
|
||||
bitflags! {
|
||||
#[derive(HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct VariantFlags: u8 {
|
||||
impl VariantFlags: u8 {
|
||||
const NO_VARIANT_FLAGS = 0;
|
||||
/// Indicates whether the field list of this variant is `#[non_exhaustive]`.
|
||||
const IS_FIELD_LIST_NON_EXHAUSTIVE = 1 << 0;
|
||||
@ -1782,6 +1783,7 @@ pub struct VariantFlags: u8 {
|
||||
const IS_RECOVERED = 1 << 1;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { VariantFlags }
|
||||
|
||||
/// Definition of a variant -- a struct's fields or an enum variant.
|
||||
#[derive(Debug, HashStable, TyEncodable, TyDecodable)]
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.0"
|
||||
bitflags = "2.4.1"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -46,6 +46,7 @@
|
||||
};
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy)]
|
||||
struct Restrictions: u8 {
|
||||
const STMT_EXPR = 1 << 0;
|
||||
const NO_STRUCT_LITERAL = 1 << 1;
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
pulldown-cmark = { version = "0.9.3", default-features = false }
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
|
@ -377,6 +377,7 @@ pub(crate) fn early_resolve_ident_in_lexical_scope(
|
||||
ignore_binding: Option<NameBinding<'a>>,
|
||||
) -> Result<NameBinding<'a>, Determinacy> {
|
||||
bitflags::bitflags! {
|
||||
#[derive(Clone, Copy)]
|
||||
struct Flags: u8 {
|
||||
const MACRO_RULES = 1 << 0;
|
||||
const MODULE = 1 << 1;
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
getopts = "0.2"
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -1021,6 +1021,7 @@ pub fn split_dwarf_path(
|
||||
|
||||
bitflags::bitflags! {
|
||||
/// Scopes used to determined if it need to apply to --remap-path-prefix
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct RemapPathScopeComponents: u8 {
|
||||
/// Apply remappings to the expansion of std::file!() macro
|
||||
const MACRO = 1 << 0;
|
||||
@ -1041,7 +1042,7 @@ pub struct RemapPathScopeComponents: u8 {
|
||||
/// An alias for macro,unsplit-debuginfo,split-debuginfo-path. This
|
||||
/// ensures all paths in compiled executables or libraries are remapped
|
||||
/// but not elsewhere.
|
||||
const OBJECT = Self::MACRO.bits | Self::UNSPLIT_DEBUGINFO.bits | Self::SPLIT_DEBUGINFO_PATH.bits;
|
||||
const OBJECT = Self::MACRO.bits() | Self::UNSPLIT_DEBUGINFO.bits() | Self::SPLIT_DEBUGINFO_PATH.bits();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
punycode = "0.4.0"
|
||||
rustc-demangle = "0.1.21"
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
bitflags! {
|
||||
/// Options for typeid_for_fnabi and typeid_for_fnsig.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct TypeIdOptions: u32 {
|
||||
const GENERALIZE_POINTERS = 1;
|
||||
const GENERALIZE_REPR_C = 2;
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_feature = { path = "../rustc_feature" }
|
||||
|
@ -93,9 +93,10 @@ pub fn eq_abi(&self, other: &Self) -> bool {
|
||||
#[allow(unused)]
|
||||
mod attr_impl {
|
||||
// The subset of llvm::Attribute needed for arguments, packed into a bitfield.
|
||||
#[derive(Clone, Copy, Default, Hash, PartialEq, Eq, HashStable_Generic)]
|
||||
pub struct ArgAttribute(u8);
|
||||
bitflags::bitflags! {
|
||||
#[derive(Default, HashStable_Generic)]
|
||||
pub struct ArgAttribute: u8 {
|
||||
impl ArgAttribute: u8 {
|
||||
const NoAlias = 1 << 1;
|
||||
const NoCapture = 1 << 2;
|
||||
const NonNull = 1 << 3;
|
||||
@ -104,6 +105,7 @@ pub struct ArgAttribute: u8 {
|
||||
const NoUndef = 1 << 6;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { ArgAttribute }
|
||||
}
|
||||
|
||||
/// Sometimes an ABI requires small integers to be extended to a full or partial register. This enum
|
||||
|
@ -39,7 +39,6 @@
|
||||
use crate::json::{Json, ToJson};
|
||||
use crate::spec::abi::{lookup as lookup_abi, Abi};
|
||||
use crate::spec::crt_objects::CrtObjects;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_fs_util::try_canonicalize;
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
@ -592,7 +591,7 @@ fn json_key(self) -> &'static str {
|
||||
}
|
||||
|
||||
bitflags::bitflags! {
|
||||
#[derive(Default)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Default)]
|
||||
/// The `-C link-self-contained` components that can individually be enabled or disabled.
|
||||
pub struct LinkSelfContainedComponents: u8 {
|
||||
/// CRT objects (e.g. on `windows-gnu`, `musl`, `wasi` targets)
|
||||
@ -609,6 +608,7 @@ pub struct LinkSelfContainedComponents: u8 {
|
||||
const MINGW = 1 << 5;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { LinkSelfContainedComponents }
|
||||
|
||||
impl LinkSelfContainedComponents {
|
||||
/// Parses a single `-Clink-self-contained` well-known component, not a set of flags.
|
||||
@ -667,19 +667,6 @@ pub fn is_crt_objects_enabled(self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for LinkSelfContainedComponents {
|
||||
type Item = LinkSelfContainedComponents;
|
||||
type IntoIter = std::vec::IntoIter<LinkSelfContainedComponents>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
LinkSelfContainedComponents::all_components()
|
||||
.into_iter()
|
||||
.filter(|&s| self.contains(s))
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for LinkSelfContainedComponents {
|
||||
fn to_json(&self) -> Json {
|
||||
let components: Vec<_> = Self::all_components()
|
||||
@ -1219,9 +1206,10 @@ fn to_json(&self) -> Json {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, HashStable_Generic)]
|
||||
pub struct SanitizerSet(u16);
|
||||
bitflags::bitflags! {
|
||||
#[derive(Default, Encodable, Decodable)]
|
||||
pub struct SanitizerSet: u16 {
|
||||
impl SanitizerSet: u16 {
|
||||
const ADDRESS = 1 << 0;
|
||||
const LEAK = 1 << 1;
|
||||
const MEMORY = 1 << 2;
|
||||
@ -1235,6 +1223,7 @@ pub struct SanitizerSet: u16 {
|
||||
const SAFESTACK = 1 << 10;
|
||||
}
|
||||
}
|
||||
rustc_data_structures::external_bitflags_debug! { SanitizerSet }
|
||||
|
||||
impl SanitizerSet {
|
||||
/// Return sanitizer's name
|
||||
@ -1274,38 +1263,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoIterator for SanitizerSet {
|
||||
type Item = SanitizerSet;
|
||||
type IntoIter = std::vec::IntoIter<SanitizerSet>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
[
|
||||
SanitizerSet::ADDRESS,
|
||||
SanitizerSet::CFI,
|
||||
SanitizerSet::KCFI,
|
||||
SanitizerSet::LEAK,
|
||||
SanitizerSet::MEMORY,
|
||||
SanitizerSet::MEMTAG,
|
||||
SanitizerSet::SHADOWCALLSTACK,
|
||||
SanitizerSet::THREAD,
|
||||
SanitizerSet::HWADDRESS,
|
||||
SanitizerSet::KERNELADDRESS,
|
||||
SanitizerSet::SAFESTACK,
|
||||
]
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(|&s| self.contains(s))
|
||||
.collect::<Vec<_>>()
|
||||
.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<CTX> HashStable<CTX> for SanitizerSet {
|
||||
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) {
|
||||
self.bits().hash_stable(ctx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for SanitizerSet {
|
||||
fn to_json(&self) -> Json {
|
||||
self.into_iter()
|
||||
|
@ -5,7 +5,7 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
bitflags = "1.2.1"
|
||||
bitflags = "2.4.1"
|
||||
derivative = "2.2.0"
|
||||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||
rustc_index = { path = "../rustc_index", default-features = false }
|
||||
|
@ -3,6 +3,7 @@
|
||||
/// through the type during type construction, so that we can quickly check
|
||||
/// whether the type has various kinds of types in it without recursing
|
||||
/// over the type itself.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub struct TypeFlags: u32 {
|
||||
// Does this have parameters? Used to determine whether substitution is
|
||||
// required.
|
||||
@ -13,9 +14,9 @@ pub struct TypeFlags: u32 {
|
||||
/// Does this have `ConstKind::Param`?
|
||||
const HAS_CT_PARAM = 1 << 2;
|
||||
|
||||
const HAS_PARAM = TypeFlags::HAS_TY_PARAM.bits
|
||||
| TypeFlags::HAS_RE_PARAM.bits
|
||||
| TypeFlags::HAS_CT_PARAM.bits;
|
||||
const HAS_PARAM = TypeFlags::HAS_TY_PARAM.bits()
|
||||
| TypeFlags::HAS_RE_PARAM.bits()
|
||||
| TypeFlags::HAS_CT_PARAM.bits();
|
||||
|
||||
/// Does this have `Infer`?
|
||||
const HAS_TY_INFER = 1 << 3;
|
||||
@ -26,9 +27,9 @@ pub struct TypeFlags: u32 {
|
||||
|
||||
/// Does this have inference variables? Used to determine whether
|
||||
/// inference is required.
|
||||
const HAS_INFER = TypeFlags::HAS_TY_INFER.bits
|
||||
| TypeFlags::HAS_RE_INFER.bits
|
||||
| TypeFlags::HAS_CT_INFER.bits;
|
||||
const HAS_INFER = TypeFlags::HAS_TY_INFER.bits()
|
||||
| TypeFlags::HAS_RE_INFER.bits()
|
||||
| TypeFlags::HAS_CT_INFER.bits();
|
||||
|
||||
/// Does this have `Placeholder`?
|
||||
const HAS_TY_PLACEHOLDER = 1 << 6;
|
||||
@ -38,9 +39,9 @@ pub struct TypeFlags: u32 {
|
||||
const HAS_CT_PLACEHOLDER = 1 << 8;
|
||||
|
||||
/// Does this have placeholders?
|
||||
const HAS_PLACEHOLDER = TypeFlags::HAS_TY_PLACEHOLDER.bits
|
||||
| TypeFlags::HAS_RE_PLACEHOLDER.bits
|
||||
| TypeFlags::HAS_CT_PLACEHOLDER.bits;
|
||||
const HAS_PLACEHOLDER = TypeFlags::HAS_TY_PLACEHOLDER.bits()
|
||||
| TypeFlags::HAS_RE_PLACEHOLDER.bits()
|
||||
| TypeFlags::HAS_CT_PLACEHOLDER.bits();
|
||||
|
||||
/// `true` if there are "names" of regions and so forth
|
||||
/// that are local to a particular fn/inferctxt
|
||||
@ -48,12 +49,12 @@ pub struct TypeFlags: u32 {
|
||||
|
||||
/// `true` if there are "names" of types and regions and so forth
|
||||
/// that are local to a particular fn
|
||||
const HAS_FREE_LOCAL_NAMES = TypeFlags::HAS_TY_PARAM.bits
|
||||
| TypeFlags::HAS_CT_PARAM.bits
|
||||
| TypeFlags::HAS_TY_INFER.bits
|
||||
| TypeFlags::HAS_CT_INFER.bits
|
||||
| TypeFlags::HAS_TY_PLACEHOLDER.bits
|
||||
| TypeFlags::HAS_CT_PLACEHOLDER.bits
|
||||
const HAS_FREE_LOCAL_NAMES = TypeFlags::HAS_TY_PARAM.bits()
|
||||
| TypeFlags::HAS_CT_PARAM.bits()
|
||||
| TypeFlags::HAS_TY_INFER.bits()
|
||||
| TypeFlags::HAS_CT_INFER.bits()
|
||||
| TypeFlags::HAS_TY_PLACEHOLDER.bits()
|
||||
| TypeFlags::HAS_CT_PLACEHOLDER.bits()
|
||||
// We consider 'freshened' types and constants
|
||||
// to depend on a particular fn.
|
||||
// The freshening process throws away information,
|
||||
@ -61,10 +62,10 @@ pub struct TypeFlags: u32 {
|
||||
// cache. Note that there is no 'fresh lifetime' flag -
|
||||
// freshening replaces all lifetimes with `ReErased`,
|
||||
// which is different from how types/const are freshened.
|
||||
| TypeFlags::HAS_TY_FRESH.bits
|
||||
| TypeFlags::HAS_CT_FRESH.bits
|
||||
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits
|
||||
| TypeFlags::HAS_RE_ERASED.bits;
|
||||
| TypeFlags::HAS_TY_FRESH.bits()
|
||||
| TypeFlags::HAS_CT_FRESH.bits()
|
||||
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits()
|
||||
| TypeFlags::HAS_RE_ERASED.bits();
|
||||
|
||||
/// Does this have `Projection`?
|
||||
const HAS_TY_PROJECTION = 1 << 10;
|
||||
@ -76,10 +77,10 @@ pub struct TypeFlags: u32 {
|
||||
const HAS_CT_PROJECTION = 1 << 13;
|
||||
|
||||
/// Could this type be normalized further?
|
||||
const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits
|
||||
| TypeFlags::HAS_TY_OPAQUE.bits
|
||||
| TypeFlags::HAS_TY_INHERENT.bits
|
||||
| TypeFlags::HAS_CT_PROJECTION.bits;
|
||||
const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits()
|
||||
| TypeFlags::HAS_TY_OPAQUE.bits()
|
||||
| TypeFlags::HAS_TY_INHERENT.bits()
|
||||
| TypeFlags::HAS_CT_PROJECTION.bits();
|
||||
|
||||
/// Is an error type/const reachable?
|
||||
const HAS_ERROR = 1 << 14;
|
||||
@ -96,9 +97,9 @@ pub struct TypeFlags: u32 {
|
||||
const HAS_CT_BOUND = 1 << 18;
|
||||
/// Does this have any bound variables?
|
||||
/// Used to check if a global bound is safe to evaluate.
|
||||
const HAS_BOUND_VARS = TypeFlags::HAS_RE_BOUND.bits
|
||||
| TypeFlags::HAS_TY_BOUND.bits
|
||||
| TypeFlags::HAS_CT_BOUND.bits;
|
||||
const HAS_BOUND_VARS = TypeFlags::HAS_RE_BOUND.bits()
|
||||
| TypeFlags::HAS_TY_BOUND.bits()
|
||||
| TypeFlags::HAS_CT_BOUND.bits();
|
||||
|
||||
/// Does this have any `ReErased` regions?
|
||||
const HAS_RE_ERASED = 1 << 19;
|
||||
|
@ -35,7 +35,7 @@
|
||||
StorageDead(_3);
|
||||
StorageLive(_4);
|
||||
- _4 = inline_always_and_using_inline_asm() -> [return: bb4, unwind unreachable];
|
||||
+ asm!("/* do nothing */", options((empty))) -> [return: bb3, unwind unreachable];
|
||||
+ asm!("/* do nothing */", options()) -> [return: bb3, unwind unreachable];
|
||||
}
|
||||
|
||||
- bb4: {
|
||||
|
@ -93,9 +93,9 @@ body:
|
||||
adt_def:
|
||||
AdtDef {
|
||||
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: }]
|
||||
flags: IS_ENUM
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 }
|
||||
args: []
|
||||
variant_index: 0
|
||||
subpatterns: [
|
||||
@ -107,9 +107,9 @@ body:
|
||||
adt_def:
|
||||
AdtDef {
|
||||
did: DefId(0:3 ~ thir_tree_match[fcf8]::Bar)
|
||||
variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }]
|
||||
variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: }]
|
||||
flags: IS_ENUM
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 10333377570083945360 }
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 10333377570083945360 }
|
||||
args: []
|
||||
variant_index: 0
|
||||
subpatterns: []
|
||||
@ -155,9 +155,9 @@ body:
|
||||
adt_def:
|
||||
AdtDef {
|
||||
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: }]
|
||||
flags: IS_ENUM
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 }
|
||||
args: []
|
||||
variant_index: 0
|
||||
subpatterns: [
|
||||
@ -207,9 +207,9 @@ body:
|
||||
adt_def:
|
||||
AdtDef {
|
||||
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
|
||||
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: }]
|
||||
flags: IS_ENUM
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
|
||||
repr: ReprOptions { int: None, align: None, pack: None, flags: , field_shuffle_seed: 3477539199540094892 }
|
||||
args: []
|
||||
variant_index: 1
|
||||
subpatterns: []
|
||||
|
Loading…
Reference in New Issue
Block a user