Skip to content

Commit fa42f86

Browse files
committed
Add optional ConstArg field to assoc consts in HIR
1 parent acd3ad9 commit fa42f86

File tree

16 files changed

+53
-47
lines changed

16 files changed

+53
-47
lines changed

compiler/rustc_ast_lowering/src/item.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
814814
let ty = this
815815
.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
816816
let body = expr.as_ref().map(|x| this.lower_const_body(i.span, Some(x)));
817-
818-
hir::TraitItemKind::Const(ty, body)
817+
// TODO: make const arg instead of always using None
818+
hir::TraitItemKind::Const(ty, body, None)
819819
},
820820
);
821821

@@ -1008,7 +1008,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
10081008
.lower_ty(ty, ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
10091009
let body = this.lower_const_body(i.span, expr.as_deref());
10101010
this.lower_define_opaque(hir_id, &define_opaque);
1011-
hir::ImplItemKind::Const(ty, body)
1011+
// TODO: make const arg instead of always using None
1012+
hir::ImplItemKind::Const(ty, body, None)
10121013
},
10131014
),
10141015
),

compiler/rustc_hir/src/hir.rs

+13-11
Original file line numberDiff line numberDiff line change
@@ -2973,8 +2973,8 @@ impl<'hir> TraitItem<'hir> {
29732973
}
29742974

