1
Fork 0

A few small cleanups for newtype_index

Remove the `..` from the body, only a few invocations used it and it's
inconsistent with rust syntax.

Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
This commit is contained in:
Nilstrieb 2022-12-18 21:47:28 +01:00
parent d679764fb6
commit 8bfd6450c7
35 changed files with 68 additions and 115 deletions

View file

@ -148,8 +148,7 @@ rustc_index::newtype_index! {
/// * The subscope with `first_statement_index == 1` is scope of `c`,
/// and thus does not include EXPR_2, but covers the `...`.
#[derive(HashStable)]
pub struct FirstStatementIndex {
}
pub struct FirstStatementIndex {}
}
// compilation error if size of `ScopeData` is not the same as a `u32`

View file

@ -35,8 +35,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[max = 0xFFFF_FFFF]
#[debug_format = "CounterValueReference({})"]
pub struct CounterValueReference {
}
pub struct CounterValueReference {}
}
impl CounterValueReference {
@ -59,8 +58,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[max = 0xFFFF_FFFF]
#[debug_format = "InjectedExpressionId({})"]
pub struct InjectedExpressionId {
}
pub struct InjectedExpressionId {}
}
rustc_index::newtype_index! {
@ -70,8 +68,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[max = 0xFFFF_FFFF]
#[debug_format = "InjectedExpressionIndex({})"]
pub struct InjectedExpressionIndex {
}
pub struct InjectedExpressionIndex {}
}
rustc_index::newtype_index! {
@ -81,8 +78,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[max = 0xFFFF_FFFF]
#[debug_format = "MappedExpressionIndex({})"]
pub struct MappedExpressionIndex {
}
pub struct MappedExpressionIndex {}
}
impl From<CounterValueReference> for ExpressionOperandId {

View file

@ -657,7 +657,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "_{}"]
pub struct Local {
const RETURN_PLACE = 0,
const RETURN_PLACE = 0;
}
}
@ -1149,7 +1149,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "bb{}"]
pub struct BasicBlock {
const START_BLOCK = 0,
const START_BLOCK = 0;
}
}
@ -1532,8 +1532,7 @@ rustc_index::newtype_index! {
/// [mir-datatypes]: https://rustc-dev-guide.rust-lang.org/mir/index.html#mir-data-types
#[derive(HashStable)]
#[debug_format = "field[{}]"]
pub struct Field {
}
pub struct Field {}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@ -1760,7 +1759,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "scope[{}]"]
pub struct SourceScope {
const OUTERMOST_SOURCE_SCOPE = 0,
const OUTERMOST_SOURCE_SCOPE = 0;
}
}
@ -2757,8 +2756,7 @@ impl<'tcx> TypeVisitable<'tcx> for UserTypeProjection {
rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "promoted[{}]"]
pub struct Promoted {
}
pub struct Promoted {}
}
impl<'tcx> Debug for Constant<'tcx> {

View file

@ -132,8 +132,7 @@ pub struct UnsafetyCheckResult {
rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "_{}"]
pub struct GeneratorSavedLocal {
}
pub struct GeneratorSavedLocal {}
}
/// The layout of generator state.

View file

@ -36,8 +36,7 @@ macro_rules! thir_with_elements {
newtype_index! {
#[derive(HashStable)]
#[debug_format = $format]
pub struct $id {
}
pub struct $id {}
}
)*

View file

@ -1379,8 +1379,7 @@ rustc_index::newtype_index! {
/// A **region** (lifetime) **v**ariable **ID**.
#[derive(HashStable)]
#[debug_format = "'_#{}r"]
pub struct RegionVid {
}
pub struct RegionVid {}
}
impl Atom for RegionVid {
@ -1391,7 +1390,7 @@ impl Atom for RegionVid {
rustc_index::newtype_index! {
#[derive(HashStable)]
pub struct BoundVar { .. }
pub struct BoundVar {}
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]

View file

@ -611,7 +611,7 @@ rustc_index::newtype_index! {
#[derive(HashStable)]
#[debug_format = "UserType({})"]
pub struct UserTypeAnnotationIndex {
const START_INDEX = 0,
const START_INDEX = 0;
}
}