Skip to content

Commit b794b8e

Browse files
committed
Auto merge of #13086 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents ef3cfaa + 3b1266c commit b794b8e

24 files changed

+70
-64
lines changed

clippy_lints/src/assigning_clones.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
9494
},
9595
_ => return,
9696
}
97-
&& let Ok(Some(resolved_fn)) = Instance::resolve(cx.tcx, cx.param_env, fn_id, fn_gen_args)
97+
&& let Ok(Some(resolved_fn)) = Instance::try_resolve(cx.tcx, cx.param_env, fn_id, fn_gen_args)
9898
// TODO: This check currently bails if the local variable has no initializer.
9999
// That is overly conservative - the lint should fire even if there was no initializer,
100100
// but the variable has been initialized before `lhs` was evaluated.

clippy_lints/src/doc/mod.rs

+17-16
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ use clippy_utils::ty::is_type_diagnostic_item;
66
use clippy_utils::visitors::Visitable;
77
use clippy_utils::{in_constant, is_entrypoint_fn, is_trait_impl_item, method_chain_args};
88
use pulldown_cmark::Event::{
9-
Code, End, FootnoteReference, HardBreak, Html, Rule, SoftBreak, Start, TaskListMarker, Text,
9+
Code, DisplayMath, End, FootnoteReference, HardBreak, Html, InlineHtml, InlineMath, Rule, SoftBreak, Start,
10+
TaskListMarker, Text,
1011
};
1112
use pulldown_cmark::Tag::{BlockQuote, CodeBlock, FootnoteDefinition, Heading, Item, Link, Paragraph};
12-
use pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options};
13+
use pulldown_cmark::{BrokenLink, CodeBlockKind, CowStr, Options, TagEnd};
1314
use rustc_ast::ast::Attribute;
1415
use rustc_data_structures::fx::FxHashSet;
1516
use rustc_hir::intravisit::{self, Visitor};
@@ -659,7 +660,7 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
659660

