From 8bfd6450c7b61ffee0fd7e21b538d00018a0e47e Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 18 Dec 2022 21:47:28 +0100 Subject: [PATCH] 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. --- compiler/rustc_ast/src/ast.rs | 3 +- compiler/rustc_ast/src/node_id.rs | 3 +- .../rustc_borrowck/src/constraints/mod.rs | 6 +-- compiler/rustc_borrowck/src/dataflow.rs | 3 +- compiler/rustc_borrowck/src/location.rs | 3 +- .../rustc_borrowck/src/member_constraints.rs | 3 +- .../src/type_check/liveness/local_use_map.rs | 2 +- .../src/graph/dominators/mod.rs | 2 +- compiler/rustc_hir/src/hir_id.rs | 2 +- .../src/coherence/inherent_impls_overlap.rs | 4 +- .../src/fn_ctxt/arg_matrix.rs | 6 +-- .../src/generator_interior/drop_ranges/mod.rs | 6 +-- compiler/rustc_index/src/vec/tests.rs | 2 +- .../infer/region_constraints/leak_check.rs | 6 +-- compiler/rustc_lint/src/levels.rs | 2 +- compiler/rustc_macros/src/newtype.rs | 38 +++++++------------ compiler/rustc_middle/src/middle/region.rs | 3 +- compiler/rustc_middle/src/mir/coverage.rs | 12 ++---- compiler/rustc_middle/src/mir/mod.rs | 12 +++--- compiler/rustc_middle/src/mir/query.rs | 3 +- compiler/rustc_middle/src/thir.rs | 3 +- compiler/rustc_middle/src/ty/sty.rs | 5 +-- .../rustc_middle/src/ty/typeck_results.rs | 2 +- compiler/rustc_mir_build/src/build/mod.rs | 2 +- compiler/rustc_mir_build/src/build/scope.rs | 2 +- .../rustc_mir_dataflow/src/move_paths/mod.rs | 9 ++--- .../rustc_mir_transform/src/coverage/graph.rs | 2 +- compiler/rustc_passes/src/liveness.rs | 6 +-- .../rustc_query_system/src/dep_graph/graph.rs | 4 +- .../src/dep_graph/serialized.rs | 3 +- compiler/rustc_span/src/def_id.rs | 5 +-- compiler/rustc_span/src/hygiene.rs | 6 +-- compiler/rustc_span/src/symbol.rs | 2 +- compiler/rustc_target/src/abi/mod.rs | 3 +- compiler/rustc_type_ir/src/lib.rs | 8 ++-- 35 files changed, 68 insertions(+), 115 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 4140bff6e29..31596a1e9bf 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2556,8 +2556,7 @@ pub enum AttrStyle { rustc_index::newtype_index! { #[custom_encodable] #[debug_format = "AttrId({})]"] - pub struct AttrId { - } + pub struct AttrId {} } impl Encodable for AttrId { diff --git a/compiler/rustc_ast/src/node_id.rs b/compiler/rustc_ast/src/node_id.rs index 8ba6b8c2c33..daa82996b3d 100644 --- a/compiler/rustc_ast/src/node_id.rs +++ b/compiler/rustc_ast/src/node_id.rs @@ -9,8 +9,7 @@ rustc_index::newtype_index! { /// /// [`DefId`]: rustc_span::def_id::DefId #[debug_format = "NodeId({})"] - pub struct NodeId { - } + pub struct NodeId {} } rustc_data_structures::define_id_collections!(NodeMap, NodeSet, NodeMapEntry, NodeId); diff --git a/compiler/rustc_borrowck/src/constraints/mod.rs b/compiler/rustc_borrowck/src/constraints/mod.rs index 0e5a874735c..1f0b8adeaf1 100644 --- a/compiler/rustc_borrowck/src/constraints/mod.rs +++ b/compiler/rustc_borrowck/src/constraints/mod.rs @@ -116,12 +116,10 @@ impl<'tcx> fmt::Debug for OutlivesConstraint<'tcx> { rustc_index::newtype_index! { #[debug_format = "OutlivesConstraintIndex({})"] - pub struct OutlivesConstraintIndex { - } + pub struct OutlivesConstraintIndex {} } rustc_index::newtype_index! { #[debug_format = "ConstraintSccIndex({})"] - pub struct ConstraintSccIndex { - } + pub struct ConstraintSccIndex {} } diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index 6f533cec9fa..8c4885770ad 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -109,8 +109,7 @@ impl_visitable! { rustc_index::newtype_index! { #[debug_format = "bw{}"] - pub struct BorrowIndex { - } + pub struct BorrowIndex {} } /// `Borrows` stores the data used in the analyses that track the flow diff --git a/compiler/rustc_borrowck/src/location.rs b/compiler/rustc_borrowck/src/location.rs index 0614163474c..288b7d85be2 100644 --- a/compiler/rustc_borrowck/src/location.rs +++ b/compiler/rustc_borrowck/src/location.rs @@ -21,8 +21,7 @@ pub struct LocationTable { rustc_index::newtype_index! { #[debug_format = "LocationIndex({})"] - pub struct LocationIndex { - } + pub struct LocationIndex {} } #[derive(Copy, Clone, Debug)] diff --git a/compiler/rustc_borrowck/src/member_constraints.rs b/compiler/rustc_borrowck/src/member_constraints.rs index ccf6fcac9d2..b63e286676f 100644 --- a/compiler/rustc_borrowck/src/member_constraints.rs +++ b/compiler/rustc_borrowck/src/member_constraints.rs @@ -56,8 +56,7 @@ pub(crate) struct NllMemberConstraint<'tcx> { rustc_index::newtype_index! { #[debug_format = "MemberConstraintIndex({})"] - pub(crate) struct NllMemberConstraintIndex { - } + pub(crate) struct NllMemberConstraintIndex {} } impl Default for MemberConstraintSet<'_, ty::RegionVid> { diff --git a/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs b/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs index fda2cee43fb..8023ef60d20 100644 --- a/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs +++ b/compiler/rustc_borrowck/src/type_check/liveness/local_use_map.rs @@ -46,7 +46,7 @@ struct Appearance { } rustc_index::newtype_index! { - pub struct AppearanceIndex { .. } + pub struct AppearanceIndex {} } impl vll::LinkElem for Appearance { diff --git a/compiler/rustc_data_structures/src/graph/dominators/mod.rs b/compiler/rustc_data_structures/src/graph/dominators/mod.rs index 00913a483db..94a8c1fc051 100644 --- a/compiler/rustc_data_structures/src/graph/dominators/mod.rs +++ b/compiler/rustc_data_structures/src/graph/dominators/mod.rs @@ -22,7 +22,7 @@ struct PreOrderFrame { } rustc_index::newtype_index! { - struct PreorderIndex { .. } + struct PreorderIndex {} } pub fn dominators(graph: G) -> Dominators { diff --git a/compiler/rustc_hir/src/hir_id.rs b/compiler/rustc_hir/src/hir_id.rs index 060f40919f5..03bcaa69468 100644 --- a/compiler/rustc_hir/src/hir_id.rs +++ b/compiler/rustc_hir/src/hir_id.rs @@ -138,7 +138,7 @@ rustc_index::newtype_index! { /// an "item-like" to something else can be implemented by a `Vec` instead of a /// tree or hash map. #[derive(HashStable_Generic)] - pub struct ItemLocalId { .. } + pub struct ItemLocalId {} } impl ItemLocalId { diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs index 6531e55c577..a9331af4eab 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs @@ -199,9 +199,9 @@ impl<'tcx> InherentOverlapChecker<'tcx> { rustc_index::newtype_index! { #[custom_encodable] - pub struct RegionId { - } + pub struct RegionId {} } + struct ConnectedRegion { idents: SmallVec<[Symbol; 8]>, impl_blocks: FxHashSet, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs index 3f59e8ddf15..6f26afcaf16 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/arg_matrix.rs @@ -5,14 +5,12 @@ use rustc_middle::ty::error::TypeError; rustc_index::newtype_index! { #[debug_format = "ExpectedIdx({})"] - pub(crate) struct ExpectedIdx { - } + pub(crate) struct ExpectedIdx {} } rustc_index::newtype_index! { #[debug_format = "ProvidedIdx({})"] - pub(crate) struct ProvidedIdx { - } + pub(crate) struct ProvidedIdx {} } impl ExpectedIdx { diff --git a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/mod.rs b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/mod.rs index 3763373ad68..2f55ea939fc 100644 --- a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/mod.rs +++ b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/mod.rs @@ -97,14 +97,12 @@ fn for_each_consumable<'tcx>(hir: Map<'tcx>, place: TrackedValue, mut f: impl Fn rustc_index::newtype_index! { #[debug_format = "id({})"] - pub struct PostOrderId { - } + pub struct PostOrderId {} } rustc_index::newtype_index! { #[debug_format = "hidx({})"] - pub struct TrackedValueIndex { - } + pub struct TrackedValueIndex {} } /// Identifies a value whose drop state we need to track. diff --git a/compiler/rustc_index/src/vec/tests.rs b/compiler/rustc_index/src/vec/tests.rs index e72863f6de1..cb0f0db220d 100644 --- a/compiler/rustc_index/src/vec/tests.rs +++ b/compiler/rustc_index/src/vec/tests.rs @@ -5,7 +5,7 @@ use crate as rustc_index; rustc_macros::newtype_index! { #[max = 0xFFFF_FFFA] - struct MyIdx { } + struct MyIdx {} } #[test] diff --git a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs index 64dc0e8f56d..c46edc33ff4 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/leak_check.rs @@ -358,14 +358,12 @@ impl<'tcx> SccUniverse<'tcx> { rustc_index::newtype_index! { #[debug_format = "LeakCheckNode({})"] - struct LeakCheckNode { - } + struct LeakCheckNode {} } rustc_index::newtype_index! { #[debug_format = "LeakCheckScc({})"] - struct LeakCheckScc { - } + struct LeakCheckScc {} } /// Represents the graph of constraints. For each `R1: R2` constraint we create diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 7fed40b201b..e9d3d44a3f9 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -41,7 +41,7 @@ struct LintLevelSets { rustc_index::newtype_index! { #[custom_encodable] // we don't need encoding struct LintStackIndex { - const COMMAND_LINE = 0, + const COMMAND_LINE = 0; } } diff --git a/compiler/rustc_macros/src/newtype.rs b/compiler/rustc_macros/src/newtype.rs index 7b7e475da5b..153473de624 100644 --- a/compiler/rustc_macros/src/newtype.rs +++ b/compiler/rustc_macros/src/newtype.rs @@ -25,14 +25,6 @@ impl Parse for Newtype { let mut encodable = true; let mut ord = true; - // Parse an optional trailing comma - let try_comma = || -> Result<()> { - if body.lookahead1().peek(Token![,]) { - body.parse::()?; - } - Ok(()) - }; - attrs.retain(|attr| match attr.path.get_ident() { Some(ident) => match &*ident.to_string() { "custom_encodable" => { @@ -70,24 +62,20 @@ impl Parse for Newtype { _ => true, }); - if body.lookahead1().peek(Token![..]) { - body.parse::()?; - } else { - loop { - // We've parsed everything that the user provided, so we're done - if body.is_empty() { - break; - } - - // Otherwise, we are parsing a user-defined constant - let const_attrs = body.call(Attribute::parse_outer)?; - body.parse::()?; - let const_name: Ident = body.parse()?; - body.parse::()?; - let const_val: Expr = body.parse()?; - try_comma()?; - consts.push(quote! { #(#const_attrs)* #vis const #const_name: #name = #name::from_u32(#const_val); }); + loop { + // We've parsed everything that the user provided, so we're done + if body.is_empty() { + break; } + + // Otherwise, we are parsing a user-defined constant + let const_attrs = body.call(Attribute::parse_outer)?; + body.parse::()?; + let const_name: Ident = body.parse()?; + body.parse::()?; + let const_val: Expr = body.parse()?; + body.parse::()?; + consts.push(quote! { #(#const_attrs)* #vis const #const_name: #name = #name::from_u32(#const_val); }); } let debug_format = diff --git a/compiler/rustc_middle/src/middle/region.rs b/compiler/rustc_middle/src/middle/region.rs index dfe71dc9257..94ca38c0e75 100644 --- a/compiler/rustc_middle/src/middle/region.rs +++ b/compiler/rustc_middle/src/middle/region.rs @@ -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` diff --git a/compiler/rustc_middle/src/mir/coverage.rs b/compiler/rustc_middle/src/mir/coverage.rs index 8806077175b..e7bb3ab0bc3 100644 --- a/compiler/rustc_middle/src/mir/coverage.rs +++ b/compiler/rustc_middle/src/mir/coverage.rs @@ -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 for ExpressionOperandId { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 6057fdcaebb..454cfc6e65b 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -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> { diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index 160e9691e69..a8a4532223c 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -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. diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index ad8f873bf9b..ac903010c8d 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -36,8 +36,7 @@ macro_rules! thir_with_elements { newtype_index! { #[derive(HashStable)] #[debug_format = $format] - pub struct $id { - } + pub struct $id {} } )* diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 3f22b0e5a9a..e13b68c83b5 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -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)] diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs index 8483b1745c7..136a4906c58 100644 --- a/compiler/rustc_middle/src/ty/typeck_results.rs +++ b/compiler/rustc_middle/src/ty/typeck_results.rs @@ -611,7 +611,7 @@ rustc_index::newtype_index! { #[derive(HashStable)] #[debug_format = "UserType({})"] pub struct UserTypeAnnotationIndex { - const START_INDEX = 0, + const START_INDEX = 0; } } diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 7af89dd472f..c785dfb500f 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -372,7 +372,7 @@ struct CFG<'tcx> { } rustc_index::newtype_index! { - struct ScopeId { .. } + struct ScopeId {} } #[derive(Debug)] diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index 33f49ffdaf6..c92634a609d 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -185,7 +185,7 @@ pub(crate) enum BreakableTarget { } rustc_index::newtype_index! { - struct DropIdx { .. } + struct DropIdx {} } const ROOT_NODE: DropIdx = DropIdx::from_u32(0); diff --git a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs index f286aff8420..9b053985bed 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs @@ -15,8 +15,7 @@ mod abs_domain; rustc_index::newtype_index! { #[debug_format = "mp{}"] - pub struct MovePathIndex { - } + pub struct MovePathIndex {} } impl polonius_engine::Atom for MovePathIndex { @@ -27,14 +26,12 @@ impl polonius_engine::Atom for MovePathIndex { rustc_index::newtype_index! { #[debug_format = "mo{}"] - pub struct MoveOutIndex { - } + pub struct MoveOutIndex {} } rustc_index::newtype_index! { #[debug_format = "in{}"] - pub struct InitIndex { - } + pub struct InitIndex {} } impl MoveOutIndex { diff --git a/compiler/rustc_mir_transform/src/coverage/graph.rs b/compiler/rustc_mir_transform/src/coverage/graph.rs index 40ed6ceb839..78d28f1ebab 100644 --- a/compiler/rustc_mir_transform/src/coverage/graph.rs +++ b/compiler/rustc_mir_transform/src/coverage/graph.rs @@ -284,7 +284,7 @@ rustc_index::newtype_index! { /// A node in the control-flow graph of CoverageGraph. #[debug_format = "bcb{}"] pub(super) struct BasicCoverageBlock { - const START_BCB = 0, + const START_BCB = 0; } } diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index bfbe65b5bfc..b49432b7996 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -109,14 +109,12 @@ mod rwu_table; rustc_index::newtype_index! { #[debug_format = "v({})"] - pub struct Variable { - } + pub struct Variable {} } rustc_index::newtype_index! { #[debug_format = "ln({})"] - pub struct LiveNode { - } + pub struct LiveNode {} } #[derive(Copy, Clone, PartialEq, Debug)] diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 0e7d628c1eb..52957ee0222 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -37,7 +37,7 @@ pub struct DepGraph { } rustc_index::newtype_index! { - pub struct DepNodeIndex { .. } + pub struct DepNodeIndex {} } impl DepNodeIndex { @@ -974,7 +974,7 @@ pub struct WorkProduct { // Index type for `DepNodeData`'s edges. rustc_index::newtype_index! { - struct EdgeIndex { .. } + struct EdgeIndex {} } /// `CurrentDepGraph` stores the dependency graph for the current session. It diff --git a/compiler/rustc_query_system/src/dep_graph/serialized.rs b/compiler/rustc_query_system/src/dep_graph/serialized.rs index fbc0aeb6c80..a918328d413 100644 --- a/compiler/rustc_query_system/src/dep_graph/serialized.rs +++ b/compiler/rustc_query_system/src/dep_graph/serialized.rs @@ -28,8 +28,7 @@ use smallvec::SmallVec; // and use those bits to encode which index type it contains. rustc_index::newtype_index! { #[max = 0x7FFF_FFFF] - pub struct SerializedDepNodeIndex { - } + pub struct SerializedDepNodeIndex {} } /// Data for use when recompiling the **current crate**. diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index 5d15757f1ab..221f65b66e6 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -12,8 +12,7 @@ use std::hash::{Hash, Hasher}; rustc_index::newtype_index! { #[custom_encodable] #[debug_format = "crate{}"] - pub struct CrateNum { - } + pub struct CrateNum {} } /// Item definitions in the currently-compiled crate would have the `CrateNum` @@ -199,7 +198,7 @@ rustc_index::newtype_index! { pub struct DefIndex { /// The crate root is always assigned index 0 by the AST Map code, /// thanks to `NodeCollector::new`. - const CRATE_DEF_INDEX = 0, + const CRATE_DEF_INDEX = 0; } } diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index f80b5d99df6..c2d8287f243 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -62,8 +62,7 @@ pub struct SyntaxContextData { rustc_index::newtype_index! { /// A unique ID associated with a macro invocation and expansion. #[custom_encodable] - pub struct ExpnIndex { - } + pub struct ExpnIndex {} } /// A unique ID associated with a macro invocation and expansion. @@ -85,8 +84,7 @@ rustc_index::newtype_index! { #[custom_encodable] #[no_ord_impl] #[debug_format = "expn{}"] - pub struct LocalExpnId { - } + pub struct LocalExpnId {} } // To ensure correctness of incremental compilation, diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index ace095736c9..8014ae9c511 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1801,7 +1801,7 @@ impl fmt::Display for MacroRulesNormalizedIdent { pub struct Symbol(SymbolIndex); rustc_index::newtype_index! { - struct SymbolIndex { .. } + struct SymbolIndex {} } impl Symbol { diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs index c60de3cb0b2..88a0a1f8ecf 100644 --- a/compiler/rustc_target/src/abi/mod.rs +++ b/compiler/rustc_target/src/abi/mod.rs @@ -21,8 +21,7 @@ impl ToJson for Endian { rustc_index::newtype_index! { #[derive(HashStable_Generic)] - pub struct VariantIdx { - } + pub struct VariantIdx {} } #[derive(Copy, Clone, PartialEq, Eq, Hash, HashStable_Generic)] diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index 5a6ee6721d3..dd36a5c7a21 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -303,7 +303,7 @@ rustc_index::newtype_index! { #[derive(HashStable_Generic)] #[debug_format = "DebruijnIndex({})"] pub struct DebruijnIndex { - const INNERMOST = 0, + const INNERMOST = 0; } } @@ -500,8 +500,7 @@ pub struct FloatVarValue(pub FloatTy); rustc_index::newtype_index! { /// A **ty**pe **v**ariable **ID**. #[debug_format = "_#{}t"] - pub struct TyVid { - } + pub struct TyVid {} } /// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**. @@ -789,8 +788,7 @@ rustc_index::newtype_index! { /// use for checking generic functions. #[derive(HashStable_Generic)] #[debug_format = "U{}"] - pub struct UniverseIndex { - } + pub struct UniverseIndex {} } impl UniverseIndex {