Skip to content

Commit ea75178

Browse files
committed
separate definitions and HIR owners
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
1 parent de8a1dd commit ea75178

Some content is hidden

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

43 files changed

+85
-85
lines changed

clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ fn walk_parents<'tcx>(
704704
span,
705705
..
706706
}) if span.ctxt() == ctxt => {
707-
let ty = cx.tcx.type_of(def_id);
707+
let ty = cx.tcx.type_of(def_id.def_id);
708708
Some(ty_auto_deref_stability(cx, ty, precedence).position_for_result(cx))
709709
},
710710

clippy_lints/src/doc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
233233
let body = cx.tcx.hir().body(body_id);
234234
let mut fpu = FindPanicUnwrap {
235235
cx,
236-
typeck_results: cx.tcx.typeck(item.def_id),
236+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
237237
panic_span: None,
238238
};
239239
fpu.visit_expr(body.value);
240-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
240+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
241241
}
242242
},
243243
hir::ItemKind::Impl(impl_) => {
@@ -268,7 +268,7 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
268268
let headers = check_attrs(cx, &self.valid_idents, attrs);
269269
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
270270
if !in_external_macro(cx.tcx.sess, item.span) {
271-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, None, None);
271+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, None, None);
272272
}
273273
}
274274
}
@@ -283,11 +283,11 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
283283
let body = cx.tcx.hir().body(body_id);
284284
let mut fpu = FindPanicUnwrap {
285285
cx,
286-
typeck_results: cx.tcx.typeck(item.def_id),
286+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
287287
panic_span: None,
288288
};
289289
fpu.visit_expr(body.value);
290-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
290+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
291291
}
292292
}
293293
}

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl LateLintPass<'_> for EnumVariantNames {
297297
}
298298
}
299299
if let ItemKind::Enum(ref def, _) = item.kind {
300-
if !(self.avoid_breaking_exported_api && cx.access_levels.is_exported(item.def_id)) {
300+
if !(self.avoid_breaking_exported_api && cx.access_levels.is_exported(item.def_id.def_id)) {
301301
check_variant(cx, self.threshold, def, item_name, item.span);
302302
}
303303
}

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
7171
}
7272
}
7373

74-
let parent_id = cx.tcx.hir().get_parent_item(hir_id);
74+
let parent_id = cx.tcx.hir().get_parent_item(hir_id).def_id;
7575
let parent_node = cx.tcx.hir().find_by_def_id(parent_id);
7676

7777
let mut trait_self_ty = None;

