Skip to content

Commit e6a7e81

Browse files
committed
yeet braces from DefKind::Const
1 parent ca54675 commit e6a7e81

78 files changed

Lines changed: 227 additions & 276 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎compiler/rustc_ast_lowering/src/path.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
113113
}
114114
// `a::b::Trait(Args)::TraitItem`
115115
Res::Def(DefKind::AssocFn, _)
116-
| Res::Def(DefKind::AssocConst { .. }, _)
116+
| Res::Def(DefKind::AssocConst, _)
117117
| Res::Def(DefKind::AssocTy, _)
118118
if i + 2 == proj_start =>
119119
{

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,10 +1271,7 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
12711271
let hir::ExprKind::Path(hir::QPath::Resolved(None, path)) = base.kind else { return };
12721272
let (hir::def::Res::Local(_)
12731273
| hir::def::Res::Def(
1274-
DefKind::Const { .. }
1275-
| DefKind::ConstParam
1276-
| DefKind::Static { .. }
1277-
| DefKind::AssocConst { .. },
1274+
DefKind::Const | DefKind::ConstParam | DefKind::Static { .. } | DefKind::AssocConst,
12781275
_,
12791276
)) = path.res
12801277
else {

‎compiler/rustc_borrowck/src/implied_bounds.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub(super) fn mir_borrowck_implied_outlives_bounds<'tcx>(
9090
// - We must compute the normalized signature and then compute implied bounds from that
9191
// in order to connect any unconstrained region vars created during normalization to
9292
// the types of the locals corresponding to the inputs and outputs of the item. #136547
93-
if matches!(tcx.def_kind(body_def_id), DefKind::AssocFn | DefKind::AssocConst { .. }) {
93+
if matches!(tcx.def_kind(body_def_id), DefKind::AssocFn | DefKind::AssocConst) {
9494
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(body_def_id)) {
9595
let normalized_ty = ocx
9696
.deeply_normalize(

‎compiler/rustc_borrowck/src/type_check/free_region_relations.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
296296
// - We must compute the normalized signature and then compute implied bounds from that
297297
// in order to connect any unconstrained region vars created during normalization to
298298
// the types of the locals corresponding to the inputs and outputs of the item. (#136547)
299-
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst { .. })
300-
{
299+
if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
301300
for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
302301
let result: Result<_, ErrorGuaranteed> = self
303302
.infcx

‎compiler/rustc_const_eval/src/const_eval/eval_queries.rs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ fn setup_for_eval<'tcx>(
6161
cid.promoted.is_some()
6262
|| matches!(
6363
ecx.tcx.def_kind(cid.instance.def_id()),
64-
DefKind::Const { .. }
64+
DefKind::Const
6565
| DefKind::Static { .. }
6666
| DefKind::ConstParam
6767
| DefKind::AnonConst
68-
| DefKind::AssocConst { .. }
68+
| DefKind::AssocConst
6969
),
7070
"Unexpected DefKind: {:?}",
7171
ecx.tcx.def_kind(cid.instance.def_id())
@@ -441,9 +441,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
441441
) -> Result<R, ErrorHandled> {
442442
let def = cid.instance.def.def_id();
443443
// directly represented consts don't have bodies
444-
if cfg!(debug_assertions)
445-
&& matches!(tcx.def_kind(def), DefKind::Const { .. } | DefKind::AssocConst { .. })
446-
{
444+
if cfg!(debug_assertions) && matches!(tcx.def_kind(def), DefKind::Const | DefKind::AssocConst) {
447445
debug_assert!(
448446
tcx.const_of_item(def).is_none(),
449447
"CTFE tried to evaluate directly represented const item: {def:?}"

‎compiler/rustc_hir/src/def.rs‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ impl DefKind {
227227
DefKind::Trait => "trait",
228228
DefKind::ForeignTy => "foreign type",
229229
DefKind::AssocFn => "associated function",
230-
DefKind::Const { .. } => "constant",
231-
DefKind::AssocConst { .. } => "associated constant",
230+
DefKind::Const => "constant",
231+
DefKind::AssocConst => "associated constant",
232232
DefKind::TyParam => "type parameter",
233233
DefKind::ConstParam => "const parameter",
234234
DefKind::Macro(kinds) => kinds.descr(),
@@ -254,7 +254,7 @@ impl DefKind {
254254
pub fn article(&self) -> &'static str {
255255
match *self {
256256
DefKind::AssocTy
257-
| DefKind::AssocConst { .. }
257+
| DefKind::AssocConst
258258
| DefKind::AssocFn
259259
| DefKind::Enum
260260
| DefKind::OpaqueTy
@@ -281,12 +281,12 @@ impl DefKind {
281281
| DefKind::TyParam => Some(Namespace::TypeNS),
282282

283283
DefKind::Fn
284-
| DefKind::Const { .. }
284+
| DefKind::Const
285285
| DefKind::ConstParam
286286
| DefKind::Static { .. }
287287
| DefKind::Ctor(..)
288288
| DefKind::AssocFn
289-
| DefKind::AssocConst { .. } => Some(Namespace::ValueNS),
289+
| DefKind::AssocConst => Some(Namespace::ValueNS),
290290

291291
DefKind::Macro(..) => Some(Namespace::MacroNS),
292292

@@ -327,11 +327,11 @@ impl DefKind {
327327
DefKind::AssocTy => DefPathData::TypeNs(name.unwrap()),
328328

329329
DefKind::Fn
330-
| DefKind::Const { .. }
330+
| DefKind::Const
331331
| DefKind::ConstParam
332332
| DefKind::Static { .. }
333333
| DefKind::AssocFn
334-
| DefKind::AssocConst { .. }
334+
| DefKind::AssocConst
335335
| DefKind::Field => DefPathData::ValueNs(name.unwrap()),
336336
DefKind::Macro(..) => DefPathData::MacroNs(name.unwrap()),
337337
DefKind::LifetimeParam => DefPathData::LifetimeNs(name.unwrap()),
@@ -349,7 +349,7 @@ impl DefKind {
349349
}
350350

351351
pub fn is_assoc(self) -> bool {
352-
matches!(self, DefKind::AssocConst { .. } | DefKind::AssocFn | DefKind::AssocTy)
352+
matches!(self, DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy)
353353
}
354354

355355
/// This is a "module" in name resolution sense.
@@ -375,11 +375,11 @@ impl DefKind {
375375
pub fn has_generics(self) -> bool {
376376
match self {
377377
DefKind::AnonConst
378-
| DefKind::AssocConst { .. }
378+
| DefKind::AssocConst
379379
| DefKind::AssocFn
380380
| DefKind::AssocTy
381381
| DefKind::Closure
382-
| DefKind::Const { .. }
382+
| DefKind::Const
383383
| DefKind::Ctor(..)
384384
| DefKind::Enum
385385
| DefKind::Field
@@ -427,8 +427,8 @@ impl DefKind {
427427
| DefKind::ForeignTy
428428
| DefKind::TraitAlias
429429
| DefKind::AssocTy
430-
| DefKind::Const { .. }
431-
| DefKind::AssocConst { .. }
430+
| DefKind::Const
431+
| DefKind::AssocConst
432432
| DefKind::Macro(..)
433433
| DefKind::Use
434434
| DefKind::ForeignMod

‎compiler/rustc_hir/src/target_impls.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl From<DefKind> for Target {
5454
DefKind::ExternCrate => Target::ExternCrate,
5555
DefKind::Use => Target::Use,
5656
DefKind::Static { .. } => Target::Static,
57-
DefKind::Const { .. } => Target::Const,
57+
DefKind::Const => Target::Const,
5858
DefKind::Fn => Target::Fn,
5959
DefKind::Macro(..) => Target::MacroDef,
6060
DefKind::Mod => Target::Mod,

‎compiler/rustc_hir_analysis/src/check/check.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
938938
// avoids this query from having a direct dependency edge on the HIR
939939
return res;
940940
}
941-
DefKind::Const { .. } => {
941+
DefKind::Const => {
942942
tcx.ensure_ok().generics_of(def_id);
943943
tcx.ensure_ok().type_of(def_id);
944944
tcx.ensure_ok().clauses_of(def_id);
@@ -1122,7 +1122,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
11221122
// avoids this query from having a direct dependency edge on the HIR
11231123
return res;
11241124
}
1125-
DefKind::AssocConst { .. } => {
1125+
DefKind::AssocConst => {
11261126
tcx.ensure_ok().type_of(def_id);
11271127
tcx.ensure_ok().clauses_of(def_id);
11281128
res = res.and(check_associated_item(tcx, def_id));

‎compiler/rustc_hir_analysis/src/check/wfcheck.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,12 +2564,12 @@ fn lint_redundant_lifetimes<'tcx>(
25642564
| DefKind::Trait
25652565
| DefKind::TraitAlias
25662566
| DefKind::Fn
2567-
| DefKind::Const { .. }
2567+
| DefKind::Const
25682568
| DefKind::Impl { of_trait: _ }
25692569
| DefKind::TestBinderConstraints => {
25702570
// Proceed
25712571
}
2572-
DefKind::AssocFn | DefKind::AssocTy | DefKind::AssocConst { .. } => {
2572+
DefKind::AssocFn | DefKind::AssocTy | DefKind::AssocConst => {
25732573
if tcx.trait_impl_of_assoc(owner_id.to_def_id()).is_some() {
25742574
// Don't check for redundant lifetimes for associated items of trait
25752575
// implementations, since the signature is required to be compatible

‎compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,10 +2051,10 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
20512051
_ => None,
20522052
},
20532053
DefKind::AnonConst
2054-
| DefKind::AssocConst { .. }
2054+
| DefKind::AssocConst
20552055
| DefKind::AssocFn
20562056
| DefKind::Closure
2057-
| DefKind::Const { .. }
2057+
| DefKind::Const
20582058
| DefKind::ConstParam
20592059
| DefKind::Ctor(..)
20602060
| DefKind::ExternCrate

0 commit comments

Comments
 (0)