mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 03:23:25 +00:00
Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obk
Improve syntax of `newtype_index` This makes it more like proper Rust and also makes the implementation a lot simpler. Mostly just turns weird flags in the body into proper attributes. It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
This commit is contained in:
commit
eb9e5e711d
@ -2554,10 +2554,9 @@ pub enum AttrStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct AttrId {
|
#[custom_encodable]
|
||||||
ENCODABLE = custom
|
#[debug_format = "AttrId({})]"]
|
||||||
DEBUG_FORMAT = "AttrId({})"
|
pub struct AttrId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: Encoder> Encodable<S> for AttrId {
|
impl<S: Encoder> Encodable<S> for AttrId {
|
||||||
|
@ -8,9 +8,8 @@ rustc_index::newtype_index! {
|
|||||||
/// This is later turned into [`DefId`] and `HirId` for the HIR.
|
/// This is later turned into [`DefId`] and `HirId` for the HIR.
|
||||||
///
|
///
|
||||||
/// [`DefId`]: rustc_span::def_id::DefId
|
/// [`DefId`]: rustc_span::def_id::DefId
|
||||||
pub struct NodeId {
|
#[debug_format = "NodeId({})"]
|
||||||
DEBUG_FORMAT = "NodeId({})"
|
pub struct NodeId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId);
|
rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId);
|
||||||
|
@ -115,13 +115,11 @@ impl<'tcx> fmt::Debug for OutlivesConstraint<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct OutlivesConstraintIndex {
|
#[debug_format = "OutlivesConstraintIndex({})"]
|
||||||
DEBUG_FORMAT = "OutlivesConstraintIndex({})"
|
pub struct OutlivesConstraintIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct ConstraintSccIndex {
|
#[debug_format = "ConstraintSccIndex({})"]
|
||||||
DEBUG_FORMAT = "ConstraintSccIndex({})"
|
pub struct ConstraintSccIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,8 @@ impl_visitable! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct BorrowIndex {
|
#[debug_format = "bw{}"]
|
||||||
DEBUG_FORMAT = "bw{}"
|
pub struct BorrowIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `Borrows` stores the data used in the analyses that track the flow
|
/// `Borrows` stores the data used in the analyses that track the flow
|
||||||
|
@ -20,9 +20,8 @@ pub struct LocationTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct LocationIndex {
|
#[debug_format = "LocationIndex({})"]
|
||||||
DEBUG_FORMAT = "LocationIndex({})"
|
pub struct LocationIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
@ -55,9 +55,8 @@ pub(crate) struct NllMemberConstraint<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub(crate) struct NllMemberConstraintIndex {
|
#[debug_format = "MemberConstraintIndex({})"]
|
||||||
DEBUG_FORMAT = "MemberConstraintIndex({})"
|
pub(crate) struct NllMemberConstraintIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for MemberConstraintSet<'_, ty::RegionVid> {
|
impl Default for MemberConstraintSet<'_, ty::RegionVid> {
|
||||||
|
@ -90,12 +90,14 @@ impl RegionValueElements {
|
|||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A single integer representing a `Location` in the MIR control-flow
|
/// A single integer representing a `Location` in the MIR control-flow
|
||||||
/// graph. Constructed efficiently from `RegionValueElements`.
|
/// graph. Constructed efficiently from `RegionValueElements`.
|
||||||
pub struct PointIndex { DEBUG_FORMAT = "PointIndex({})" }
|
#[debug_format = "PointIndex({})"]
|
||||||
|
pub struct PointIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A single integer representing a `ty::Placeholder`.
|
/// A single integer representing a `ty::Placeholder`.
|
||||||
pub struct PlaceholderIndex { DEBUG_FORMAT = "PlaceholderIndex({})" }
|
#[debug_format = "PlaceholderIndex({})"]
|
||||||
|
pub struct PlaceholderIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An individual element in a region value -- the value of a
|
/// An individual element in a region value -- the value of a
|
||||||
|
@ -46,7 +46,7 @@ struct Appearance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct AppearanceIndex { .. }
|
pub struct AppearanceIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl vll::LinkElem for Appearance {
|
impl vll::LinkElem for Appearance {
|
||||||
|
@ -22,7 +22,7 @@ struct PreOrderFrame<Iter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct PreorderIndex { .. }
|
struct PreorderIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {
|
pub fn dominators<G: ControlFlowGraph>(graph: G) -> Dominators<G::Node> {
|
||||||
|
@ -138,7 +138,7 @@ rustc_index::newtype_index! {
|
|||||||
/// an "item-like" to something else can be implemented by a `Vec` instead of a
|
/// an "item-like" to something else can be implemented by a `Vec` instead of a
|
||||||
/// tree or hash map.
|
/// tree or hash map.
|
||||||
#[derive(HashStable_Generic)]
|
#[derive(HashStable_Generic)]
|
||||||
pub struct ItemLocalId { .. }
|
pub struct ItemLocalId {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ItemLocalId {
|
impl ItemLocalId {
|
||||||
|
@ -198,10 +198,10 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
|
|||||||
// entire graph when there are many connected regions.
|
// entire graph when there are many connected regions.
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct RegionId {
|
#[custom_encodable]
|
||||||
ENCODABLE = custom
|
pub struct RegionId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ConnectedRegion {
|
struct ConnectedRegion {
|
||||||
idents: SmallVec<[Symbol; 8]>,
|
idents: SmallVec<[Symbol; 8]>,
|
||||||
impl_blocks: FxHashSet<usize>,
|
impl_blocks: FxHashSet<usize>,
|
||||||
|
@ -4,15 +4,13 @@ use rustc_index::vec::IndexVec;
|
|||||||
use rustc_middle::ty::error::TypeError;
|
use rustc_middle::ty::error::TypeError;
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub(crate) struct ExpectedIdx {
|
#[debug_format = "ExpectedIdx({})"]
|
||||||
DEBUG_FORMAT = "ExpectedIdx({})",
|
pub(crate) struct ExpectedIdx {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub(crate) struct ProvidedIdx {
|
#[debug_format = "ProvidedIdx({})"]
|
||||||
DEBUG_FORMAT = "ProvidedIdx({})",
|
pub(crate) struct ProvidedIdx {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExpectedIdx {
|
impl ExpectedIdx {
|
||||||
|
@ -96,15 +96,13 @@ fn for_each_consumable<'tcx>(hir: Map<'tcx>, place: TrackedValue, mut f: impl Fn
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct PostOrderId {
|
#[debug_format = "id({})"]
|
||||||
DEBUG_FORMAT = "id({})",
|
pub struct PostOrderId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct TrackedValueIndex {
|
#[debug_format = "hidx({})"]
|
||||||
DEBUG_FORMAT = "hidx({})",
|
pub struct TrackedValueIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identifies a value whose drop state we need to track.
|
/// Identifies a value whose drop state we need to track.
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
// Allows the macro invocation below to work
|
// Allows the macro invocation below to work
|
||||||
use crate as rustc_index;
|
use crate as rustc_index;
|
||||||
|
|
||||||
rustc_macros::newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });
|
rustc_macros::newtype_index! {
|
||||||
|
#[max = 0xFFFF_FFFA]
|
||||||
|
struct MyIdx {}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn index_size_is_optimized() {
|
fn index_size_is_optimized() {
|
||||||
|
@ -357,15 +357,13 @@ impl<'tcx> SccUniverse<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct LeakCheckNode {
|
#[debug_format = "LeakCheckNode({})"]
|
||||||
DEBUG_FORMAT = "LeakCheckNode({})"
|
struct LeakCheckNode {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct LeakCheckScc {
|
#[debug_format = "LeakCheckScc({})"]
|
||||||
DEBUG_FORMAT = "LeakCheckScc({})"
|
struct LeakCheckScc {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the graph of constraints. For each `R1: R2` constraint we create
|
/// Represents the graph of constraints. For each `R1: R2` constraint we create
|
||||||
|
@ -39,9 +39,9 @@ struct LintLevelSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
|
#[custom_encodable] // we don't need encoding
|
||||||
struct LintStackIndex {
|
struct LintStackIndex {
|
||||||
ENCODABLE = custom, // we don't need encoding
|
const COMMAND_LINE = 0;
|
||||||
const COMMAND_LINE = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,35 +1,15 @@
|
|||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::quote;
|
use quote::quote;
|
||||||
use syn::parse::*;
|
use syn::parse::*;
|
||||||
use syn::punctuated::Punctuated;
|
|
||||||
use syn::*;
|
use syn::*;
|
||||||
|
|
||||||
mod kw {
|
|
||||||
syn::custom_keyword!(derive);
|
|
||||||
syn::custom_keyword!(DEBUG_FORMAT);
|
|
||||||
syn::custom_keyword!(MAX);
|
|
||||||
syn::custom_keyword!(ENCODABLE);
|
|
||||||
syn::custom_keyword!(custom);
|
|
||||||
syn::custom_keyword!(ORD_IMPL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
enum DebugFormat {
|
|
||||||
// The user will provide a custom `Debug` impl, so we shouldn't generate
|
|
||||||
// one
|
|
||||||
Custom,
|
|
||||||
// Use the specified format string in the generated `Debug` impl
|
|
||||||
// By default, this is "{}"
|
|
||||||
Format(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
// We parse the input and emit the output in a single step.
|
// We parse the input and emit the output in a single step.
|
||||||
// This field stores the final macro output
|
// This field stores the final macro output
|
||||||
struct Newtype(TokenStream);
|
struct Newtype(TokenStream);
|
||||||
|
|
||||||
impl Parse for Newtype {
|
impl Parse for Newtype {
|
||||||
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
fn parse(input: ParseStream<'_>) -> Result<Self> {
|
||||||
let attrs = input.call(Attribute::parse_outer)?;
|
let mut attrs = input.call(Attribute::parse_outer)?;
|
||||||
let vis: Visibility = input.parse()?;
|
let vis: Visibility = input.parse()?;
|
||||||
input.parse::<Token![struct]>()?;
|
input.parse::<Token![struct]>()?;
|
||||||
let name: Ident = input.parse()?;
|
let name: Ident = input.parse()?;
|
||||||
@ -39,93 +19,68 @@ impl Parse for Newtype {
|
|||||||
|
|
||||||
// Any additional `#[derive]` macro paths to apply
|
// Any additional `#[derive]` macro paths to apply
|
||||||
let mut derive_paths: Vec<Path> = Vec::new();
|
let mut derive_paths: Vec<Path> = Vec::new();
|
||||||
let mut debug_format: Option<DebugFormat> = None;
|
let mut debug_format: Option<Lit> = None;
|
||||||
let mut max = None;
|
let mut max = None;
|
||||||
let mut consts = Vec::new();
|
let mut consts = Vec::new();
|
||||||
let mut encodable = true;
|
let mut encodable = true;
|
||||||
let mut ord = true;
|
let mut ord = true;
|
||||||
|
|
||||||
// Parse an optional trailing comma
|
attrs.retain(|attr| match attr.path.get_ident() {
|
||||||
let try_comma = || -> Result<()> {
|
Some(ident) => match &*ident.to_string() {
|
||||||
if body.lookahead1().peek(Token![,]) {
|
"custom_encodable" => {
|
||||||
body.parse::<Token![,]>()?;
|
encodable = false;
|
||||||
}
|
false
|
||||||
Ok(())
|
|
||||||
};
|
|
||||||
|
|
||||||
if body.lookahead1().peek(Token![..]) {
|
|
||||||
body.parse::<Token![..]>()?;
|
|
||||||
} else {
|
|
||||||
loop {
|
|
||||||
if body.lookahead1().peek(kw::derive) {
|
|
||||||
body.parse::<kw::derive>()?;
|
|
||||||
let derives;
|
|
||||||
bracketed!(derives in body);
|
|
||||||
let derives: Punctuated<Path, Token![,]> =
|
|
||||||
derives.parse_terminated(Path::parse)?;
|
|
||||||
try_comma()?;
|
|
||||||
derive_paths.extend(derives);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if body.lookahead1().peek(kw::DEBUG_FORMAT) {
|
"no_ord_impl" => {
|
||||||
body.parse::<kw::DEBUG_FORMAT>()?;
|
ord = false;
|
||||||
body.parse::<Token![=]>()?;
|
false
|
||||||
let new_debug_format = if body.lookahead1().peek(kw::custom) {
|
}
|
||||||
body.parse::<kw::custom>()?;
|
"max" => {
|
||||||
DebugFormat::Custom
|
let Ok(Meta::NameValue(literal) )= attr.parse_meta() else {
|
||||||
} else {
|
panic!("#[max = NUMBER] attribute requires max value");
|
||||||
let format_str: LitStr = body.parse()?;
|
|
||||||
DebugFormat::Format(format_str.value())
|
|
||||||
};
|
};
|
||||||
try_comma()?;
|
|
||||||
if let Some(old) = debug_format.replace(new_debug_format) {
|
if let Some(old) = max.replace(literal.lit) {
|
||||||
|
panic!("Specified multiple max: {:?}", old);
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
"debug_format" => {
|
||||||
|
let Ok(Meta::NameValue(literal) )= attr.parse_meta() else {
|
||||||
|
panic!("#[debug_format = FMT] attribute requires a format");
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(old) = debug_format.replace(literal.lit) {
|
||||||
panic!("Specified multiple debug format options: {:?}", old);
|
panic!("Specified multiple debug format options: {:?}", old);
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if body.lookahead1().peek(kw::MAX) {
|
|
||||||
body.parse::<kw::MAX>()?;
|
|
||||||
body.parse::<Token![=]>()?;
|
|
||||||
let val: Lit = body.parse()?;
|
|
||||||
try_comma()?;
|
|
||||||
if let Some(old) = max.replace(val) {
|
|
||||||
panic!("Specified multiple MAX: {:?}", old);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if body.lookahead1().peek(kw::ENCODABLE) {
|
|
||||||
body.parse::<kw::ENCODABLE>()?;
|
|
||||||
body.parse::<Token![=]>()?;
|
|
||||||
body.parse::<kw::custom>()?;
|
|
||||||
try_comma()?;
|
|
||||||
encodable = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if body.lookahead1().peek(kw::ORD_IMPL) {
|
|
||||||
body.parse::<kw::ORD_IMPL>()?;
|
|
||||||
body.parse::<Token![=]>()?;
|
|
||||||
body.parse::<kw::custom>()?;
|
|
||||||
ord = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We've parsed everything that the user provided, so we're done
|
false
|
||||||
if body.is_empty() {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
_ => true,
|
||||||
|
},
|
||||||
|
_ => true,
|
||||||
|
});
|
||||||
|
|
||||||
// Otherwise, we are parsing a user-defined constant
|
loop {
|
||||||
let const_attrs = body.call(Attribute::parse_outer)?;
|
// We've parsed everything that the user provided, so we're done
|
||||||
body.parse::<Token![const]>()?;
|
if body.is_empty() {
|
||||||
let const_name: Ident = body.parse()?;
|
break;
|
||||||
body.parse::<Token![=]>()?;
|
|
||||||
let const_val: Expr = body.parse()?;
|
|
||||||
try_comma()?;
|
|
||||||
consts.push(quote! { #(#const_attrs)* #vis const #const_name: #name = #name::from_u32(#const_val); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, we are parsing a user-defined constant
|
||||||
|
let const_attrs = body.call(Attribute::parse_outer)?;
|
||||||
|
body.parse::<Token![const]>()?;
|
||||||
|
let const_name: Ident = body.parse()?;
|
||||||
|
body.parse::<Token![=]>()?;
|
||||||
|
let const_val: Expr = body.parse()?;
|
||||||
|
body.parse::<Token![;]>()?;
|
||||||
|
consts.push(quote! { #(#const_attrs)* #vis const #const_name: #name = #name::from_u32(#const_val); });
|
||||||
}
|
}
|
||||||
|
|
||||||
let debug_format = debug_format.unwrap_or(DebugFormat::Format("{}".to_string()));
|
let debug_format =
|
||||||
|
debug_format.unwrap_or_else(|| Lit::Str(LitStr::new("{}", Span::call_site())));
|
||||||
|
|
||||||
// shave off 256 indices at the end to allow space for packing these indices into enums
|
// shave off 256 indices at the end to allow space for packing these indices into enums
|
||||||
let max = max.unwrap_or_else(|| Lit::Int(LitInt::new("0xFFFF_FF00", Span::call_site())));
|
let max = max.unwrap_or_else(|| Lit::Int(LitInt::new("0xFFFF_FF00", Span::call_site())));
|
||||||
|
|
||||||
@ -180,18 +135,14 @@ impl Parse for Newtype {
|
|||||||
quote! {}
|
quote! {}
|
||||||
};
|
};
|
||||||
|
|
||||||
let debug_impl = match debug_format {
|
let debug_impl = quote! {
|
||||||
DebugFormat::Custom => quote! {},
|
impl ::std::fmt::Debug for #name {
|
||||||
DebugFormat::Format(format) => {
|
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
quote! {
|
write!(fmt, #debug_format, self.as_u32())
|
||||||
impl ::std::fmt::Debug for #name {
|
|
||||||
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
|
||||||
write!(fmt, #format, self.as_u32())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let spec_partial_eq_impl = if let Lit::Int(max) = &max {
|
let spec_partial_eq_impl = if let Lit::Int(max) = &max {
|
||||||
if let Ok(max_val) = max.base10_parse::<u32>() {
|
if let Ok(max_val) = max.base10_parse::<u32>() {
|
||||||
quote! {
|
quote! {
|
||||||
|
@ -147,9 +147,8 @@ rustc_index::newtype_index! {
|
|||||||
///
|
///
|
||||||
/// * The subscope with `first_statement_index == 1` is scope of `c`,
|
/// * The subscope with `first_statement_index == 1` is scope of `c`,
|
||||||
/// and thus does not include EXPR_2, but covers the `...`.
|
/// and thus does not include EXPR_2, but covers the `...`.
|
||||||
pub struct FirstStatementIndex {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
pub struct FirstStatementIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// compilation error if size of `ScopeData` is not the same as a `u32`
|
// compilation error if size of `ScopeData` is not the same as a `u32`
|
||||||
|
@ -10,10 +10,10 @@ rustc_index::newtype_index! {
|
|||||||
/// CounterValueReference.as_u32() (which ascend from 1) or an ExpressionOperandId.as_u32()
|
/// CounterValueReference.as_u32() (which ascend from 1) or an ExpressionOperandId.as_u32()
|
||||||
/// (which _*descend*_ from u32::MAX). Id value `0` (zero) represents a virtual counter with a
|
/// (which _*descend*_ from u32::MAX). Id value `0` (zero) represents a virtual counter with a
|
||||||
/// constant value of `0`.
|
/// constant value of `0`.
|
||||||
|
#[derive(HashStable)]
|
||||||
|
#[max = 0xFFFF_FFFF]
|
||||||
|
#[debug_format = "ExpressionOperandId({})"]
|
||||||
pub struct ExpressionOperandId {
|
pub struct ExpressionOperandId {
|
||||||
derive [HashStable]
|
|
||||||
DEBUG_FORMAT = "ExpressionOperandId({})",
|
|
||||||
MAX = 0xFFFF_FFFF,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,11 +32,10 @@ impl ExpressionOperandId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct CounterValueReference {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[max = 0xFFFF_FFFF]
|
||||||
DEBUG_FORMAT = "CounterValueReference({})",
|
#[debug_format = "CounterValueReference({})"]
|
||||||
MAX = 0xFFFF_FFFF,
|
pub struct CounterValueReference {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CounterValueReference {
|
impl CounterValueReference {
|
||||||
@ -56,33 +55,30 @@ rustc_index::newtype_index! {
|
|||||||
/// InjectedExpressionId.as_u32() converts to ExpressionOperandId.as_u32()
|
/// InjectedExpressionId.as_u32() converts to ExpressionOperandId.as_u32()
|
||||||
///
|
///
|
||||||
/// Values descend from u32::MAX.
|
/// Values descend from u32::MAX.
|
||||||
pub struct InjectedExpressionId {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[max = 0xFFFF_FFFF]
|
||||||
DEBUG_FORMAT = "InjectedExpressionId({})",
|
#[debug_format = "InjectedExpressionId({})"]
|
||||||
MAX = 0xFFFF_FFFF,
|
pub struct InjectedExpressionId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// InjectedExpressionIndex.as_u32() translates to u32::MAX - ExpressionOperandId.as_u32()
|
/// InjectedExpressionIndex.as_u32() translates to u32::MAX - ExpressionOperandId.as_u32()
|
||||||
///
|
///
|
||||||
/// Values ascend from 0.
|
/// Values ascend from 0.
|
||||||
pub struct InjectedExpressionIndex {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[max = 0xFFFF_FFFF]
|
||||||
DEBUG_FORMAT = "InjectedExpressionIndex({})",
|
#[debug_format = "InjectedExpressionIndex({})"]
|
||||||
MAX = 0xFFFF_FFFF,
|
pub struct InjectedExpressionIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// MappedExpressionIndex values ascend from zero, and are recalculated indexes based on their
|
/// MappedExpressionIndex values ascend from zero, and are recalculated indexes based on their
|
||||||
/// array position in the LLVM coverage map "Expressions" array, which is assembled during the
|
/// array position in the LLVM coverage map "Expressions" array, which is assembled during the
|
||||||
/// "mapgen" process. They cannot be computed algorithmically, from the other `newtype_index`s.
|
/// "mapgen" process. They cannot be computed algorithmically, from the other `newtype_index`s.
|
||||||
pub struct MappedExpressionIndex {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[max = 0xFFFF_FFFF]
|
||||||
DEBUG_FORMAT = "MappedExpressionIndex({})",
|
#[debug_format = "MappedExpressionIndex({})"]
|
||||||
MAX = 0xFFFF_FFFF,
|
pub struct MappedExpressionIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<CounterValueReference> for ExpressionOperandId {
|
impl From<CounterValueReference> for ExpressionOperandId {
|
||||||
|
@ -654,10 +654,10 @@ impl SourceInfo {
|
|||||||
// Variables and temps
|
// Variables and temps
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
|
#[derive(HashStable)]
|
||||||
|
#[debug_format = "_{}"]
|
||||||
pub struct Local {
|
pub struct Local {
|
||||||
derive [HashStable]
|
const RETURN_PLACE = 0;
|
||||||
DEBUG_FORMAT = "_{}",
|
|
||||||
const RETURN_PLACE = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1146,10 +1146,10 @@ rustc_index::newtype_index! {
|
|||||||
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
|
/// https://rustc-dev-guide.rust-lang.org/appendix/background.html#what-is-a-dataflow-analysis
|
||||||
/// [`CriticalCallEdges`]: ../../rustc_const_eval/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
|
/// [`CriticalCallEdges`]: ../../rustc_const_eval/transform/add_call_guards/enum.AddCallGuards.html#variant.CriticalCallEdges
|
||||||
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
|
/// [guide-mir]: https://rustc-dev-guide.rust-lang.org/mir/
|
||||||
|
#[derive(HashStable)]
|
||||||
|
#[debug_format = "bb{}"]
|
||||||
pub struct BasicBlock {
|
pub struct BasicBlock {
|
||||||
derive [HashStable]
|
const START_BLOCK = 0;
|
||||||
DEBUG_FORMAT = "bb{}",
|
|
||||||
const START_BLOCK = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1530,10 +1530,9 @@ rustc_index::newtype_index! {
|
|||||||
/// [wrapper]: https://rustc-dev-guide.rust-lang.org/appendix/glossary.html#newtype
|
/// [wrapper]: https://rustc-dev-guide.rust-lang.org/appendix/glossary.html#newtype
|
||||||
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
|
/// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
|
||||||
/// [mir-datatypes]: https://rustc-dev-guide.rust-lang.org/mir/index.html#mir-data-types
|
/// [mir-datatypes]: https://rustc-dev-guide.rust-lang.org/mir/index.html#mir-data-types
|
||||||
pub struct Field {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[debug_format = "field[{}]"]
|
||||||
DEBUG_FORMAT = "field[{}]"
|
pub struct Field {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
@ -1757,10 +1756,10 @@ impl Debug for Place<'_> {
|
|||||||
// Scopes
|
// Scopes
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
|
#[derive(HashStable)]
|
||||||
|
#[debug_format = "scope[{}]"]
|
||||||
pub struct SourceScope {
|
pub struct SourceScope {
|
||||||
derive [HashStable]
|
const OUTERMOST_SOURCE_SCOPE = 0;
|
||||||
DEBUG_FORMAT = "scope[{}]",
|
|
||||||
const OUTERMOST_SOURCE_SCOPE = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2755,10 +2754,9 @@ impl<'tcx> TypeVisitable<'tcx> for UserTypeProjection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct Promoted {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[debug_format = "promoted[{}]"]
|
||||||
DEBUG_FORMAT = "promoted[{}]"
|
pub struct Promoted {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Debug for Constant<'tcx> {
|
impl<'tcx> Debug for Constant<'tcx> {
|
||||||
|
@ -130,10 +130,9 @@ pub struct UnsafetyCheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct GeneratorSavedLocal {
|
#[derive(HashStable)]
|
||||||
derive [HashStable]
|
#[debug_format = "_{}"]
|
||||||
DEBUG_FORMAT = "_{}",
|
pub struct GeneratorSavedLocal {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The layout of generator state.
|
/// The layout of generator state.
|
||||||
|
@ -35,9 +35,8 @@ macro_rules! thir_with_elements {
|
|||||||
$(
|
$(
|
||||||
newtype_index! {
|
newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub struct $id {
|
#[debug_format = $format]
|
||||||
DEBUG_FORMAT = $format
|
pub struct $id {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
|
|
||||||
|
@ -99,12 +99,6 @@ impl<'tcx> fmt::Debug for ty::ConstVid<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ty::RegionVid {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "'_#{}r", self.index())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
|
impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
with_no_trimmed_paths!(fmt::Display::fmt(self, f))
|
with_no_trimmed_paths!(fmt::Display::fmt(self, f))
|
||||||
|
@ -1378,9 +1378,8 @@ pub struct ConstVid<'tcx> {
|
|||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A **region** (lifetime) **v**ariable **ID**.
|
/// A **region** (lifetime) **v**ariable **ID**.
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub struct RegionVid {
|
#[debug_format = "'_#{}r"]
|
||||||
DEBUG_FORMAT = custom,
|
pub struct RegionVid {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Atom for RegionVid {
|
impl Atom for RegionVid {
|
||||||
@ -1391,7 +1390,7 @@ impl Atom for RegionVid {
|
|||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub struct BoundVar { .. }
|
pub struct BoundVar {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
|
@ -608,10 +608,10 @@ impl<'a, V> LocalTableInContextMut<'a, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
|
#[derive(HashStable)]
|
||||||
|
#[debug_format = "UserType({})"]
|
||||||
pub struct UserTypeAnnotationIndex {
|
pub struct UserTypeAnnotationIndex {
|
||||||
derive [HashStable]
|
const START_INDEX = 0;
|
||||||
DEBUG_FORMAT = "UserType({})",
|
|
||||||
const START_INDEX = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ struct CFG<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct ScopeId { .. }
|
struct ScopeId {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -185,7 +185,7 @@ pub(crate) enum BreakableTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct DropIdx { .. }
|
struct DropIdx {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ROOT_NODE: DropIdx = DropIdx::from_u32(0);
|
const ROOT_NODE: DropIdx = DropIdx::from_u32(0);
|
||||||
|
@ -14,9 +14,8 @@ use self::abs_domain::{AbstractElem, Lift};
|
|||||||
mod abs_domain;
|
mod abs_domain;
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct MovePathIndex {
|
#[debug_format = "mp{}"]
|
||||||
DEBUG_FORMAT = "mp{}"
|
pub struct MovePathIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl polonius_engine::Atom for MovePathIndex {
|
impl polonius_engine::Atom for MovePathIndex {
|
||||||
@ -26,15 +25,13 @@ impl polonius_engine::Atom for MovePathIndex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct MoveOutIndex {
|
#[debug_format = "mo{}"]
|
||||||
DEBUG_FORMAT = "mo{}"
|
pub struct MoveOutIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct InitIndex {
|
#[debug_format = "in{}"]
|
||||||
DEBUG_FORMAT = "in{}"
|
pub struct InitIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MoveOutIndex {
|
impl MoveOutIndex {
|
||||||
|
@ -282,9 +282,9 @@ impl graph::WithPredecessors for CoverageGraph {
|
|||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A node in the control-flow graph of CoverageGraph.
|
/// A node in the control-flow graph of CoverageGraph.
|
||||||
|
#[debug_format = "bcb{}"]
|
||||||
pub(super) struct BasicCoverageBlock {
|
pub(super) struct BasicCoverageBlock {
|
||||||
DEBUG_FORMAT = "bcb{}",
|
const START_BCB = 0;
|
||||||
const START_BCB = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,15 +108,13 @@ use std::rc::Rc;
|
|||||||
mod rwu_table;
|
mod rwu_table;
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct Variable {
|
#[debug_format = "v({})"]
|
||||||
DEBUG_FORMAT = "v({})",
|
pub struct Variable {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct LiveNode {
|
#[debug_format = "ln({})"]
|
||||||
DEBUG_FORMAT = "ln({})",
|
pub struct LiveNode {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug)]
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
||||||
|
@ -37,7 +37,7 @@ pub struct DepGraph<K: DepKind> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct DepNodeIndex { .. }
|
pub struct DepNodeIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DepNodeIndex {
|
impl DepNodeIndex {
|
||||||
@ -974,7 +974,7 @@ pub struct WorkProduct {
|
|||||||
|
|
||||||
// Index type for `DepNodeData`'s edges.
|
// Index type for `DepNodeData`'s edges.
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct EdgeIndex { .. }
|
struct EdgeIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `CurrentDepGraph` stores the dependency graph for the current session. It
|
/// `CurrentDepGraph` stores the dependency graph for the current session. It
|
||||||
|
@ -27,9 +27,8 @@ use smallvec::SmallVec;
|
|||||||
// unused so that we can store multiple index types in `CompressedHybridIndex`,
|
// unused so that we can store multiple index types in `CompressedHybridIndex`,
|
||||||
// and use those bits to encode which index type it contains.
|
// and use those bits to encode which index type it contains.
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct SerializedDepNodeIndex {
|
#[max = 0x7FFF_FFFF]
|
||||||
MAX = 0x7FFF_FFFF
|
pub struct SerializedDepNodeIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Data for use when recompiling the **current crate**.
|
/// Data for use when recompiling the **current crate**.
|
||||||
|
@ -10,10 +10,9 @@ use std::fmt;
|
|||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct CrateNum {
|
#[custom_encodable]
|
||||||
ENCODABLE = custom
|
#[debug_format = "crate{}"]
|
||||||
DEBUG_FORMAT = "crate{}"
|
pub struct CrateNum {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Item definitions in the currently-compiled crate would have the `CrateNum`
|
/// Item definitions in the currently-compiled crate would have the `CrateNum`
|
||||||
@ -194,13 +193,12 @@ rustc_index::newtype_index! {
|
|||||||
/// A DefIndex is an index into the hir-map for a crate, identifying a
|
/// A DefIndex is an index into the hir-map for a crate, identifying a
|
||||||
/// particular definition. It should really be considered an interned
|
/// particular definition. It should really be considered an interned
|
||||||
/// shorthand for a particular DefPath.
|
/// shorthand for a particular DefPath.
|
||||||
|
#[custom_encodable] // (only encodable in metadata)
|
||||||
|
#[debug_format = "DefIndex({})"]
|
||||||
pub struct DefIndex {
|
pub struct DefIndex {
|
||||||
ENCODABLE = custom // (only encodable in metadata)
|
|
||||||
|
|
||||||
DEBUG_FORMAT = "DefIndex({})",
|
|
||||||
/// The crate root is always assigned index 0 by the AST Map code,
|
/// The crate root is always assigned index 0 by the AST Map code,
|
||||||
/// thanks to `NodeCollector::new`.
|
/// thanks to `NodeCollector::new`.
|
||||||
const CRATE_DEF_INDEX = 0,
|
const CRATE_DEF_INDEX = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,8 @@ pub struct SyntaxContextData {
|
|||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A unique ID associated with a macro invocation and expansion.
|
/// A unique ID associated with a macro invocation and expansion.
|
||||||
pub struct ExpnIndex {
|
#[custom_encodable]
|
||||||
ENCODABLE = custom
|
pub struct ExpnIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A unique ID associated with a macro invocation and expansion.
|
/// A unique ID associated with a macro invocation and expansion.
|
||||||
@ -82,11 +81,10 @@ impl fmt::Debug for ExpnId {
|
|||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A unique ID associated with a macro invocation and expansion.
|
/// A unique ID associated with a macro invocation and expansion.
|
||||||
pub struct LocalExpnId {
|
#[custom_encodable]
|
||||||
ENCODABLE = custom
|
#[no_ord_impl]
|
||||||
ORD_IMPL = custom
|
#[debug_format = "expn{}"]
|
||||||
DEBUG_FORMAT = "expn{}"
|
pub struct LocalExpnId {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// To ensure correctness of incremental compilation,
|
// To ensure correctness of incremental compilation,
|
||||||
|
@ -1802,7 +1802,7 @@ impl fmt::Display for MacroRulesNormalizedIdent {
|
|||||||
pub struct Symbol(SymbolIndex);
|
pub struct Symbol(SymbolIndex);
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
struct SymbolIndex { .. }
|
struct SymbolIndex {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Symbol {
|
impl Symbol {
|
||||||
|
@ -20,9 +20,8 @@ impl ToJson for Endian {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
pub struct VariantIdx {
|
#[derive(HashStable_Generic)]
|
||||||
derive [HashStable_Generic]
|
pub struct VariantIdx {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)]
|
||||||
|
@ -301,9 +301,9 @@ rustc_index::newtype_index! {
|
|||||||
///
|
///
|
||||||
/// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index
|
/// [dbi]: https://en.wikipedia.org/wiki/De_Bruijn_index
|
||||||
#[derive(HashStable_Generic)]
|
#[derive(HashStable_Generic)]
|
||||||
|
#[debug_format = "DebruijnIndex({})"]
|
||||||
pub struct DebruijnIndex {
|
pub struct DebruijnIndex {
|
||||||
DEBUG_FORMAT = "DebruijnIndex({})",
|
const INNERMOST = 0;
|
||||||
const INNERMOST = 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,9 +499,8 @@ pub struct FloatVarValue(pub FloatTy);
|
|||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
/// A **ty**pe **v**ariable **ID**.
|
/// A **ty**pe **v**ariable **ID**.
|
||||||
pub struct TyVid {
|
#[debug_format = "_#{}t"]
|
||||||
DEBUG_FORMAT = "_#{}t"
|
pub struct TyVid {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**.
|
/// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**.
|
||||||
@ -788,9 +787,8 @@ rustc_index::newtype_index! {
|
|||||||
/// type -- an idealized representative of "types in general" that we
|
/// type -- an idealized representative of "types in general" that we
|
||||||
/// use for checking generic functions.
|
/// use for checking generic functions.
|
||||||
#[derive(HashStable_Generic)]
|
#[derive(HashStable_Generic)]
|
||||||
pub struct UniverseIndex {
|
#[debug_format = "U{}"]
|
||||||
DEBUG_FORMAT = "U{}",
|
pub struct UniverseIndex {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UniverseIndex {
|
impl UniverseIndex {
|
||||||
|
Loading…
Reference in New Issue
Block a user