Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustup #9881

Merged
merged 54 commits into from
Nov 21, 2022
Merged

Rustup #9881

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
506bfc2
Auto merge of #2583 - RalfJung:rustup, r=oli-obk
bors Oct 8, 2022
9ffc54d
merge rustc history
RalfJung Oct 9, 2022
93cc616
merge rustc history
RalfJung Oct 10, 2022
928606a
merge rustc history
RalfJung Oct 12, 2022
831b994
Implement -Ztrack-diagnostics
Oct 18, 2022
b78509e
Add testcase for next_point, fix more trivial issues in find_width_of…
chenyukang Oct 19, 2022
4dfc7b2
Fixup a few tests needing asm support
cuviper Oct 19, 2022
5650673
Implement assertions and fixes to not emit empty spans without sugges…
kper Oct 11, 2022
059e52b
rustc_hir_typeck: fix clippy
lcnr Oct 20, 2022
9fe8e3d
merge rustc history
RalfJung Oct 21, 2022
d397819
Rollup merge of #102922 - kper:bugfix/102902-filtering-json, r=oli-obk
Dylan-DPC Oct 21, 2022
0569f56
Rollup merge of #103260 - cuviper:needs-asm-support, r=fee1-dead
Dylan-DPC Oct 21, 2022
46cf1ea
Auto merge of #103344 - Dylan-DPC:rollup-d1rpfvx, r=Dylan-DPC
bors Oct 21, 2022
2ed4049
Introduce subst_iter and subst_iter_copied on EarlyBinder
compiler-errors Oct 16, 2022
cd0bb7d
Merge commit '4f142aa1058f14f153f8bfd2d82f04ddb9982388' into clippyup
flip1995 Oct 23, 2022
beae0d2
Address some comments
Oct 24, 2022
48edc83
Add more normalization and tests
Oct 24, 2022
5b336fd
Auto merge of #103392 - RalfJung:miri, r=oli-obk
bors Oct 25, 2022
4b1cebb
Adjust normalization
Oct 26, 2022
45c000b
privacy: Rename "accessibility levels" to "effective visibilities"
petrochenkov Sep 22, 2022
471d855
Update tooling
WaffleLapkin Oct 27, 2022
6e6a803
Move clippy::uninlined_format_args back to pedantic
flip1995 Oct 27, 2022
678e675
Retain ParamEnv constness when running deferred cast checks
fee1-dead Oct 28, 2022
26eeeee
Auto merge of #102233 - petrochenkov:effvis, r=jackh726
bors Oct 29, 2022
efca32e
Rename some `OwnerId` fields.
nnethercote Oct 27, 2022
dff041f
Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=comp…
GuillaumeGomez Oct 29, 2022
16566e9
Use LanguageItems::require less
camsteffen Oct 26, 2022
9f2852f
Auto merge of #103217 - mejrs:track, r=eholk
bors Nov 1, 2022
188e8e9
improve `filesearch::get_or_default_sysroot` r=ozkanonur
onur-ozkan Oct 28, 2022
40dca3d
Rollup merge of #103660 - ozkanonur:master, r=jyn514
Dylan-DPC Nov 5, 2022
84c3a95
bless clippy
chenyukang Nov 9, 2022
7ddd321
Introduce `ExprKind::IncludedBytes`
clubby789 Oct 31, 2022
e6ef478
Store a LocalDefId in hir::Variant & hir::Field.
cjgillot Nov 6, 2022
8a2d0f2
Fix clippy and rustdoc
WaffleLapkin Nov 13, 2022
f2d83ed
Use `token::Lit` in `ast::ExprKind::Lit`.
nnethercote Oct 10, 2022
2bf87f3
cleanup and dedupe CTFE and Miri error reporting
RalfJung Nov 15, 2022
e5352c7
Convert predicates into Predicate in the Obligation constructor
oli-obk Nov 9, 2022
cbd6159
Auto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petro…
bors Nov 16, 2022
333b92c
Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, typ…
nnethercote Sep 8, 2022
11d632f
Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
bors Nov 17, 2022
82afb16
Add variant_name function to `LangItem`
flip1995 Nov 5, 2022
f7535e7
Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compile…
matthiaskrgr Nov 17, 2022
a09423f
Rm diagnostic item, use lang item
fee1-dead Jul 5, 2022
8749eda
Rollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk
matthiaskrgr Nov 18, 2022
bc01b2e
Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petroch…
bors Nov 18, 2022
f6d4ef9
Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr
bors Nov 18, 2022
3a2eaa7
drive-by: Add is_async fn to hir::IsAsync
compiler-errors Nov 19, 2022
27c4c17
Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans,…
matthiaskrgr Nov 19, 2022
80a4699
Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compil…
bors Nov 20, 2022
fd5b85c
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Nov 21, 2022
25e98bf
Bump Clippy version -> 0.1.67
flip1995 Nov 21, 2022
661f13c
Bump nightly version -> 2022-11-21
flip1995 Nov 21, 2022
5907e91
pass clippy sysroot env if given r=ozkanonur
onur-ozkan Nov 19, 2022
05b914a
Fix custom ICE message test on windows
flip1995 Nov 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.66"
version = "0.1.67"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.66"
version = "0.1.67"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down
19 changes: 14 additions & 5 deletions clippy_lints/src/almost_complete_letter_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,21 @@ impl EarlyLintPass for AlmostCompleteLetterRange {
}

