Skip to content

Commit 1a4175b

Browse files
committed
Auto merge of #6126 - flip1995:rustup, r=flip1995
Rustup Supersedes #6121. There was another breakage. r? `@ghost` changelog: none
2 parents c9fdeef + b05aeaa commit 1a4175b

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn lit_to_constant(lit: &LitKind, ty: Option<Ty<'_>>) -> Constant {
155155
match *lit {
156156
LitKind::Str(ref is, _) => Constant::Str(is.to_string()),
157157
LitKind::Byte(b) => Constant::Int(u128::from(b)),
158-
LitKind::ByteStr(ref s) => Constant::Binary(Lrc::from(s.as_slice())),
158+
LitKind::ByteStr(ref s) => Constant::Binary(Lrc::clone(s)),
159159
LitKind::Char(c) => Constant::Char(c),
160160
LitKind::Int(n, _) => Constant::Int(n),
161161
LitKind::Float(ref is, LitFloatType::Suffixed(fty)) => match fty {

clippy_lints/src/future_not_send.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rustc_hir::intravisit::FnKind;
33
use rustc_hir::{Body, FnDecl, HirId};
44
use rustc_infer::infer::TyCtxtInferExt;
55
use rustc_lint::{LateContext, LateLintPass};
6+
use rustc_middle::ty::subst::Subst;
67
use rustc_middle::ty::{Opaque, PredicateAtom::Trait};
78
use rustc_session::{declare_lint_pass, declare_tool_lint};
89
use rustc_span::{sym, Span};
@@ -62,9 +63,10 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6263
}
6364
let ret_ty = utils::return_ty(cx, hir_id);
6465
if let Opaque(id, subst) = *ret_ty.kind() {
65-
let preds = cx.tcx.predicates_of(id).instantiate(cx.tcx, subst);
66+
let preds = cx.tcx.explicit_item_bounds(id);
6667
let mut is_future = false;
67-
for p in preds.predicates {
68+
for &(p, _span) in preds {
69+
let p = p.subst(cx.tcx, subst);
6870
if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
6971
if Some(trait_ref.def_id()) == cx.tcx.lang_items().future_trait() {
7072
is_future = true;

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
16671667
// if return type is impl trait, check the associated types
16681668
if let ty::Opaque(def_id, _) = *ret_ty.kind() {
16691669
// one of the associated types must be Self
1670-
for &(predicate, _span) in cx.tcx.predicates_of(def_id).predicates {
1670+
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
16711671
if let ty::PredicateAtom::Projection(projection_predicate) = predicate.skip_binders() {
16721672
// walk the associated type and check for Self
16731673
if contains_ty(projection_predicate.ty, self_ty) {

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
12761276
},
12771277
ty::Tuple(ref substs) => substs.types().any(|ty| is_must_use_ty(cx, ty)),
12781278
ty::Opaque(ref def_id, _) => {
1279-
for (predicate, _) in cx.tcx.predicates_of(*def_id).predicates {
1279+
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
12801280
if let ty::PredicateAtom::Trait(trait_predicate, _) = predicate.skip_binders() {
12811281
if must_use_attr(&cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() {
12821282
return true;

tests/ui/attrs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Test that the whole restriction group is not enabled
44
#![warn(clippy::restriction)]
55
#![deny(clippy::restriction)]
6-
#![forbid(clippy::restriction)]
76
#![allow(clippy::missing_docs_in_private_items, clippy::panic, clippy::unreachable)]
87

98
#[inline(always)]

tests/ui/attrs.stderr

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error: you have declared `#[inline(always)]` on `test_attr_lint`. This is usually a bad idea
2-
--> $DIR/attrs.rs:9:1
2+
--> $DIR/attrs.rs:8:1
33
|
44
LL | #[inline(always)]
55
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::inline-always` implied by `-D warnings`
88

99
error: the since field must contain a semver-compliant version
10-
--> $DIR/attrs.rs:29:14
10+
--> $DIR/attrs.rs:28:14
1111
|
1212
LL | #[deprecated(since = "forever")]
1313
| ^^^^^^^^^^^^^^^^^
1414
|
1515
= note: `-D clippy::deprecated-semver` implied by `-D warnings`
1616

1717
error: the since field must contain a semver-compliant version
18-
--> $DIR/attrs.rs:32:14
18+
--> $DIR/attrs.rs:31:14
1919
|
2020
LL | #[deprecated(since = "1")]
2121
| ^^^^^^^^^^^
@@ -37,13 +37,5 @@ LL | #![deny(clippy::restriction)]
3737
|
3838
= help: try enabling only the lints you really need
3939

40-
error: restriction lints are not meant to be all enabled
41-
--> $DIR/attrs.rs:6:11
42-
|
43-
LL | #![forbid(clippy::restriction)]
44-
| ^^^^^^^^^^^^^^^^^^^
45-
|
46-
= help: try enabling only the lints you really need
47-
48-
error: aborting due to 6 previous errors
40+
error: aborting due to 5 previous errors
4941

0 commit comments

Comments
 (0)