clippy_lints/src/exhaustive_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl LateLintPass<'_> for ExhaustiveItems {
7373
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
7474
if_chain! {
7575
if let ItemKind::Enum(..) | ItemKind::Struct(..) = item.kind;
76-
if cx.access_levels.is_exported(item.def_id);
76+
if cx.access_levels.is_exported(item.def_id.def_id);
7777
let attrs = cx.tcx.hir().attrs(item.hir_id());
7878
if !attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
7979
then {

clippy_lints/src/exit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'tcx> LateLintPass<'tcx> for Exit {
3333
if let ExprKind::Path(ref path) = path_expr.kind;
3434
if let Some(def_id) = cx.qpath_res(path, path_expr.hir_id).opt_def_id();
3535
if match_def_path(cx, def_id, &paths::EXIT);
36-
let parent = cx.tcx.hir().get_parent_item(e.hir_id);
36+
let parent = cx.tcx.hir().get_parent_item(e.hir_id).def_id;
3737
if let Some(Node::Item(Item{kind: ItemKind::Fn(..), ..})) = cx.tcx.hir().find_by_def_id(parent);
3838
// If the next item up is a function we check if it is an entry point
3939
// and only then emit a linter warning

clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn lint_impl_body<'tcx>(cx: &LateContext<'tcx>, impl_span: Span, impl_items: &[h
107107
let body = cx.tcx.hir().body(body_id);
108108
let mut fpu = FindPanicUnwrap {
109109
lcx: cx,
110-
typeck_results: cx.tcx.typeck(impl_item.id.def_id),
110+
typeck_results: cx.tcx.typeck(impl_item.id.def_id.def_id),
111111
result: Vec::new(),
112112
};
113113
fpu.visit_expr(body.value);

clippy_lints/src/functions/must_use.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
2121
let attrs = cx.tcx.hir().attrs(item.hir_id());
2222
let attr = cx.tcx.get_attr(item.def_id.to_def_id(), sym::must_use);
2323
if let hir::ItemKind::Fn(ref sig, _generics, ref body_id) = item.kind {
24-
let is_public = cx.access_levels.is_exported(item.def_id);
24+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
2525
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
2626
if let Some(attr) = attr {
2727
check_needless_must_use(cx, sig.decl, item.hir_id(), item.span, fn_header_span, attr);
@@ -31,7 +31,7 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
3131
sig.decl,
3232
cx.tcx.hir().body(*body_id),
3333
item.span,
34-
item.def_id,
34+
item.def_id.def_id,
3535
item.span.with_hi(sig.decl.output.span().hi()),
3636
"this function could have a `#[must_use]` attribute",
3737
);
@@ -41,19 +41,19 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Item<'_>
4141

4242
pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::ImplItem<'_>) {
4343
if let hir::ImplItemKind::Fn(ref sig, ref body_id) = item.kind {
44-
let is_public = cx.access_levels.is_exported(item.def_id);
44+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
4545
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4646
let attrs = cx.tcx.hir().attrs(item.hir_id());
4747
let attr = cx.tcx.get_attr(item.def_id.to_def_id(), sym::must_use);
4848
if let Some(attr) = attr {
4949
check_needless_must_use(cx, sig.decl, item.hir_id(), item.span, fn_header_span, attr);
50-
} else if is_public && !is_proc_macro(cx.sess(), attrs) && trait_ref_of_method(cx, item.def_id).is_none() {
50+
} else if is_public && !is_proc_macro(cx.sess(), attrs) && trait_ref_of_method(cx, item.def_id.def_id).is_none() {
5151
check_must_use_candidate(
5252
cx,
5353
sig.decl,
5454
cx.tcx.hir().body(*body_id),
5555
item.span,
56-
item.def_id,
56+
item.def_id.def_id,
5757
item.span.with_hi(sig.decl.output.span().hi()),
5858
"this method could have a `#[must_use]` attribute",
5959
);
@@ -63,7 +63,7 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Imp
6363

6464
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) {
6565
if let hir::TraitItemKind::Fn(ref sig, ref eid) = item.kind {
66-
let is_public = cx.access_levels.is_exported(item.def_id);
66+
let is_public = cx.access_levels.is_exported(item.def_id.def_id);
6767
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
6868

6969
let attrs = cx.tcx.hir().attrs(item.hir_id());
@@ -78,7 +78,7 @@ pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::Tr
7878
sig.decl,
7979
body,
8080
item.span,
81-
item.def_id,
81+
item.def_id.def_id,
8282
item.span.with_hi(sig.decl.output.span().hi()),
8383
"this method could have a `#[must_use]` attribute",
8484
);
@@ -171,7 +171,7 @@ fn is_mutable_pat(cx: &LateContext<'_>, pat: &hir::Pat<'_>, tys: &mut DefIdSet)
171171
return false; // ignore `_` patterns
172172
}
173173
if cx.tcx.has_typeck_results(pat.hir_id.owner.to_def_id()) {
174-
is_mutable_ty(cx, cx.tcx.typeck(pat.hir_id.owner).pat_ty(pat), pat.span, tys)
174+
is_mutable_ty(cx, cx.tcx.typeck(pat.hir_id.owner.def_id).pat_ty(pat), pat.span, tys)
175175
} else {
176176
false
177177
}
@@ -218,7 +218,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
218218
if self.cx.tcx.has_typeck_results(arg.hir_id.owner.to_def_id())
219219
&& is_mutable_ty(
220220
self.cx,
221-
self.cx.tcx.typeck(arg.hir_id.owner).expr_ty(arg),
221+
self.cx.tcx.typeck(arg.hir_id.owner.def_id).expr_ty(arg),
222222
arg.span,
223223
&mut tys,
224224
)
@@ -236,7 +236,7 @@ impl<'a, 'tcx> intravisit::Visitor<'tcx> for StaticMutVisitor<'a, 'tcx> {
236236
if self.cx.tcx.has_typeck_results(arg.hir_id.owner.to_def_id())
237237
&& is_mutable_ty(
238238
self.cx,
239-
self.cx.tcx.typeck(arg.hir_id.owner).expr_ty(arg),
239+
self.cx.tcx.typeck(arg.hir_id.owner.def_id).expr_ty(arg),
240240
arg.span,
241241
&mut tys,
242242
)

clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(super) fn check_fn<'tcx>(
2828
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &'tcx hir::TraitItem<'_>) {
2929
if let hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(eid)) = item.kind {
3030
let body = cx.tcx.hir().body(eid);
31-
check_raw_ptr(cx, sig.header.unsafety, sig.decl, body, item.def_id);
31+
check_raw_ptr(cx, sig.header.unsafety, sig.decl, body, item.def_id.def_id);
3232
}
3333
}
3434

clippy_lints/src/functions/result.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ fn result_err_ty<'tcx>(
3434

3535
pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::Item<'tcx>, large_err_threshold: u64) {
3636
if let hir::ItemKind::Fn(ref sig, _generics, _) = item.kind
37-
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span)
37+
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span)
3838
{
39-
if cx.access_levels.is_exported(item.def_id) {
39+
if cx.access_levels.is_exported(item.def_id.def_id) {
4040
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
4141
check_result_unit_err(cx, err_ty, fn_header_span);
4242
}
@@ -47,10 +47,10 @@ pub(super) fn check_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::Item<'tcx>, l
4747
pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::ImplItem<'tcx>, large_err_threshold: u64) {
4848
// Don't lint if method is a trait's implementation, we can't do anything about those
4949
if let hir::ImplItemKind::Fn(ref sig, _) = item.kind
50-
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span)
51-
&& trait_ref_of_method(cx, item.def_id).is_none()
50+
&& let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span)
51+
&& trait_ref_of_method(cx, item.def_id.def_id).is_none()
5252
{
53-
if cx.access_levels.is_exported(item.def_id) {
53+
if cx.access_levels.is_exported(item.def_id.def_id) {
5454
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
5555
check_result_unit_err(cx, err_ty, fn_header_span);
5656
}
@@ -61,8 +61,8 @@ pub(super) fn check_impl_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::ImplItem
6161
pub(super) fn check_trait_item<'tcx>(cx: &LateContext<'tcx>, item: &hir::TraitItem<'tcx>, large_err_threshold: u64) {
6262
if let hir::TraitItemKind::Fn(ref sig, _) = item.kind {
6363
let fn_header_span = item.span.with_hi(sig.decl.output.span().hi());
64-
if let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id, item.span) {
65-
if cx.access_levels.is_exported(item.def_id) {
64+
if let Some((hir_ty, err_ty)) = result_err_ty(cx, sig.decl, item.def_id.def_id, item.span) {
65+
if cx.access_levels.is_exported(item.def_id.def_id) {
6666
check_result_unit_err(cx, err_ty, fn_header_span);
6767
}
6868
check_result_large_err(cx, err_ty, hir_ty.span, large_err_threshold);

0 commit comments

Comments
 (0)