fn check_range(cx: &EarlyContext<'_>, span: Span, start: &Expr, end: &Expr, sugg: Option<(Span, &str)>) {
if let ExprKind::Lit(start_lit) = &start.peel_parens().kind
&& let ExprKind::Lit(end_lit) = &end.peel_parens().kind
if let ExprKind::Lit(start_token_lit) = start.peel_parens().kind
&& let ExprKind::Lit(end_token_lit) = end.peel_parens().kind
&& matches!(
(&start_lit.kind, &end_lit.kind),
(LitKind::Byte(b'a') | LitKind::Char('a'), LitKind::Byte(b'z') | LitKind::Char('z'))
| (LitKind::Byte(b'A') | LitKind::Char('A'), LitKind::Byte(b'Z') | LitKind::Char('Z'))
(
LitKind::from_token_lit(start_token_lit),
LitKind::from_token_lit(end_token_lit),
),
(
Ok(LitKind::Byte(b'a') | LitKind::Char('a')),
Ok(LitKind::Byte(b'z') | LitKind::Char('z'))
)
| (
Ok(LitKind::Byte(b'A') | LitKind::Char('A')),
Ok(LitKind::Byte(b'Z') | LitKind::Char('Z')),
)
)
&& !in_external_macro(cx.sess(), span)
{
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/casts/ptr_as_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: Option<RustcVer
(Mutability::Not, Mutability::Not) | (Mutability::Mut, Mutability::Mut));
// The `U` in `pointer::cast` have to be `Sized`
// as explained here: https://github.com/rust-lang/rust/issues/60602.
if to_pointee_ty.is_sized(cx.tcx.at(expr.span), cx.param_env);
if to_pointee_ty.is_sized(cx.tcx, cx.param_env);
then {
let mut applicability = Applicability::MachineApplicable;
let cast_expr_sugg = Sugg::hir_with_applicability(cx, cast_expr, "_", &mut applicability);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'tcx> LateLintPass<'tcx> for CopyIterator {
of_trait: Some(ref trait_ref),
..
}) = item.kind;
let ty = cx.tcx.type_of(item.def_id);
let ty = cx.tcx.type_of(item.owner_id);
if is_copy(cx, ty);
if let Some(trait_id) = trait_ref.trait_def_id();
if cx.tcx.is_diagnostic_item(sym::Iterator, trait_id);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/default_union_representation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultUnionRepresentation {
None,
&format!(
"consider annotating `{}` with `#[repr(C)]` to explicitly specify memory layout",
cx.tcx.def_path_str(item.def_id.to_def_id())
cx.tcx.def_path_str(item.owner_id.to_def_id())
),
);
}
Expand Down
36 changes: 17 additions & 19 deletions clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use rustc_middle::ty::{
};
use rustc_semver::RustcVersion;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{symbol::sym, Span, Symbol, DUMMY_SP};
use rustc_span::{symbol::sym, Span, Symbol};
use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::{query::evaluate_obligation::InferCtxtExt as _, Obligation, ObligationCause};
use std::collections::VecDeque;
Expand Down Expand Up @@ -714,47 +714,47 @@ fn walk_parents<'tcx>(
},
Node::Item(&Item {
kind: ItemKind::Static(..) | ItemKind::Const(..),
def_id,
owner_id,
span,
..
})
| Node::TraitItem(&TraitItem {
kind: TraitItemKind::Const(..),
def_id,
owner_id,
span,
..
})
| Node::ImplItem(&ImplItem {
kind: ImplItemKind::Const(..),
def_id,
owner_id,
span,
..
}) if span.ctxt() == ctxt => {
let ty = cx.tcx.type_of(def_id.def_id);
let ty = cx.tcx.type_of(owner_id.def_id);
Some(ty_auto_deref_stability(cx, ty, precedence).position_for_result(cx))
},

