Skip to content

Commit 4bdfb07

Browse files
committed
Auto merge of #10097 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` I'm on the train and my internet is too bad to download the necessary toolchain, so I have to use CI to find sync fallout. changelog: none <!-- changelog_checked -->
2 parents 391b2a6 + 7198989 commit 4bdfb07

38 files changed

+129
-118
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.67"
3+
version = "0.1.68"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.67"
3+
version = "0.1.68"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/dereference.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ fn is_mixed_projection_predicate<'tcx>(
12441244
let mut projection_ty = projection_predicate.projection_ty;
12451245
loop {
12461246
match projection_ty.self_ty().kind() {
1247-
ty::Projection(inner_projection_ty) => {
1247+
ty::Alias(ty::Projection, inner_projection_ty) => {
12481248
projection_ty = *inner_projection_ty;
12491249
}
12501250
ty::Param(param_ty) => {
@@ -1330,7 +1330,7 @@ fn replace_types<'tcx>(
13301330
&& let Some(term_ty) = projection_predicate.term.ty()
13311331
&& let ty::Param(term_param_ty) = term_ty.kind()
13321332
{
1333-
let item_def_id = projection_predicate.projection_ty.item_def_id;
1333+
let item_def_id = projection_predicate.projection_ty.def_id;
13341334
let assoc_item = cx.tcx.associated_item(item_def_id);
13351335
let projection = cx.tcx
13361336
.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(new_ty, []));
@@ -1390,10 +1390,15 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
13901390
continue;
13911391
},
13921392
ty::Param(_) => TyPosition::new_deref_stable_for_result(precedence, ty),
1393-
ty::Projection(_) if ty.has_non_region_param() => TyPosition::new_deref_stable_for_result(precedence, ty),
1394-
ty::Infer(_) | ty::Error(_) | ty::Bound(..) | ty::Opaque(..) | ty::Placeholder(_) | ty::Dynamic(..) => {
1395-
Position::ReborrowStable(precedence).into()
1393+
ty::Alias(ty::Projection, _) if ty.has_non_region_param() => {
1394+
TyPosition::new_deref_stable_for_result(precedence, ty)
13961395
},
1396+
ty::Infer(_)
1397+
| ty::Error(_)
1398+
| ty::Bound(..)
1399+
| ty::Alias(ty::Opaque, ..)
1400+
| ty::Placeholder(_)
1401+
| ty::Dynamic(..) => Position::ReborrowStable(precedence).into(),
13971402
ty::Adt(..) if ty.has_placeholders() || ty.has_opaque_types() => {
13981403
Position::ReborrowStable(precedence).into()
13991404
},
@@ -1417,7 +1422,7 @@ fn ty_auto_deref_stability<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, precedenc
14171422
| ty::Closure(..)
14181423
| ty::Never
14191424
| ty::Tuple(_)
1420-
| ty::Projection(_) => {
1425+
| ty::Alias(ty::Projection, _) => {
14211426
Position::DerefStable(precedence, ty.is_sized(cx.tcx, cx.param_env.without_caller_bounds())).into()
14221427
},
14231428
};

clippy_lints/src/derive.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::hir::nested_filter;
1515
use rustc_middle::traits::Reveal;
1616
use rustc_middle::ty::{
1717
self, Binder, BoundConstness, Clause, GenericParamDefKind, ImplPolarity, ParamEnv, PredicateKind, TraitPredicate,
18-
TraitRef, Ty, TyCtxt,
18+
Ty, TyCtxt,
1919
};
2020
use rustc_session::{declare_lint_pass, declare_tool_lint};
2121
use rustc_span::source_map::Span;
@@ -513,10 +513,7 @@ fn param_env_for_derived_eq(tcx: TyCtxt<'_>, did: DefId, eq_trait_id: DefId) ->
513513
tcx.mk_predicates(ty_predicates.iter().map(|&(p, _)| p).chain(
514514
params.iter().filter(|&&(_, needs_eq)| needs_eq).map(|&(param, _)| {
515515
tcx.mk_predicate(Binder::dummy(PredicateKind::Clause(Clause::Trait(TraitPredicate {
516-
trait_ref: TraitRef::new(
517-
eq_trait_id,
518-
tcx.mk_substs(std::iter::once(tcx.mk_param_from_def(param))),
519-
),
516+
trait_ref: tcx.mk_trait_ref(eq_trait_id, [tcx.mk_param_from_def(param)]),
520517
constness: BoundConstness::NotConst,
521518
polarity: ImplPolarity::Positive,
522519
}))))

clippy_lints/src/disallowed_types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedTypes {
106106

107107
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
108108
if let ItemKind::Use(path, UseKind::Single) = &item.kind {
109-
self.check_res_emit(cx, &path.res, item.span);
109+
for res in &path.res {
110+
self.check_res_emit(cx, res, item.span);
111+
}
110112
}
111113
}
112114

clippy_lints/src/from_over_into.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto {
7878
&& let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args
7979
&& let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
8080
&& cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id)
81-
&& !matches!(middle_trait_ref.substs.type_at(1).kind(), ty::Opaque(..))
81+
&& !matches!(middle_trait_ref.substs.type_at(1).kind(), ty::Alias(ty::Opaque, _))
8282
{
8383
span_lint_and_then(
8484
cx,
@@ -127,7 +127,7 @@ impl<'a, 'tcx> Visitor<'tcx> for SelfFinder<'a, 'tcx> {
127127
self.cx.tcx.hir()
128128
}
129129

130-
fn visit_path(&mut self, path: &'tcx Path<'tcx>, _id: HirId) {
130+
fn visit_path(&mut self, path: &Path<'tcx>, _id: HirId) {
131131
for segment in path.segments {
132132
match segment.ident.name {
133133
kw::SelfLower => self.lower.push(segment.ident.span),

clippy_lints/src/future_not_send.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::intravisit::FnKind;
44
use rustc_hir::{Body, FnDecl, HirId};
55
use rustc_infer::infer::TyCtxtInferExt;
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::ty::{Clause, EarlyBinder, Opaque, PredicateKind};
7+
use rustc_middle::ty::{self, AliasTy, Clause, EarlyBinder, PredicateKind};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::{sym, Span};
1010
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
@@ -62,11 +62,11 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6262
return;
6363
}
6464
let ret_ty = return_ty(cx, hir_id);
65-
if let Opaque(id, subst) = *ret_ty.kind() {
66-
let preds = cx.tcx.explicit_item_bounds(id);
65+
if let ty::Alias(ty::Opaque, AliasTy { def_id, substs, .. }) = *ret_ty.kind() {
66+
let preds = cx.tcx.explicit_item_bounds(def_id);
6767
let mut is_future = false;
6868
for &(p, _span) in preds {
69-
let p = EarlyBinder(p).subst(cx.tcx, subst);
69+
let p = EarlyBinder(p).subst(cx.tcx, substs);
7070
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
7171
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
7272
is_future = true;

clippy_lints/src/invalid_utf8_in_unchecked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidUtf8InUnchecked {
3333
if let Some([arg]) = match_function_call(cx, expr, &paths::STR_FROM_UTF8_UNCHECKED) {
3434
match &arg.kind {
3535
ExprKind::Lit(Spanned { node: lit, .. }) => {
36-
if let LitKind::ByteStr(bytes) = &lit
36+
if let LitKind::ByteStr(bytes, _) = &lit
3737
&& std::str::from_utf8(bytes).is_err()
3838
{
3939
lint(cx, expr.span);

clippy_lints/src/large_include_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl LateLintPass<'_> for LargeIncludeFile {
6060
then {
6161
let len = match &lit.node {
6262
// include_bytes
63-
LitKind::ByteStr(bstr) => bstr.len(),
63+
LitKind::ByteStr(bstr, _) => bstr.len(),
6464
// include_str
6565
LitKind::Str(sym, _) => sym.as_str().len(),
6666
_ => return,

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
501501
.filter_by_name_unhygienic(is_empty)
502502
.any(|item| is_is_empty(cx, item))
503503
}),
504-
ty::Projection(ref proj) => has_is_empty_impl(cx, proj.item_def_id),
504+
ty::Alias(ty::Projection, ref proj) => has_is_empty_impl(cx, proj.def_id),
505505
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
506506
ty::Array(..) | ty::Slice(..) | ty::Str => true,
507507
_ => false,

0 commit comments

Comments
 (0)