660661
while let Some((event, range)) = events.next() {
661662
match event {
662-
Html(tag) => {
663+
Html(tag) | InlineHtml(tag) => {
663664
if tag.starts_with("<code") {
664665
code_level += 1;
665666
} else if tag.starts_with("</code") {
@@ -670,11 +671,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
670671
blockquote_level -= 1;
671672
}
672673
},
673-
Start(BlockQuote) => {
674+
Start(BlockQuote(_)) => {
674675
blockquote_level += 1;
675676
containers.push(Container::Blockquote);
676677
},
677-
End(BlockQuote) => {
678+
End(TagEnd::BlockQuote) => {
678679
blockquote_level -= 1;
679680
containers.pop();
680681
},
@@ -699,15 +700,15 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
699700
}
700701
}
701702
},
702-
End(CodeBlock(_)) => {
703+
End(TagEnd::CodeBlock) => {
703704
in_code = false;
704705
is_rust = false;
705706
ignore = false;
706707
},
707-
Start(Link(_, url, _)) => in_link = Some(url),
708-
End(Link(..)) => in_link = None,
709-
Start(Heading(_, _, _) | Paragraph | Item) => {
710-
if let Start(Heading(_, _, _)) = event {
708+
Start(Link { dest_url, .. }) => in_link = Some(dest_url),
709+
End(TagEnd::Link) => in_link = None,
710+
Start(Heading { .. } | Paragraph | Item) => {
711+
if let Start(Heading { .. }) = event {
711712
in_heading = true;
712713
}
713714
if let Start(Item) = event {
@@ -720,11 +721,11 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
720721
ticks_unbalanced = false;
721722
paragraph_range = range;
722723
},
723-
End(Heading(_, _, _) | Paragraph | Item) => {
724-
if let End(Heading(_, _, _)) = event {
724+
End(TagEnd::Heading(_) | TagEnd::Paragraph | TagEnd::Item) => {
725+
if let End(TagEnd::Heading(_)) = event {
725726
in_heading = false;
726727
}
727-
if let End(Item) = event {
728+
if let End(TagEnd::Item) = event {
728729
containers.pop();
729730
}
730731
if ticks_unbalanced && let Some(span) = fragments.span(cx, paragraph_range.clone()) {
@@ -746,8 +747,9 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
746747
text_to_check = Vec::new();
747748
},
748749
Start(FootnoteDefinition(..)) => in_footnote_definition = true,
749-
End(FootnoteDefinition(..)) => in_footnote_definition = false,
750-
Start(_tag) | End(_tag) => (), // We don't care about other tags
750+
End(TagEnd::FootnoteDefinition) => in_footnote_definition = false,
751+
Start(_) | End(_) // We don't care about other tags
752+
| TaskListMarker(_) | Code(_) | Rule | InlineMath(..) | DisplayMath(..) => (),
751753
SoftBreak | HardBreak => {
752754
if !containers.is_empty()
753755
&& let Some((next_event, next_range)) = events.peek()
@@ -766,7 +768,6 @@ fn check_doc<'a, Events: Iterator<Item = (pulldown_cmark::Event<'a>, Range<usize
766768
);
767769
}
768770
},
769-
TaskListMarker(_) | Code(_) | Rule => (),
770771
FootnoteReference(text) | Text(text) => {
771772
paragraph_range.end = range.end;
772773
let range_ = range.clone();

clippy_lints/src/empty_with_brackets.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ declare_clippy_lint! {
1616
/// and it may be desirable to do so consistently for style.
1717
///
1818
/// However, removing the brackets also introduces a public constant named after the struct,
19-
/// so this is not just a syntactic simplification but an an API change, and adding them back
19+
/// so this is not just a syntactic simplification but an API change, and adding them back
2020
/// is a *breaking* API change.
2121
///
2222
/// ### Example
@@ -44,7 +44,7 @@ declare_clippy_lint! {
4444
/// and it may be desirable to do so consistently for style.
4545
///
4646
/// However, removing the brackets also introduces a public constant named after the variant,
47-
/// so this is not just a syntactic simplification but an an API change, and adding them back
47+
/// so this is not just a syntactic simplification but an API change, and adding them back
4848
/// is a *breaking* API change.
4949
///
5050
/// ### Example

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::ty::{
1515
use rustc_session::declare_lint_pass;
1616
use rustc_span::symbol::sym;
1717
use rustc_target::spec::abi::Abi;
18-
use rustc_trait_selection::traits::error_reporting::InferCtxtExt as _;
18+
use rustc_trait_selection::error_reporting::traits::InferCtxtExt as _;
1919

2020
declare_clippy_lint! {
2121
/// ### What it does

clippy_lints/src/future_not_send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{self, AliasTy, ClauseKind, PredicateKind};
99
use rustc_session::declare_lint_pass;
1010
use rustc_span::def_id::LocalDefId;
1111
use rustc_span::{sym, Span};
12-
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
12+
use rustc_trait_selection::error_reporting::traits::suggestions::TypeErrCtxtExt;
1313
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
1414

1515
declare_clippy_lint! {

clippy_lints/src/implied_bounds_in_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ fn collect_supertrait_bounds<'tcx>(cx: &LateContext<'tcx>, bounds: GenericBounds
246246
&& let [.., path] = poly_trait.trait_ref.path.segments
247247
&& poly_trait.bound_generic_params.is_empty()
248248
&& let Some(trait_def_id) = path.res.opt_def_id()
249-
&& let predicates = cx.tcx.super_predicates_of(trait_def_id).predicates
249+
&& let predicates = cx.tcx.explicit_super_predicates_of(trait_def_id).predicates
250250
// If the trait has no supertrait, there is no need to collect anything from that bound
251251
&& !predicates.is_empty()
252252
{

clippy_lints/src/methods/type_id_on_box.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn is_subtrait_of_any(cx: &LateContext<'_>, ty: Ty<'_>) -> bool {
2424
cx.tcx.is_diagnostic_item(sym::Any, tr.def_id)
2525
|| cx
2626
.tcx
27-
.super_predicates_of(tr.def_id)
27+
.explicit_super_predicates_of(tr.def_id)
2828
.predicates
2929
.iter()
3030
.any(|(clause, _)| {

clippy_lints/src/needless_maybe_sized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn path_to_sized_bound(cx: &LateContext<'_>, trait_bound: &PolyTraitRef<'_>) ->
9191
return true;
9292
}
9393

94-
for &(predicate, _) in cx.tcx.super_predicates_of(trait_def_id).predicates {
94+
for &(predicate, _) in cx.tcx.explicit_super_predicates_of(trait_def_id).predicates {
9595
if let ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder()
9696
&& trait_predicate.polarity == PredicatePolarity::Positive
9797
&& !path.contains(&trait_predicate.def_id())

clippy_lints/src/non_copy_const.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<'tcx> NonCopyConst<'tcx> {
258258
// e.g. implementing `has_frozen_variant` described above, and not running this function
259259
// when the type doesn't have any frozen variants would be the 'correct' way for the 2nd
260260
// case (that actually removes another suboptimal behavior (I won't say 'false positive') where,
261-
// similar to 2., but with the a frozen variant) (e.g. borrowing
261+
// similar to 2., but with a frozen variant) (e.g. borrowing
262262
// `borrow_interior_mutable_const::enums::AssocConsts::TO_BE_FROZEN_VARIANT`).
263263
// I chose this way because unfrozen enums as assoc consts are rare (or, hopefully, none).
264264
matches!(err, ErrorHandled::TooGeneric(..))
@@ -293,7 +293,7 @@ impl<'tcx> NonCopyConst<'tcx> {
293293
ct: ty::UnevaluatedConst<'tcx>,
294294
span: Span,
295295
) -> EvalToValTreeResult<'tcx> {
296-
match ty::Instance::resolve(tcx, param_env, ct.def, ct.args) {
296+
match ty::Instance::try_resolve(tcx, param_env, ct.def, ct.args) {
297297
Ok(Some(instance)) => {
298298
let cid = GlobalId {
299299
instance,

clippy_lints/src/suspicious_operation_groupings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fn ident_difference_expr_with_base_location(
549549
| (Assign(_, _, _), Assign(_, _, _))
550550
| (TryBlock(_), TryBlock(_))
551551
| (Await(_, _), Await(_, _))
552-
| (Gen(_, _, _), Gen(_, _, _))
552+
| (Gen(_, _, _, _), Gen(_, _, _, _))
553553
| (Block(_, _), Block(_, _))
554554
| (Closure(_), Closure(_))
555555
| (Match(_, _, _), Match(_, _, _))

clippy_lints/src/unconditional_recursion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::ty::{self, AssocKind, Ty, TyCtxt};
1515
use rustc_session::impl_lint_pass;
1616
use rustc_span::symbol::{kw, Ident};
1717
use rustc_span::{sym, Span};
18-
use rustc_trait_selection::traits::error_reporting::suggestions::ReturnsVisitor;
18+
use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor;
1919

2020
declare_clippy_lint! {
2121
/// ### What it does

clippy_utils/src/ast_utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
226226
&& eq_fn_decl(lf, rf)
227227
&& eq_expr(le, re)
228228
},
229-
(Gen(lc, lb, lk), Gen(rc, rb, rk)) => lc == rc && eq_block(lb, rb) && lk == rk,
229+
(Gen(lc, lb, lk, _), Gen(rc, rb, rk, _)) => lc == rc && eq_block(lb, rb) && lk == rk,
230230
(Range(lf, lt, ll), Range(rf, rt, rl)) => ll == rl && eq_expr_opt(lf, rf) && eq_expr_opt(lt, rt),
231231
(AddrOf(lbk, lm, le), AddrOf(rbk, rm, re)) => lbk == rbk && lm == rm && eq_expr(le, re),
232232
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, eq_qself) && eq_path(lp, rp),

clippy_utils/src/qualify_min_const_fn.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,8 @@ fn check_terminator<'tcx>(
330330
target: _,
331331
unwind: _,
332332
fn_span: _,
333-
} => {
333+
}
334+
| TerminatorKind::TailCall { func, args, fn_span: _ } => {
334335
let fn_ty = func.ty(body, tcx);
335336
if let ty::FnDef(fn_def_id, _) = *fn_ty.kind() {
336337
if !is_const_fn(tcx, fn_def_id, msrv) {

clippy_utils/src/ty.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
9696
return false;
9797
}
9898

99-
for (predicate, _span) in cx
100-
.tcx
101-
.explicit_item_super_predicates(def_id)
102-
.instantiate_identity_iter_copied()
103-
{
99+
for (predicate, _span) in cx.tcx.explicit_item_super_predicates(def_id).iter_identity_copied() {
104100
match predicate.kind().skip_binder() {
105101
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
106102
// and check substitutions to find `U`.

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2024-06-27"
2+
channel = "nightly-2024-07-11"
33
components = ["cargo", "llvm-tools", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]
44
profile = "minimal"

tests/ui/dbg_macro/dbg_macro.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ LL | dbg!();
8686
help: remove the invocation before committing it to a version control system
8787
|
8888
LL - dbg!();
89-
LL +
9089
|
9190

9291
error: the `dbg!` macro is intended as a debugging tool
@@ -146,7 +145,6 @@ LL | expand_to_dbg!();
146145
help: remove the invocation before committing it to a version control system
147146
|
148147
LL - dbg!();
149-
LL +
150148
|
151149

152150
error: the `dbg!` macro is intended as a debugging tool

tests/ui/dbg_macro/dbg_macro_unfixable.stderr

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ LL | dbg!();
99
help: remove the invocation before committing it to a version control system
1010
|
1111
LL - dbg!();
12-
LL +
1312
|
1413

1514
error: the `dbg!` macro is intended as a debugging tool

tests/ui/manual_split_once.stderr

-10
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,10 @@ LL | let (l, r) = "a.b.c".split_once('.').unwrap();
9696
help: remove the `iter` usages
9797
|
9898
LL - let l = iter.next().unwrap();
99-
LL +
10099
|
101100
help: remove the `iter` usages
102101
|
103102
LL - let r = iter.next().unwrap();
104-
LL +
105103
|
106104

107105
error: manual implementation of `split_once`
@@ -121,12 +119,10 @@ LL | let (l, r) = "a.b.c".split_once('.')?;
121119
help: remove the `iter` usages
122120
|
123121
LL - let l = iter.next()?;
124-
LL +
125122
|
126123
help: remove the `iter` usages
127124
|
128125
LL - let r = iter.next()?;
129-
LL +
130126
|
131127

132128
error: manual implementation of `rsplit_once`
@@ -146,12 +142,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.').unwrap();
146142
help: remove the `iter` usages
147143
|
148144
LL - let r = iter.next().unwrap();
149-
LL +
150145
|
151146
help: remove the `iter` usages
152147
|
153148
LL - let l = iter.next().unwrap();
154-
LL +
155149
|
156150

157151
error: manual implementation of `rsplit_once`
@@ -171,12 +165,10 @@ LL | let (l, r) = "a.b.c".rsplit_once('.')?;
171165
help: remove the `iter` usages
172166
|
173167
LL - let r = iter.next()?;
174-
LL +
175168
|
176169
help: remove the `iter` usages
177170
|
178171
LL - let l = iter.next()?;
179-
LL +
180172
|
181173

182174
error: manual implementation of `split_once`
@@ -202,12 +194,10 @@ LL | let (a, b) = "a.b.c".split_once('.').unwrap();
202194
help: remove the `iter` usages
203195
|
204196
LL - let a = iter.next().unwrap();
205-
LL +
206197
|
207198
help: remove the `iter` usages
208199
|
209200
LL - let b = iter.next().unwrap();
210-
LL +
211201
|
212202

213203
error: aborting due to 19 previous errors

tests/ui/missing_const_for_fn/could_be_const.fixed

+4-1
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,18 @@ fn main() {}
104104

105105
struct D;
106106

107+
/* FIXME(effects)
107108
impl const Drop for D {
108109
fn drop(&mut self) {
109110
todo!();
110111
}
111112
}
113+
*/
112114

113115
// Lint this, since it can be dropped in const contexts
114116
// FIXME(effects)
115-
fn d(this: D) {}
117+
const fn d(this: D) {}
118+
//~^ ERROR: this could be a `const fn`
116119

117120
mod msrv {
118121
struct Foo(*const u8, &'static u8);

tests/ui/missing_const_for_fn/could_be_const.rs

+3
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,18 @@ fn main() {}
104104

105105
struct D;
106106

107+
/* FIXME(effects)
107108
impl const Drop for D {
108109
fn drop(&mut self) {
109110
todo!();
110111
}
111112
}
113+
*/
112114

113115
// Lint this, since it can be dropped in const contexts
114116
// FIXME(effects)
115117
fn d(this: D) {}
118+
//~^ ERROR: this could be a `const fn`
116119

117120
mod msrv {
118121
struct Foo(*const u8, &'static u8);

0 commit comments

Comments
 (0)