Skip to content

Commit 42434b4

Browse files
committed
Auto merge of #145423 - Zalathar:rollup-9jtefpl, r=Zalathar
Rollup of 21 pull requests Successful merges: - rust-lang/rust#118087 (Add Ref/RefMut try_map method) - rust-lang/rust#122661 (Change the desugaring of `assert!` for better error output) - rust-lang/rust#142640 (Implement autodiff using intrinsics) - rust-lang/rust#143075 (compiler: Allow `extern "interrupt" fn() -> !`) - rust-lang/rust#144865 (Fix tail calls to `#[track_caller]` functions) - rust-lang/rust#144944 (E0793: Clarify that it applies to unions as well) - rust-lang/rust#144947 (Fix description of unsigned `checked_exact_div`) - rust-lang/rust#145004 (Couple of minor cleanups) - rust-lang/rust#145005 (strip prefix of temporary file names when it exceeds filesystem name length limit) - rust-lang/rust#145012 (Tail call diagnostics to include lifetime info) - rust-lang/rust#145065 (resolve: Introduce `RibKind::Block`) - rust-lang/rust#145120 (llvm: Accept new LLVM lifetime format) - rust-lang/rust#145189 (Weekly `cargo update`) - rust-lang/rust#145235 (Minor `[const]` tweaks) - rust-lang/rust#145275 (fix(compiler/rustc_codegen_llvm): apply `target-cpu` attribute) - rust-lang/rust#145322 (Resolve the prelude import in `build_reduced_graph`) - rust-lang/rust#145331 (Make std use the edition 2024 prelude) - rust-lang/rust#145369 (Do not ICE on private type in field of unresolved struct) - rust-lang/rust#145378 (Add `FnContext` in parser for diagnostic) - rust-lang/rust#145389 ([rustdoc] Revert "rustdoc search: prefer stable items in search results") - rust-lang/rust#145392 (coverage: Remove intermediate data structures from mapping creation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7c55b50 + 47fe068 commit 42434b4

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

clippy_lints/src/missing_asserts_for_indexing.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_ast::{BinOpKind, LitKind, RangeLimits};
1111
use rustc_data_structures::packed::Pu128;
1212
use rustc_data_structures::unhash::UnindexMap;
1313
use rustc_errors::{Applicability, Diag};
14-
use rustc_hir::{Block, Body, Expr, ExprKind, UnOp};
14+
use rustc_hir::{Body, Expr, ExprKind};
1515
use rustc_lint::{LateContext, LateLintPass};
1616
use rustc_session::declare_lint_pass;
1717
use rustc_span::source_map::Spanned;
@@ -135,12 +135,12 @@ fn assert_len_expr<'hir>(
135135
cx: &LateContext<'_>,
136136
expr: &'hir Expr<'hir>,
137137
) -> Option<(LengthComparison, usize, &'hir Expr<'hir>)> {
138-
let (cmp, asserted_len, slice_len) = if let Some(higher::If { cond, then, .. }) = higher::If::hir(expr)
139-
&& let ExprKind::Unary(UnOp::Not, condition) = &cond.kind
140-
&& let ExprKind::Binary(bin_op, left, right) = &condition.kind
138+
let (cmp, asserted_len, slice_len) = if let Some(
139+
higher::IfLetOrMatch::Match(cond, [_, then], _)
140+
) = higher::IfLetOrMatch::parse(cx, expr)
141+
&& let ExprKind::Binary(bin_op, left, right) = &cond.kind
141142
// check if `then` block has a never type expression
142-
&& let ExprKind::Block(Block { expr: Some(then_expr), .. }, _) = then.kind
143-
&& cx.typeck_results().expr_ty(then_expr).is_never()
143+
&& cx.typeck_results().expr_ty(then.body).is_never()
144144
{
145145
len_comparison(bin_op.node, left, right)?
146146
} else if let Some((macro_call, bin_op)) = first_node_macro_backtrace(cx, expr).find_map(|macro_call| {

tests/ui/const_is_empty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ fn issue_13106() {
196196

197197
const {
198198
assert!(EMPTY_STR.is_empty());
199+
//~^ const_is_empty
199200
}
200201

201202
const {

tests/ui/const_is_empty.stderr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,16 @@ LL | let _ = val.is_empty();
158158
| ^^^^^^^^^^^^^^
159159

160160
error: this expression always evaluates to true
161-
--> tests/ui/const_is_empty.rs:202:9
161+
--> tests/ui/const_is_empty.rs:198:17
162+
|
163+
LL | assert!(EMPTY_STR.is_empty());
164+
| ^^^^^^^^^^^^^^^^^^^^
165+
166+
error: this expression always evaluates to true
167+
--> tests/ui/const_is_empty.rs:203:9
162168
|
163169
LL | EMPTY_STR.is_empty();
164170
| ^^^^^^^^^^^^^^^^^^^^
165171

166-
error: aborting due to 27 previous errors
172+
error: aborting due to 28 previous errors
167173

tests/ui/incompatible_msrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![warn(clippy::incompatible_msrv)]
22
#![feature(custom_inner_attributes)]
3-
#![allow(stable_features)]
3+
#![allow(stable_features, clippy::diverging_sub_expression)]
44
#![feature(strict_provenance)] // For use in test
55
#![clippy::msrv = "1.3.0"]
66

0 commit comments

Comments
 (0)