Node::Item(&Item {
kind: ItemKind::Fn(..),
def_id,
owner_id,
span,
..
})
| Node::TraitItem(&TraitItem {
kind: TraitItemKind::Fn(..),
def_id,
owner_id,
span,
..
})
| Node::ImplItem(&ImplItem {
kind: ImplItemKind::Fn(..),
def_id,
owner_id,
span,
..
}) if span.ctxt() == ctxt => {
let output = cx
.tcx
.erase_late_bound_regions(cx.tcx.fn_sig(def_id.to_def_id()).output());
.erase_late_bound_regions(cx.tcx.fn_sig(owner_id.to_def_id()).output());
Some(ty_auto_deref_stability(cx, output, precedence).position_for_result(cx))
},

Expand Down Expand Up @@ -1000,7 +1000,7 @@ fn binding_ty_auto_deref_stability<'tcx>(
cx.typeck_results().node_type(ty.ty.hir_id),
binder_args,
))
.is_sized(cx.tcx.at(DUMMY_SP), cx.param_env.without_caller_bounds()),
.is_sized(cx.tcx, cx.param_env.without_caller_bounds()),
)
}
},
Expand All @@ -1015,7 +1015,7 @@ fn binding_ty_auto_deref_stability<'tcx>(
cx.typeck_results().node_type(ty.ty.hir_id),
binder_args,
))
.is_sized(cx.tcx.at(DUMMY_SP), cx.param_env.without_caller_bounds()),
.is_sized(cx.tcx, cx.param_env.without_caller_bounds()),
),
TyKind::OpaqueDef(..) | TyKind::Infer | TyKind::Typeof(..) | TyKind::TraitObject(..) | TyKind::Err => {
Position::ReborrowStable(precedence)
Expand Down Expand Up @@ -1116,7 +1116,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
.iter()
.filter_map(|predicate| {
if let PredicateKind::Trait(trait_predicate) = predicate.kind().skip_binder()
&& trait_predicate.self_ty() == param_ty.to_ty(cx.tcx)
&& trait_predicate.trait_ref.self_ty() == param_ty.to_ty(cx.tcx)
{
Some(trait_predicate.trait_ref.def_id)
} else {
Expand Down Expand Up @@ -1188,7 +1188,7 @@ fn needless_borrow_impl_arg_position<'tcx>(
}

let predicate = EarlyBinder(predicate).subst(cx.tcx, &substs_with_referent_ty);
let obligation = Obligation::new(ObligationCause::dummy(), cx.param_env, predicate);
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
let infcx = cx.tcx.infer_ctxt().build();
infcx.predicate_must_hold_modulo_regions(&obligation)
})
Expand Down Expand Up @@ -1362,7 +1362,7 @@ impl<'tcx> TyPosition<'tcx> {
fn position_for_result(self, cx: &LateContext<'tcx>) -> Position {
match (self.position, self.ty) {
(Position::ReborrowStable(precedence), Some(ty)) => {
Position::DerefStable(precedence, ty.is_sized(cx.tcx.at(DUMMY_SP), cx.param_env))
Position::DerefStable(precedence, ty.is_sized(cx.tcx, cx.param_env))
},
(position, _) => position,
}
Expand Down Expand Up @@ -1412,11 +1412,9 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
| ty::Closure(..)
| ty::Never
| ty::Tuple(_)
| ty::Projection(_) => Position::DerefStable(
precedence,
ty.is_sized(cx.tcx.at(DUMMY_SP), cx.param_env.without_caller_bounds()),
)
.into(),
| ty::Projection(_) => {
Position::DerefStable(precedence, ty.is_sized(cx.tcx, cx.param_env.without_caller_bounds())).into()
},
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derivable_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
self_ty,
..
}) = item.kind;
if !cx.tcx.has_attr(item.def_id.to_def_id(), sym::automatically_derived);
if !cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);
if !item.span.from_expansion();
if let Some(def_id) = trait_ref.trait_def_id();
if cx.tcx.is_diagnostic_item(sym::Default, def_id);
if let impl_item_hir = child.id.hir_id();
if let Some(Node::ImplItem(impl_item)) = cx.tcx.hir().find(impl_item_hir);
if let ImplItemKind::Fn(_, b) = &impl_item.kind;
if let Body { value: func_expr, .. } = cx.tcx.hir().body(*b);
if let Some(adt_def) = cx.tcx.type_of(item.def_id).ty_adt_def();
if let Some(adt_def) = cx.tcx.type_of(item.owner_id).ty_adt_def();
if let attrs = cx.tcx.hir().attrs(item.hir_id());
if !attrs.iter().any(|attr| attr.doc_str().is_some());
if let child_attrs = cx.tcx.hir().attrs(impl_item_hir);
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ impl<'tcx> LateLintPass<'tcx> for Derive {
..
}) = item.kind
{
let ty = cx.tcx.type_of(item.def_id);
let is_automatically_derived = cx.tcx.has_attr(item.def_id.to_def_id(), sym::automatically_derived);
let ty = cx.tcx.type_of(item.owner_id);
let is_automatically_derived = cx.tcx.has_attr(item.owner_id.to_def_id(), sym::automatically_derived);

check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);
Expand Down
19 changes: 10 additions & 9 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,15 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
let Some(headers) = check_attrs(cx, &self.valid_idents, attrs) else { return };
match item.kind {
hir::ItemKind::Fn(ref sig, _, body_id) => {
if !(is_entrypoint_fn(cx, item.def_id.to_def_id()) || in_external_macro(cx.tcx.sess, item.span)) {
if !(is_entrypoint_fn(cx, item.owner_id.to_def_id()) || in_external_macro(cx.tcx.sess, item.span)) {
let body = cx.tcx.hir().body(body_id);
let mut fpu = FindPanicUnwrap {
cx,
typeck_results: cx.tcx.typeck(item.def_id.def_id),
typeck_results: cx.tcx.typeck(item.owner_id.def_id),
panic_span: None,
};
fpu.visit_expr(body.value);
lint_for_missing_headers(cx, item.def_id.def_id, sig, headers, Some(body_id), fpu.panic_span);
lint_for_missing_headers(cx, item.owner_id.def_id, sig, headers, Some(body_id), fpu.panic_span);
}
},
hir::ItemKind::Impl(impl_) => {
Expand All @@ -312,13 +312,13 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
(false, hir::Unsafety::Unsafe) => span_lint(
cx,
MISSING_SAFETY_DOC,
cx.tcx.def_span(item.def_id),
cx.tcx.def_span(item.owner_id),
"docs for unsafe trait missing `# Safety` section",
),
(true, hir::Unsafety::Normal) => span_lint(
cx,
UNNECESSARY_SAFETY_DOC,
cx.tcx.def_span(item.def_id),
cx.tcx.def_span(item.owner_id),
"docs for safe trait have unnecessary `# Safety` section",
),
_ => (),
Expand All @@ -338,7 +338,7 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
let Some(headers) = check_attrs(cx, &self.valid_idents, attrs) else { return };
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
if !in_external_macro(cx.tcx.sess, item.span) {
lint_for_missing_headers(cx, item.def_id.def_id, sig, headers, None, None);
lint_for_missing_headers(cx, item.owner_id.def_id, sig, headers, None, None);
}
}
}
Expand All @@ -353,11 +353,11 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
let body = cx.tcx.hir().body(body_id);
let mut fpu = FindPanicUnwrap {
cx,
typeck_results: cx.tcx.typeck(item.def_id.def_id),
typeck_results: cx.tcx.typeck(item.owner_id.def_id),
panic_span: None,
};
fpu.visit_expr(body.value);
lint_for_missing_headers(cx, item.def_id.def_id, sig, headers, Some(body_id), fpu.panic_span);
lint_for_missing_headers(cx, item.owner_id.def_id, sig, headers, Some(body_id), fpu.panic_span);
}
}
}
Expand All @@ -370,7 +370,7 @@ fn lint_for_missing_headers(
body_id: Option<hir::BodyId>,
panic_span: Option<Span>,
) {
if !cx.access_levels.is_exported(def_id) {
if !cx.effective_visibilities.is_exported(def_id) {
return; // Private functions do not require doc comments
}

Expand Down Expand Up @@ -720,6 +720,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
false,
None,
false,
false,
);
let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm);
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/double_parens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ impl EarlyLintPass for DoubleParens {
}
}
},
ExprKind::MethodCall(_, _, ref params, _) => {
if let [ref param] = params[..] {
if let ExprKind::Paren(_) = param.kind {
span_lint(cx, DOUBLE_PARENS, param.span, msg);
ExprKind::MethodCall(ref call) => {
if let [ref arg] = call.args[..] {
if let ExprKind::Paren(_) = arg.kind {
span_lint(cx, DOUBLE_PARENS, arg.span, msg);
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/empty_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for EmptyEnum {
}

if let ItemKind::Enum(..) = item.kind {
let ty = cx.tcx.type_of(item.def_id);
let ty = cx.tcx.type_of(item.owner_id);
let adt = ty.ty_adt_def().expect("already checked whether this is an enum");
if adt.variants().is_empty() {
span_lint_and_help(
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl LateLintPass<'_> for EnumVariantNames {
}
// The `module_name_repetitions` lint should only trigger if the item has the module in its
// name. Having the same name is accepted.
if cx.tcx.visibility(item.def_id).is_public() && item_camel.len() > mod_camel.len() {
if cx.tcx.visibility(item.owner_id).is_public() && item_camel.len() > mod_camel.len() {
let matching = count_match_start(mod_camel, &item_camel);
let rmatching = count_match_end(mod_camel, &item_camel);
let nchars = mod_camel.chars().count();
Expand Down Expand Up @@ -296,7 +296,7 @@ impl LateLintPass<'_> for EnumVariantNames {
}
}
if let ItemKind::Enum(ref def, _) = item.kind {
if !(self.avoid_breaking_exported_api && cx.access_levels.is_exported(item.def_id.def_id)) {
if !(self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(item.owner_id.def_id)) {
check_variant(cx, self.threshold, def, item_name, item.span);
}
}
Expand Down
12 changes: 3 additions & 9 deletions clippy_lints/src/escape.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clippy_utils::diagnostics::span_lint_hir;
use rustc_hir::intravisit;
use rustc_hir::{self, AssocItemKind, Body, FnDecl, HirId, HirIdSet, Impl, ItemKind, Node, Pat, PatKind};
use rustc_hir_analysis::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
use rustc_hir_typeck::expr_use_visitor::{Delegate, ExprUseVisitor, PlaceBase, PlaceWithHirId};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::mir::FakeReadCause;
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<'tcx> LateLintPass<'tcx> for BoxedLocal {
// be sure we have `self` parameter in this function
if trait_item.kind == (AssocItemKind::Fn { has_self: true }) {
trait_self_ty = Some(
TraitRef::identity(cx.tcx, trait_item.id.def_id.to_def_id())
TraitRef::identity(cx.tcx, trait_item.id.owner_id.to_def_id())
.self_ty()
.skip_binder(),
);
Expand Down Expand Up @@ -176,13 +176,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
}
}

fn fake_read(
&mut self,
_: &rustc_hir_analysis::expr_use_visitor::PlaceWithHirId<'tcx>,
_: FakeReadCause,
_: HirId,
) {
}
fn fake_read(&mut self, _: &rustc_hir_typeck::expr_use_visitor::PlaceWithHirId<'tcx>, _: FakeReadCause, _: HirId) {}
}

impl<'a, 'tcx> EscapeDelegate<'a, 'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/exhaustive_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl LateLintPass<'_> for ExhaustiveItems {
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
if_chain! {
if let ItemKind::Enum(..) | ItemKind::Struct(..) = item.kind;
if cx.access_levels.is_exported(item.def_id.def_id);
if cx.effective_visibilities.is_exported(item.owner_id.def_id);
let attrs = cx.tcx.hir().attrs(item.hir_id());
if !attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
then {
Expand Down
Loading