29752975
expect_methods_self_kind! {
2976-
expect_const, (&'hir Ty<'hir>, Option<BodyId>),
2977-
TraitItemKind::Const(ty, body), (ty, *body);
2976+
expect_const, (&'hir Ty<'hir>, Option<BodyId>, Option<&'hir ConstArg<'hir>>),
2977+
TraitItemKind::Const(ty, body, ct), (ty, *body, *ct);
29782978

29792979
expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
29802980
TraitItemKind::Fn(ty, trfn), (ty, trfn);
@@ -2998,7 +2998,7 @@ pub enum TraitFn<'hir> {
29982998
#[derive(Debug, Clone, Copy, HashStable_Generic)]
29992999
pub enum TraitItemKind<'hir> {
30003000
/// An associated constant with an optional value (otherwise `impl`s must contain a value).
3001-
Const(&'hir Ty<'hir>, Option<BodyId>),
3001+
Const(&'hir Ty<'hir>, Option<BodyId>, Option<&'hir ConstArg<'hir>>),
30023002
/// An associated function with an optional body.
30033003
Fn(FnSig<'hir>, TraitFn<'hir>),
30043004
/// An associated type with (possibly empty) bounds and optional concrete
@@ -3048,7 +3048,7 @@ impl<'hir> ImplItem<'hir> {
30483048
}
30493049

30503050
expect_methods_self_kind! {
3051-
expect_const, (&'hir Ty<'hir>, BodyId), ImplItemKind::Const(ty, body), (ty, *body);
3051+
expect_const, (&'hir Ty<'hir>, BodyId, Option<&'hir ConstArg<'hir>>), ImplItemKind::Const(ty, body, ct), (ty, *body, *ct);
30523052
expect_fn, (&FnSig<'hir>, BodyId), ImplItemKind::Fn(ty, body), (ty, *body);
30533053
expect_type, &'hir Ty<'hir>, ImplItemKind::Type(ty), ty;
30543054
}
@@ -3059,7 +3059,7 @@ impl<'hir> ImplItem<'hir> {
30593059
pub enum ImplItemKind<'hir> {
30603060
/// An associated constant of the given type, set to the constant result
30613061
/// of the expression.
3062-
Const(&'hir Ty<'hir>, BodyId),
3062+
Const(&'hir Ty<'hir>, BodyId, Option<&'hir ConstArg<'hir>>),
30633063
/// An associated function implementation with the given signature and body.
30643064
Fn(FnSig<'hir>, BodyId),
30653065
/// An associated type.
@@ -4461,11 +4461,12 @@ impl<'hir> OwnerNode<'hir> {
44614461
})
44624462
| OwnerNode::TraitItem(TraitItem {
44634463
kind:
4464-
TraitItemKind::Fn(_, TraitFn::Provided(body)) | TraitItemKind::Const(_, Some(body)),
4464+
TraitItemKind::Fn(_, TraitFn::Provided(body))
4465+
| TraitItemKind::Const(_, Some(body), _),
44654466
..
44664467
})
44674468
| OwnerNode::ImplItem(ImplItem {
4468-
kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, body),
4469+
kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, body, _),
44694470
..
44704471
}) => Some(*body),
44714472
_ => None,
@@ -4686,12 +4687,12 @@ impl<'hir> Node<'hir> {
46864687
_ => None,
46874688
},
46884689
Node::TraitItem(it) => match it.kind {
4689-
TraitItemKind::Const(ty, _) => Some(ty),
4690+
TraitItemKind::Const(ty, _, _) => Some(ty),
46904691
TraitItemKind::Type(_, ty) => ty,
46914692
_ => None,
46924693
},
46934694
Node::ImplItem(it) => match it.kind {
4694-
ImplItemKind::Const(ty, _) => Some(ty),
4695+
ImplItemKind::Const(ty, _, _) => Some(ty),
46954696
ImplItemKind::Type(ty) => Some(ty),
46964697
_ => None,
46974698
},
@@ -4720,12 +4721,13 @@ impl<'hir> Node<'hir> {
47204721
| Node::TraitItem(TraitItem {
47214722
owner_id,
47224723
kind:
4723-
TraitItemKind::Const(_, Some(body)) | TraitItemKind::Fn(_, TraitFn::Provided(body)),
4724+
TraitItemKind::Const(_, Some(body), _)
4725+
| TraitItemKind::Fn(_, TraitFn::Provided(body)),
47244726
..
47254727
})
47264728
| Node::ImplItem(ImplItem {
47274729
owner_id,
4728-
kind: ImplItemKind::Const(_, body) | ImplItemKind::Fn(_, body),
4730+
kind: ImplItemKind::Const(_, body, _) | ImplItemKind::Fn(_, body),
47294731
..
47304732
}) => Some((owner_id.def_id, *body)),
47314733

compiler/rustc_hir/src/intravisit.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1166,9 +1166,10 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
11661166
try_visit!(visitor.visit_defaultness(&defaultness));
11671167
try_visit!(visitor.visit_id(hir_id));
11681168
match *kind {
1169-
TraitItemKind::Const(ref ty, default) => {
1169+
TraitItemKind::Const(ref ty, default, ct_arg) => {
11701170
try_visit!(visitor.visit_ty_unambig(ty));
11711171
visit_opt!(visitor, visit_nested_body, default);
1172+
visit_opt!(visitor, visit_const_arg_unambig, ct_arg);
11721173
}
11731174
TraitItemKind::Fn(ref sig, TraitFn::Required(param_names)) => {
11741175
try_visit!(visitor.visit_fn_decl(sig.decl));
@@ -1224,9 +1225,11 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(
12241225
try_visit!(visitor.visit_defaultness(defaultness));
12251226
try_visit!(visitor.visit_id(impl_item.hir_id()));
12261227
match *kind {
1227-
ImplItemKind::Const(ref ty, body) => {
1228+
ImplItemKind::Const(ref ty, body, ct_arg) => {
12281229
try_visit!(visitor.visit_ty_unambig(ty));
1229-
visitor.visit_nested_body(body)
1230+
try_visit!(visitor.visit_nested_body(body));
1231+
visit_opt!(visitor, visit_const_arg_unambig, ct_arg);
1232+
V::Result::output()
12301233
}
12311234
ImplItemKind::Fn(ref sig, body_id) => visitor.visit_fn(
12321235
FnKind::Method(impl_item.ident, sig),

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ fn compare_const_predicate_entailment<'tcx>(
18601860
debug!(?impl_ty, ?trait_ty);
18611861

18621862
// Locate the Span containing just the type of the offending impl
1863-
let (ty, _) = tcx.hir_expect_impl_item(impl_ct_def_id).expect_const();
1863+
let (ty, ..) = tcx.hir_expect_impl_item(impl_ct_def_id).expect_const();
18641864
cause.span = ty.span;
18651865

18661866
let mut diag = struct_span_code_err!(
@@ -1873,7 +1873,7 @@ fn compare_const_predicate_entailment<'tcx>(
18731873

18741874
let trait_c_span = trait_ct.def_id.as_local().map(|trait_ct_def_id| {
18751875
// Add a label to the Span containing just the type of the const
1876-
let (ty, _) = tcx.hir_expect_trait_item(trait_ct_def_id).expect_const();
1876+
let (ty, ..) = tcx.hir_expect_trait_item(trait_ct_def_id).expect_const();
18771877
ty.span
18781878
});
18791879

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ fn check_dyn_incompatible_self_trait_by_name(tcx: TyCtxt<'_>, item: &hir::TraitI
834834
};
835835
let mut trait_should_be_self = vec![];
836836
match &item.kind {
837-
hir::TraitItemKind::Const(ty, _) | hir::TraitItemKind::Type(_, Some(ty))
837+
hir::TraitItemKind::Const(ty, ..) | hir::TraitItemKind::Type(_, Some(ty))
838838
if could_be_self(trait_def_id.def_id, ty) =>
839839
{
840840
trait_should_be_self.push(ty.span)

compiler/rustc_hir_analysis/src/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ fn lower_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::TraitItemId) {
799799
tcx.ensure_ok().fn_sig(def_id);
800800
}
801801

802-
hir::TraitItemKind::Const(ty, body_id) => {
802+
hir::TraitItemKind::Const(ty, body_id, _ct) => {
803803
tcx.ensure_ok().type_of(def_id);
804804
if !tcx.dcx().has_stashed_diagnostic(ty.span, StashKey::ItemNoType)
805805
&& !(ty.is_suggestable_infer_ty() && body_id.is_some())
@@ -883,7 +883,7 @@ fn lower_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) {
883883
"associated type",
884884
);
885885
}
886-
hir::ImplItemKind::Const(ty, _) => {
886+
hir::ImplItemKind::Const(ty, ..) => {
887887
// Account for `const T: _ = ..;`
888888
if !ty.is_suggestable_infer_ty() {
889889
let mut visitor = HirPlaceholderCollector::default();

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
628628
intravisit::walk_item(self, item);
629629
}
630630
hir::ItemKind::TyAlias(_, _, generics)
631-
| hir::ItemKind::Const(_, _, generics,_, _)
631+
| hir::ItemKind::Const(_, _, generics, _, _)
632632
| hir::ItemKind::Enum(_, _, generics)
633633
| hir::ItemKind::Struct(_, _, generics)
634634
| hir::ItemKind::Union(_, _, generics)
@@ -848,7 +848,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
848848
}
849849
})
850850
}
851-
Const(_, _) => self.visit_early(trait_item.hir_id(), trait_item.generics, |this| {
851+
Const(_, _, _) => self.visit_early(trait_item.hir_id(), trait_item.generics, |this| {
852852
intravisit::walk_trait_item(this, trait_item)
853853
}),
854854
}
@@ -865,7 +865,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
865865
this.visit_generics(impl_item.generics);
866866
this.visit_ty_unambig(ty);
867867
}),
868-
Const(_, _) => self.visit_early(impl_item.hir_id(), impl_item.generics, |this| {
868+
Const(_, _, _) => self.visit_early(impl_item.hir_id(), impl_item.generics, |this| {
869869
intravisit::walk_impl_item(this, impl_item)
870870
}),
871871
}

compiler/rustc_hir_analysis/src/collect/type_of.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
153153
let args = ty::GenericArgs::identity_for_item(tcx, def_id);
154154
Ty::new_fn_def(tcx, def_id.to_def_id(), args)
155155
}
156-
TraitItemKind::Const(ty, body_id) => body_id
156+
TraitItemKind::Const(ty, body_id, _) => body_id
157157
.and_then(|body_id| {
158158
ty.is_suggestable_infer_ty().then(|| {
159159
infer_placeholder_type(
@@ -178,7 +178,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
178178
let args = ty::GenericArgs::identity_for_item(tcx, def_id);
179179
Ty::new_fn_def(tcx, def_id.to_def_id(), args)
180180
}
181-
ImplItemKind::Const(ty, body_id) => {
181+
ImplItemKind::Const(ty, body_id,_) => {
182182
if ty.is_suggestable_infer_ty() {
183183
infer_placeholder_type(
184184
icx.lowerer(),
@@ -216,7 +216,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_
216216
icx.lower_ty(ty)
217217
}
218218
}
219-
ItemKind::Const(ident, ty, _, body_id,_) => {
219+
ItemKind::Const(ident, ty, _, body_id, _) => {
220220
if ty.is_suggestable_infer_ty() {
221221
infer_placeholder_type(
222222
icx.lowerer(),

compiler/rustc_hir_analysis/src/hir_wf_check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ fn diagnostic_hir_wf_check<'tcx>(
127127
WellFormedLoc::Ty(_) => match tcx.hir_node(hir_id) {
128128
hir::Node::ImplItem(item) => match item.kind {
129129
hir::ImplItemKind::Type(ty) => vec![ty],
130-
hir::ImplItemKind::Const(ty, _) => vec![ty],
130+
hir::ImplItemKind::Const(ty, _,_) => vec![ty],
131131
ref item => bug!("Unexpected ImplItem {:?}", item),
132132
},
133133
hir::Node::TraitItem(item) => match item.kind {
134134
hir::TraitItemKind::Type(_, ty) => ty.into_iter().collect(),
135-
hir::TraitItemKind::Const(ty, _) => vec![ty],
135+
hir::TraitItemKind::Const(ty, _,_) => vec![ty],
136136
ref item => bug!("Unexpected TraitItem {:?}", item),
137137
},
138138
hir::Node::Item(item) => match item.kind {

compiler/rustc_hir_pretty/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ impl<'a> State<'a> {
911911
self.maybe_print_comment(ti.span.lo());
912912
self.print_attrs_as_outer(self.attrs(ti.hir_id()));
913913
match ti.kind {
914-
hir::TraitItemKind::Const(ty, default) => {
914+
hir::TraitItemKind::Const(ty, default, _ct) => {
915915
self.print_associated_const(ti.ident, ti.generics, ty, default);
916916
}
917917
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Required(arg_names)) => {
@@ -940,7 +940,7 @@ impl<'a> State<'a> {
940940
self.print_attrs_as_outer(self.attrs(ii.hir_id()));
941941

942942
match ii.kind {
943-
hir::ImplItemKind::Const(ty, expr) => {
943+
hir::ImplItemKind::Const(ty, expr, _ct) => {
944944
self.print_associated_const(ii.ident, ii.generics, ty, Some(expr));
945945
}
946946
hir::ImplItemKind::Fn(ref sig, body) => {

compiler/rustc_mir_build/src/builder/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,9 @@ fn construct_const<'a, 'tcx>(
567567
span,
568568
..
569569
})
570-
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, _), span, .. })
570+
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, _,_), span, .. })
571571
| Node::TraitItem(hir::TraitItem {
572-
kind: hir::TraitItemKind::Const(ty, Some(_)),
572+
kind: hir::TraitItemKind::Const(ty, Some(_),_),
573573
span,
574574
..
575575
}) => (*span, ty.span),

compiler/rustc_passes/src/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ fn check_trait_item(
826826
use hir::TraitItemKind::{Const, Fn};
827827
if matches!(tcx.def_kind(id.owner_id), DefKind::AssocConst | DefKind::AssocFn) {
828828
let trait_item = tcx.hir_trait_item(id);
829-
if matches!(trait_item.kind, Const(_, Some(_)) | Fn(..))
829+
if matches!(trait_item.kind, Const(_, Some(_), _) | Fn(..))
830830
&& let Some(comes_from_allow) =
831831
has_allow_dead_code_or_lang_attr(tcx, trait_item.owner_id.def_id)
832832
{

compiler/rustc_passes/src/reachable.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'tcx> ReachableContext<'tcx> {
145145
_ => false,
146146
},
147147
Node::TraitItem(trait_method) => match trait_method.kind {
148-
hir::TraitItemKind::Const(_, ref default) => default.is_some(),
148+
hir::TraitItemKind::Const(_, ref default, _) => default.is_some(),
149149
hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => true,
150150
hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_))
151151
| hir::TraitItemKind::Type(..) => false,
@@ -249,19 +249,19 @@ impl<'tcx> ReachableContext<'tcx> {
249249
}
250250
Node::TraitItem(trait_method) => {
251251
match trait_method.kind {
252-
hir::TraitItemKind::Const(_, None)
252+
hir::TraitItemKind::Const(_, None, _)
253253
| hir::TraitItemKind::Fn(_, hir::TraitFn::Required(_)) => {
254254
// Keep going, nothing to get exported
255255
}
256-
hir::TraitItemKind::Const(_, Some(body_id))
256+
hir::TraitItemKind::Const(_, Some(body_id), _)
257257
| hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(body_id)) => {
258258
self.visit_nested_body(body_id);
259259
}
260260
hir::TraitItemKind::Type(..) => {}
261261
}
262262
}
263263
Node::ImplItem(impl_item) => match impl_item.kind {
264-
hir::ImplItemKind::Const(_, body) => {
264+
hir::ImplItemKind::Const(_, body, _) => {
265265
self.visit_nested_body(body);
266266
}
267267
hir::ImplItemKind::Fn(_, body) => {

src/librustdoc/clean/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1255,14 +1255,14 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
12551255
let local_did = trait_item.owner_id.to_def_id();
12561256
cx.with_param_env(local_did, |cx| {
12571257
let inner = match trait_item.kind {
1258-
hir::TraitItemKind::Const(ty, Some(default)) => {
1258+
hir::TraitItemKind::Const(ty, Some(default), _) => {
12591259
ProvidedAssocConstItem(Box::new(Constant {
12601260
generics: enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx)),
12611261
kind: ConstantKind::Local { def_id: local_did, body: default },
12621262
type_: clean_ty(ty, cx),
12631263
}))
12641264
}
1265-
hir::TraitItemKind::Const(ty, None) => {
1265+
hir::TraitItemKind::Const(ty, None, _) => {
12661266
let generics = enter_impl_trait(cx, |cx| clean_generics(trait_item.generics, cx));
12671267
RequiredAssocConstItem(generics, Box::new(clean_ty(ty, cx)))
12681268
}
@@ -1306,7 +1306,7 @@ pub(crate) fn clean_impl_item<'tcx>(
13061306
let local_did = impl_.owner_id.to_def_id();
13071307
cx.with_param_env(local_did, |cx| {
13081308
let inner = match impl_.kind {
1309-
hir::ImplItemKind::Const(ty, expr) => ImplAssocConstItem(Box::new(Constant {
1309+
hir::ImplItemKind::Const(ty, expr, _) => ImplAssocConstItem(Box::new(Constant {
13101310
generics: clean_generics(impl_.generics, cx),
13111311
kind: ConstantKind::Local { def_id: local_did, body: expr },
13121312
type_: clean_ty(ty, cx),

src/tools/clippy/clippy_lints/src/non_copy_const.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl<'tcx> NonCopyConst<'tcx> {
310310

311311
impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> {
312312
fn check_item(&mut self, cx: &LateContext<'tcx>, it: &'tcx Item<'_>) {
313-
if let ItemKind::Const(.., body_id,_) = it.kind {
313+
if let ItemKind::Const(.., body_id, _) = it.kind {
314314
let ty = cx.tcx.type_of(it.owner_id).instantiate_identity();
315315
if !ignored_macro(cx, it)
316316
&& self.interior_mut.is_interior_mut_ty(cx, ty)
@@ -322,7 +322,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> {
322322
}
323323

324324
fn check_trait_item(&mut self, cx: &LateContext<'tcx>, trait_item: &'tcx TraitItem<'_>) {
325-
if let TraitItemKind::Const(_, body_id_opt) = &trait_item.kind {
325+
if let TraitItemKind::Const(_, body_id_opt, _) = &trait_item.kind {
326326
let ty = cx.tcx.type_of(trait_item.owner_id).instantiate_identity();
327327

328328
// Normalize assoc types because ones originated from generic params
@@ -349,7 +349,7 @@ impl<'tcx> LateLintPass<'tcx> for NonCopyConst<'tcx> {
349349
}
350350

351351
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
352-
if let ImplItemKind::Const(_, body_id) = &impl_item.kind {
352+
if let ImplItemKind::Const(_, body_id, _) = &impl_item.kind {
353353
let item_def_id = cx.tcx.hir_get_parent_item(impl_item.hir_id()).def_id;
354354
let item = cx.tcx.hir_expect_item(item_def_id);
355355

src/tools/clippy/clippy_lints/src/types/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
462462

463463
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'tcx>) {
464464
match item.kind {
465-
ImplItemKind::Const(ty, _) => {
465+
ImplItemKind::Const(ty, _, _) => {
466466
let is_in_trait_impl = if let hir::Node::Item(item) = cx
467467
.tcx
468468
.hir_node_by_def_id(cx.tcx.hir_get_parent_item(item.hir_id()).def_id)
@@ -514,7 +514,7 @@ impl<'tcx> LateLintPass<'tcx> for Types {
514514
};
515515

516516
match item.kind {
517-
TraitItemKind::Const(ty, _) | TraitItemKind::Type(_, Some(ty)) => {
517+
TraitItemKind::Const(ty, _, _) | TraitItemKind::Type(_, Some(ty)) => {
518518
self.check_ty(cx, ty, context);
519519
},
520520
TraitItemKind::Fn(ref sig, trait_method) => {

0 commit comments

Comments
 (0)