Skip to content

Conversation

@RalfJung
Copy link
Member

@RalfJung RalfJung commented Oct 27, 2025

The box_new intrinsic is super special: during THIR construction it turns into an ExprKind::Box (formerly known as the box keyword), which then during MIR building turns into a special instruction sequence that invokes the exchange_malloc lang item (which has a name from a different time) and a special MIR statement to represent a shallowly-initialized Box (which raises interesting opsem questions).

This PR is the n-th attempt to get rid of box_new. That's non-trivial because it usually causes a perf regression: replacing box_new by naive unsafe code will incur extra copies in debug builds, making the resulting binaries a lot slower, and will generate a lot more MIR, making compilation measurably slower. Furthermore, vec! is a macro, so the exact code it expands to is highly relevant for borrow checking, type inference, and temporary scopes.

To avoid those problems, this PR does its best to make the MIR almost exactly the same as what it was before. box_new is used in two places, Box::new and vec!:

  • For Box::new that is fairly easy: the move_by_value intrinsic is basically all we need. However, to avoid the extra copy that would usually be generated for the argument of a function call, we need to special-case this intrinsic during MIR building. That's what the first commit does.
  • vec! is a lot more tricky. As a macro, its details leak to stable code, so almost every variant I tried broke either type inference or the lifetimes of temporaries in some ui test or ended up accepting unsound code due to the borrow checker not enforcing all the constraints I hoped it would enforce. I ended up with a variant that involves a new intrinsic, fn write_box_via_move<T>(b: Box<MaybeUninit<T>>, x: T) -> Box<MaybeUninit<T>>, that writes a value into a Box<MaybeUninit<T>> and returns that box again. The MIR building code for this is non-trivial, but in exchange we can get rid of somewhat similar code in the lowering for ExprKind::Box. Sadly, we need a new lang item as I found no other way to get a pointer of the right type in MIR, but we do get rid of the exchange_malloc lang item in exchange. (We can also get rid of Rvalue::ShallowInitBox; I didn't include that in this PR -- I think @cjgillot has a commit for this somewhere.)

See here for the latest perf numbers. Most of the regressions are in deep-vector which consists entirely of an invocation of vec!, so any change to that macro affects this benchmark disproportionally.

This is my first time even looking at MIR building code, so I am very low confidence in that part of the patch, in particular when it comes to scopes and drops and things like that.

vec! FAQ

  • Why does write_box_via_move return the Box again? Because we need to expand vec! to a bunch of method invocations without any blocks or let-statements, or else the temporary scopes (and type inference) don't work out.
  • Why is box_uninit_array_into_vec_unsafe (unsoundly!) a safe function? Because we can't use an unsafe block in vec! as that would necessarily also include the $x (due to it all being one big method invocation) and therefore interpret the user's code as being inside unsafe, which would be bad (and 10 years later, we still don't have safe blocks for macros like this).
  • Why does write_box_via_move use Box as input/output type, and not, say, raw pointers? Because that is the only way to get the correct behavior when $x panics or has control effects: we need the Box to be dropped in that case. (As a nice side-effect this also makes the intrinsic safe, which is imported as explained in the previous bullet.)
  • Why is there a lang item just to convert from *mut Box<MaybeUninit<T>> to *mut T? Because we need to do that conversion when compiling write_box_via_move to MIR, and we can't do that conversion in pure MIR. We can't transmute because then the borrow checker loses track of how the lifetimes flow through these calls, which would be unsound. We can't get the raw pointer out from inside the Box via field projections because that is a *const pointer which we can't write to. We can't cast that to *mut because then we again lose track of the lifetimes. We can't change that pointer to be *mut because then NonNull would have the wrong variance (and 10 years later, we still don't have variance annotations).
  • Can't we make it safe by having write_box_via_move return Box<T>? Yes we could, but there's no easy way for the intrinsic to convert its Box<MaybeUninit<T>> to a Box<T>. We would need another lang item.
  • Is this macro truly cursed? Yes, yes it is.

@rustbot
Copy link
Collaborator

rustbot commented Oct 27, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

Some changes occurred in match checking

cc @Nadrieril

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 27, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

// rvalue,
// "Unexpected CastKind::Transmute {ty_from:?} -> {ty:?}, which is not permitted in Analysis MIR",
// ),
// }
Copy link
Member Author

@RalfJung RalfJung Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This obviously needs to be resolved before landing... what should we do here? A transmute cast is always well-typed (it is UB if the sizes mismatch), so... can we just do nothing? I don't know what the type checker inside borrow checker is about.^^

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIR typeck exists to collect all the lifetime constraints for borrowck to check. It also acts as a little bit of a double-check that typechecking on HIR actually checked everything it was supposed to, in some sense it's kind of the "soundness critical typeck". Having this do nothing seems fine to me, there's nothing to really typeck here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to still visit the cast type to find any lifetimes in there, or so?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this "is not permitted in Analysis MIR" part in the error I am removing here is odd as this is not documented in the MIR syntax where we usually list such restrictions, and also not checked by the MIR validator.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to still visit the cast type to find any lifetimes in there, or so?

I don't think so, that should be handled by the super_rvalue call at the top of this visit_rvalue fn

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we do need to check something here, right now nothing enforces that the lifetimes match for the various uses of T in init_box_via_move<T>(b: Box<MaybeUninit<T>>, x: T) -> Box<T>.

Comment on lines 445 to 449
// Make sure `StorageDead` gets emitted.
this.schedule_drop_storage_and_value(expr_span, this.local_scope(), ptr);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I am completely guessing... well really for all the changes in this file I am guessing, but the drop/storage scope stuff I know even less about than the rest of this.

block,
source_info,
Place::from(ptr),
// Needs to be a `Copy` so that `b` still gets dropped if `val` panics.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a Miri test to ensure the drop does indeed happen. That's the easiest way to check for memory leaks...

Comment on lines +292 to +304
// Nothing below can panic so we do not have to worry about deallocating `ptr`.
// SAFETY: we just allocated the box to store `x`.
unsafe { core::intrinsics::write_via_move(ptr, x) };
// SAFETY: we just initialized `b`.
unsafe { mem::transmute(ptr) }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using init_box_via_move here instead and it makes things a bit slower in some secondary benchmarks. I have no idea why.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This MIR is apparently so different from the previous one that it doesn't even show a diff (and the filename changed since I had to use CleanupPostBorrowck as built contains user types which contain super fragile DefIds). I have no idea what this test is testing and there are no filecheck annotations so... 😨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes fine? Who knows! At least the filecheck annotations in the test still pass.

StorageDead(_10);
StorageDead(_8);
StorageDead(_4);
drop(_3) -> [return: bb10, unwind: bb15];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the relevant drop... but the before drop-elaboration MIR makes this quite hard to say. No idea why that's what the test checks. I think after drop elaboration this is a lot more obvious as the drops of moved-out variables are gone.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2025

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fully a duplicate of something already tested in nll/user-annotations/patterns.rs.

Comment on lines 63 to 69
// FIXME: What is happening?!??
let _: Vec<&'static String> = vec![&String::new()];
//~^ ERROR temporary value dropped while borrowed [E0716]

let (_, a): (Vec<&'static String>, _) = (vec![&String::new()], 44);
//~^ ERROR temporary value dropped while borrowed [E0716]

let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44);
//~^ ERROR temporary value dropped while borrowed [E0716]
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what is happening here -- somehow code like let _: Vec<&'static String> = vec![&String::new()]; now compiles. I guess something is wrong with how I am lowering init_box_via_move?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably related to the transmutes there. Is there some way to insert those in a way that the lifetime constraints still get enforced?

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the box_new branch 2 times, most recently from 4e526d4 to cb7642b Compare October 28, 2025 07:41
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the box_new branch 2 times, most recently from 86e5a72 to 020bc3a Compare October 28, 2025 09:33
@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member Author

I can't think of any way to actually preserve these lifetimes while using transmutes... so we'll have to add more method calls to vec!, which will show up in perf. On the plus side it seems I misunderstood the errors I saw before regarding temporary scopes around vec!... or may our test suite just can't reproduce those problems.

So here's another redesign of the vec! macro. Macros were a mistake, and this one in particular has turned into my worst nightmare...

@bors try
@rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 28, 2025
replace box_new with lower-level intrinsics
@safinaskar
Copy link
Contributor

Consider this implementation:

#![allow(internal_features)]
#![feature(core_intrinsics)]
#![feature(rustc_attrs)]
#![feature(super_let)]

use std::mem::MaybeUninit;

// This function is actually safe
#[inline(always)] // Or #[rustc_force_inline]
#[rustc_nounwind]
fn write_to_box<T>(mut dst: Box<MaybeUninit<T>>, src: T) -> Box<T> {
    let x: &mut MaybeUninit<T> = &mut *dst;
    let x = x as *mut MaybeUninit<T> as *mut T;
    unsafe { core::intrinsics::write_via_move(x, src) };
    unsafe { dst.assume_init() }
}

macro_rules! my_vec {
    [$($x:expr),+ $(,)?] => {
        {
            let x = Box::new_uninit();
            super let x = (write_to_box(x, [$($x),+]) as Box<[_]>).into_vec();
            x
        }
    }
}
  • It works on nightly
  • Godbolt: https://godbolt.org/z/1af8Yoaoh
  • There is no any "this function is unsafe, but we marked it as safe"
  • My macro is panic-safe
  • Lifetimes work properly thanks to "super let"
  • My macro doesn't require adding new intrinsics

Unfortunately, codegen is suboptimal in debug builds. As you can see in Godbolt, there are additional copies involved for some particular type (see Godbolt), as opposed to current nightly vec!.

It seems this is not because of indirection, i. e. not because of function write_to_box. I tried to call write_via_move directly from macro, and I still get suboptimal codegen. It seems that the problem is in write_via_move itself, i. e. it is simply worse than current nightly box_new.

Feel free to use my code. Or combine it with yours

@RalfJung
Copy link
Member Author

RalfJung commented Nov 2, 2025

I tried that code (or something equivalent), but I can repeat the explanation of why it doesn't work:

Unfortunately, codegen is suboptimal in debug builds.

Yes, because you are moving [$($x),+] to a function argument instead of directly storing it into the destination.

I tried to call write_via_move directly from macro, and I still get suboptimal codegen.

That's because you don't have my branch where write_via_move changes to avoid exactly those copies. Please read the PR description, this is explained there.

@Walnut356
Copy link
Contributor

Walnut356 commented Nov 3, 2025

Howdy, I've looked into the test failure some. I'm not an expert on any of this by any means, but here's what I'm seeing:

I'm compiling a pared-down version of the test with rustc -g ./src/main.rs --emit llvm-ir

fn main() {
    zzz(); // #break

    let x = vec![42]; // #loc3

    zzz(); // #loc6
}
main function LLVM-IR via stable
; main::main
; Function Attrs: uwtable
define internal void @_ZN4main4main17h105998d931d8a56dE() unnamed_addr #0 personality ptr @__CxxFrameHandler3 !dbg !1388 {
start:
  %x = alloca [24 x i8], align 8
    #dbg_declare(ptr %x, !1392, !DIExpression(), !1394)
; call main::zzz
  call void @_ZN4main3zzz17h525fbd41aefd4fddE(), !dbg !1395
; call alloc::alloc::exchange_malloc
  %_6 = call ptr @_ZN5alloc5alloc15exchange_malloc17h0c9c47b68377fb04E(i64 4, i64 4), !dbg !1396
  %_11 = ptrtoint ptr %_6 to i64, !dbg !1396
  %_14 = and i64 %_11, 3, !dbg !1396
  %_15 = icmp eq i64 %_14, 0, !dbg !1396
  br i1 %_15, label %bb8, label %panic, !dbg !1396

bb8:                                              ; preds = %start
  %_17 = ptrtoint ptr %_6 to i64, !dbg !1396
  %_20 = icmp eq i64 %_17, 0, !dbg !1396
  %_21 = and i1 %_20, true, !dbg !1396
  %_22 = xor i1 %_21, true, !dbg !1396
  br i1 %_22, label %bb9, label %panic1, !dbg !1396

panic:                                            ; preds = %start
; call core::panicking::panic_misaligned_pointer_dereference
  call void @_ZN4core9panicking36panic_misaligned_pointer_dereference17h6e7340435152efe7E(i64 4, i64 %_11, ptr align 8 @alloc_cf8e02def08fd6c50b9df30b8c2413e4) #14, !dbg !1396
  unreachable, !dbg !1396

bb9:                                              ; preds = %bb8
  %0 = getelementptr inbounds nuw i32, ptr %_6, i64 0, !dbg !1396
  store i32 42, ptr %0, align 4, !dbg !1396
; call alloc::slice::<impl [T]>::into_vec
  call void @"_ZN5alloc5slice29_$LT$impl$u20$$u5b$T$u5d$$GT$8into_vec17heb69c3bf639d72bfE"(ptr sret([24 x i8]) align 8 %x, ptr align 4 %_6, i64 1), !dbg !1396
; invoke main::zzz
  invoke void @_ZN4main3zzz17h525fbd41aefd4fddE()
          to label %bb4 unwind label %funclet_bb6, !dbg !1397

panic1:                                           ; preds = %bb8
; call core::panicking::panic_null_pointer_dereference
  call void @_ZN4core9panicking30panic_null_pointer_dereference17hfc82d2d4db623c43E(ptr align 8 @alloc_cf8e02def08fd6c50b9df30b8c2413e4) #14, !dbg !1396
  unreachable, !dbg !1396

bb6:                                              ; preds = %funclet_bb6
; call core::ptr::drop_in_place<alloc::vec::Vec<i32>>
  call void @"_ZN4core3ptr47drop_in_place$LT$alloc..vec..Vec$LT$i32$GT$$GT$17h99bece23b8270328E"(ptr align 8 %x) #15 [ "funclet"(token %cleanuppad) ], !dbg !1398
  cleanupret from %cleanuppad unwind to caller, !dbg !1399

funclet_bb6:                                      ; preds = %bb9
  %cleanuppad = cleanuppad within none []
  br label %bb6

bb4:                                              ; preds = %bb9
; call core::ptr::drop_in_place<alloc::vec::Vec<i32>>
  call void @"_ZN4core3ptr47drop_in_place$LT$alloc..vec..Vec$LT$i32$GT$$GT$17h99bece23b8270328E"(ptr align 8 %x), !dbg !1398
  ret void, !dbg !1398
}
main function LLVM-IR via this PR
; main::main
; Function Attrs: uwtable
define hidden void @_ZN4main4main17h9686e224a639fa37E() unnamed_addr #0 personality ptr @rust_eh_personality !dbg !655 {
start:
  %b.dbg.spill.i3 = alloca [8 x i8], align 8
  %b.dbg.spill.i = alloca [8 x i8], align 8
  %0 = alloca [16 x i8], align 8
  %_4 = alloca [8 x i8], align 8
  %x = alloca [24 x i8], align 8
    #dbg_declare(ptr %x, !657, !DIExpression(), !659)
; call main::zzz
  call void @_ZN4main3zzz17ha5eb45a4a150cc22E(), !dbg !660
; call alloc::boxed::box_new_uninit
  %_1.i = call align 4 ptr @_ZN5alloc5boxed14box_new_uninit17he50a4dbe03251113E(i64 4, i64 4), !dbg !661
  store ptr %_1.i, ptr %_4, align 8, !dbg !669
  store ptr %_4, ptr %b.dbg.spill.i, align 8
    #dbg_declare(ptr %b.dbg.spill.i, !670, !DIExpression(), !676)
  %_4.i = load ptr, ptr %_4, align 8, !dbg !678
  br label %bb3, !dbg !679

bb8:                                              ; preds = %cleanup
; invoke core::ptr::drop_in_place<alloc::boxed::Box<core::mem::maybe_uninit::MaybeUninit<[i32; 1]>>>
  invoke void @"_ZN4core3ptr114drop_in_place$LT$alloc..boxed..Box$LT$core..mem..maybe_uninit..MaybeUninit$LT$$u5b$i32$u3b$$u20$1$u5d$$GT$$GT$$GT$17h5d515d80d8e99280E"(ptr align 8 %_4) #14
          to label %bb9 unwind label %terminate, !dbg !669

cleanup:                                          ; No predecessors!
  %1 = landingpad { ptr, i32 }
          cleanup
  %2 = extractvalue { ptr, i32 } %1, 0
  %3 = extractvalue { ptr, i32 } %1, 1
  store ptr %2, ptr %0, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %3, ptr %4, align 8
  br label %bb8

bb3:                                              ; preds = %start
  %_9 = ptrtoint ptr %_4.i to i64, !dbg !669
  %_11 = and i64 %_9, 3, !dbg !669
  %_12 = icmp eq i64 %_11, 0, !dbg !669
  br i1 %_12, label %bb10, label %panic, !dbg !669

bb10:                                             ; preds = %bb3
  %_14 = ptrtoint ptr %_4.i to i64, !dbg !669
  %_16 = icmp eq i64 %_14, 0, !dbg !669
  %_17 = and i1 %_16, true, !dbg !669
  %_18 = xor i1 %_17, true, !dbg !669
  br i1 %_18, label %bb11, label %panic1, !dbg !669

panic:                                            ; preds = %bb3
; call core::panicking::panic_misaligned_pointer_dereference
  call void @_ZN4core9panicking36panic_misaligned_pointer_dereference17h405de148aeb5f90bE(i64 4, i64 %_9, ptr align 8 @alloc_9199891e002284d755d36cef38ca1ec4) #17, !dbg !669
  unreachable, !dbg !669

bb11:                                             ; preds = %bb10
  %5 = getelementptr inbounds nuw i32, ptr %_4.i, i64 0, !dbg !669
  store i32 42, ptr %5, align 4, !dbg !669
  %_3 = load ptr, ptr %_4, align 8, !dbg !669
  store ptr %_3, ptr %b.dbg.spill.i3, align 8
    #dbg_declare(ptr %b.dbg.spill.i3, !680, !DIExpression(), !685)
; call alloc::boxed::Box<core::mem::maybe_uninit::MaybeUninit<T>,A>::assume_init
  %_3.i = call align 4 ptr @"_ZN5alloc5boxed60Box$LT$core..mem..maybe_uninit..MaybeUninit$LT$T$GT$$C$A$GT$11assume_init17he34683ba92371b9aE"(ptr align 4 %_3), !dbg !687
; call alloc::slice::<impl [T]>::into_vec
  call void @"_ZN5alloc5slice29_$LT$impl$u20$$u5b$T$u5d$$GT$8into_vec17h281036d717d9f9adE"(ptr sret([24 x i8]) align 8 %x, ptr align 4 %_3.i, i64 1), !dbg !688
; invoke main::zzz
  invoke void @_ZN4main3zzz17ha5eb45a4a150cc22E()
          to label %bb5 unwind label %cleanup2, !dbg !689

panic1:                                           ; preds = %bb10
; call core::panicking::panic_null_pointer_dereference
  call void @_ZN4core9panicking30panic_null_pointer_dereference17hd15a6708779e4dd5E(ptr align 8 @alloc_9199891e002284d755d36cef38ca1ec4) #17, !dbg !669
  unreachable, !dbg !669

bb7:                                              ; preds = %cleanup2
; invoke core::ptr::drop_in_place<alloc::vec::Vec<i32>>
  invoke void @"_ZN4core3ptr47drop_in_place$LT$alloc..vec..Vec$LT$i32$GT$$GT$17h513b29ff9eff6e60E"(ptr align 8 %x) #14
          to label %bb9 unwind label %terminate, !dbg !690

cleanup2:                                         ; preds = %bb11
  %6 = landingpad { ptr, i32 }
          cleanup
  %7 = extractvalue { ptr, i32 } %6, 0
  %8 = extractvalue { ptr, i32 } %6, 1
  store ptr %7, ptr %0, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %8, ptr %9, align 8
  br label %bb7

bb5:                                              ; preds = %bb11
; call core::ptr::drop_in_place<alloc::vec::Vec<i32>>
  call void @"_ZN4core3ptr47drop_in_place$LT$alloc..vec..Vec$LT$i32$GT$$GT$17h513b29ff9eff6e60E"(ptr align 8 %x), !dbg !690
  ret void, !dbg !691

terminate:                                        ; preds = %bb8, %bb7
  %10 = landingpad { ptr, i32 }
          filter [0 x ptr] zeroinitializer
; call core::panicking::panic_in_cleanup
  call void @_ZN4core9panicking16panic_in_cleanup17h33c8f66a4744c200E() #15, !dbg !692
  unreachable, !dbg !692

bb9:                                              ; preds = %bb8, %bb7
  %11 = load ptr, ptr %0, align 8, !dbg !692
  %12 = getelementptr inbounds i8, ptr %0, i64 8, !dbg !692
  %13 = load i32, ptr %12, align 8, !dbg !692
  %14 = insertvalue { ptr, i32 } poison, ptr %11, 0, !dbg !692
  %15 = insertvalue { ptr, i32 } %14, i32 %13, 1, !dbg !692
  resume { ptr, i32 } %15, !dbg !692
}

My first guess is that it's the actual function calls themselves, since there are 2:

; call alloc::boxed::Box<core::mem::maybe_uninit::MaybeUninit<T>,A>::assume_init
  %_3.i = call align 4 ptr @"_ZN5alloc5boxed60Box$LT$core..mem..maybe_uninit..MaybeUninit$LT$T$GT$$C$A$GT$11assume_init17he34683ba92371b9aE"(ptr align 4 %_3), !dbg !687
; call alloc::slice::<impl [T]>::into_vec
  call void @"_ZN5alloc5slice29_$LT$impl$u20$$u5b$T$u5d$$GT$8into_vec17h281036d717d9f9adE"(ptr sret([24 x i8]) align 8 %x, ptr align 4 %_3.i, i64 1), !dbg !688

Whereas with stable there is only a single call to exchange_malloc on stable:

; call alloc::alloc::exchange_malloc
  %_6 = call ptr @_ZN5alloc5alloc15exchange_malloc17h0c9c47b68377fb04E(i64 4, i64 4), !dbg !1396

My second guess would be it's the #debug_declares of the intermediate variables.

Notably, stable's main has only a single #dbg_declare which points to !1392:

%x = alloca [24 x i8], align 8
    #dbg_declare(ptr %x, !1392, !DIExpression(), !1394)
...
!1391 = !{!1392}
!1392 = !DILocalVariable(name: "x", scope: !1393, file: !1389, line: 111, type: !640, align: 64)
!1393 = distinct !DILexicalBlock(scope: !1388, file: !1389, line: 111)
!1394 = !DILocation(line: 111, scope: !1393)

That's source-line info + type

The pr's IR contains several #dbg_declare's. This is that same assignment to x:

%x = alloca [24 x i8], align 8
    #dbg_declare(ptr %x, !657, !DIExpression(), !659)
...
!656 = !{!657}
!657 = !DILocalVariable(name: "x", scope: !658, file: !652, line: 111, type: !242, align: 64)
!658 = distinct !DILexicalBlock(scope: !655, file: !652, line: 111, column: 5)
!659 = !DILocation(line: 111, column: 9, scope: !658)
...

This looks like an intermediate variable `b` from `box_uninit_as_mut_ptr<[i32; 1]>`, which is inlined (also keep the `%_4` identifier in mind):

```llvm
store ptr %_4, ptr %b.dbg.spill.i, align 8
    #dbg_declare(ptr %b.dbg.spill.i, !670, !DIExpression(), !676)
...
!670 = !DILocalVariable(name: "b", arg: 1, scope: !671, file: !663, line: 255, type: !216)
!671 = distinct !DISubprogram(name: "box_uninit_as_mut_ptr<[i32; 1]>", linkageName: "_ZN5alloc5boxed21box_uninit_as_mut_ptr17h7a86c3dbd98d7bf5E", scope: !665, file: !663, line: 255, type: !672, scopeLine: 255, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !29, templateParams: !231, retainedNodes: !675)
!672 = !DISubroutineType(types: !673)
!673 = !{!674, !216}
!674 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "*mut [i32; 1]", baseType: !228, size: 64, align: 64, dwarfAddressSpace: 0)
!675 = !{!670}
!676 = !DILocation(line: 255, column: 36, scope: !671, inlinedAt: !677)
!677 = distinct !DILocation(line: 111, column: 13, scope: !655)

This is another intermediate b variable from box_uninit_array_into_vec_unsafe<i32, 1>

store ptr %_3, ptr %b.dbg.spill.i3, align 8
    #dbg_declare(ptr %b.dbg.spill.i3, !680, !DIExpression(), !685)
...
!680 = !DILocalVariable(name: "b", arg: 1, scope: !681, file: !663, line: 266, type: !217)
!681 = distinct !DISubprogram(name: "box_uninit_array_into_vec_unsafe<i32, 1>", linkageName: "_ZN5alloc5boxed32box_uninit_array_into_vec_unsafe17h1eaff6ce378da9adE", scope: !665, file: !663, line: 265, type: !682, scopeLine: 265, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !29, templateParams: !280, retainedNodes: !684)
!682 = !DISubroutineType(types: !683)
!683 = !{!242, !217}
!684 = !{!680}
!685 = !DILocation(line: 266, column: 5, scope: !681, inlinedAt: !686)
!686 = distinct !DILocation(line: 111, column: 13, scope: !655)

this b is based on the prior b (%_4) and is then passed (in some form) to alloc::boxed::Box<core::mem::maybe_uninit::MaybeUninit<T>,A>::assume_init and alloc::slice::<impl [T]>::into_vec

@Walnut356
Copy link
Contributor

(i will also say though, if there's not an easy solution, having to step twice to step over the vec macro doesn't seem like it's the end of the world)

@RalfJung RalfJung force-pushed the box_new branch 2 times, most recently from 82fdb20 to 3ca2b21 Compare November 3, 2025 07:42
@RalfJung
Copy link
Member Author

RalfJung commented Nov 3, 2025

Thanks for taking a look!

My first guess is that it's the actual function calls themselves, since there are 2:

There are more calls, there's also alloc::boxed::box_new_uninit with this PR -- which corresponds to exchange_malloc before the PR (it's the same function, just renamed).

I also do see a call to alloc::slice::<impl [T]>::into_vec in your before-PR IR. So it was two calls already, and the debugger was happy to jump over both of them. Now it's three calls (the new one being assume_init) and then it doesn't like it any more. I have tried marking assume_init as inline(always), which should get rid of the call even for debug builds, and that changed nothing. So I don't think it's the number of calls.

My second guess would be it's the #debug_declares of the intermediate variables.

That sounds more likely. However, in MIR I am giving all these things the same span, so I have no clue why the LLVM backend decides to give them different debug info.

// gdb-check:[...]#loc3[...]
// gdb-command:next
// FIXME: for some reason we need two `next` to skip over the `vec!`.
// gdb-command:next
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now made the test pass by adding a second next invocation here... but clearly that's not the actually intended behavior. I just have no idea how to make the debugger jump over the entire thing in a single step again.

@davidtwco
Copy link
Member

@davidtwco you are listed as reviewer for debuginfo things... do you have an idea what is happening here?

I'm afraid I only really know much about our split debuginfo implementation.

@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@saethlin
Copy link
Member

saethlin commented Nov 4, 2025

@khuey you have contributed some great fixes to our debuginfo in the past, do you have any insight on what's happening with tests/debuginfo/macro-stepping.rs here?

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@khuey
Copy link
Contributor

khuey commented Nov 4, 2025

fyi I'm out of the office today and can't look until later this week.

@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-log-analyzer

This comment has been minimized.

requires lowering write_via_move during MIR building to make it just like an assignment
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/should_impl_trait/method_list_2.rs (revision `edition2021`) ... ok
tests/ui/crashes/third-party/conf_allowlisted.rs ... ok

FAILED TEST: tests/ui/borrow_as_ptr.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/borrow_as_ptr.rs" "--extern" "proc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary/libproc_macros.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/borrow_as_ptr.stderr` to the actual output
--- tests/ui/borrow_as_ptr.stderr
+++ <stderr output>
 error: borrow as raw pointer
   --> tests/ui/borrow_as_ptr.rs:14:14
... 5 lines skipped ...
    = help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`
 
+error: current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.82.0`
+  --> tests/ui/borrow_as_ptr.rs:18:15
+   |
+LL |     let vec = vec![1];
+   |               ^^^^^^^
+   |
---
Full unnormalized output:
error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:14:14
   |
LL |     let _p = &val as *const i32;
   |              ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of!(val)`
   |
   = note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`

error: current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/borrow_as_ptr.rs:18:15
   |
LL |     let vec = vec![1];
   |               ^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:22:18
   |
LL |     let _p_mut = &mut val_mut as *mut i32;
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of_mut!(val_mut)`

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:26:16
   |
LL |     let _raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
   |                ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of_mut!(x[1])`

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:32:17
   |
LL |     let _raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
   |                 ^^^^^^^^^^^^^^^^^^^^^ help: try: `&raw mut x[1]`

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:38:25
   |
LL |     let p: *const i32 = &val;
   |                         ^^^^
   |
help: use a raw pointer instead
   |
LL |     let p: *const i32 = &raw const val;
   |                          +++++++++

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:42:23
   |
---

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:47:19
   |
LL |     core::ptr::eq(&val, &1);
   |                   ^^^^
   |
help: use a raw pointer instead
   |
LL |     core::ptr::eq(&raw const val, &1);
   |                    +++++++++

error: aborting due to 8 previous errors



error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/borrow_as_ptr.rs:18:15
   |
18 |     let vec = vec![1];
   |               ^^^^^^^ Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.82.0`
   |

full stderr:
error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:14:14
   |
LL |     let _p = &val as *const i32;
   |              ^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of!(val)`
   |
   = note: `-D clippy::borrow-as-ptr` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::borrow_as_ptr)]`

error: current MSRV (Minimum Supported Rust Version) is `1.75.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/borrow_as_ptr.rs:18:15
   |
LL |     let vec = vec![1];
   |               ^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:22:18
   |
LL |     let _p_mut = &mut val_mut as *mut i32;
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of_mut!(val_mut)`

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:26:16
   |
LL |     let _raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
   |                ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::addr_of_mut!(x[1])`

error: borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:32:17
   |
LL |     let _raw = (&mut x[1] as *mut i32).wrapping_offset(-1);
   |                 ^^^^^^^^^^^^^^^^^^^^^ help: try: `&raw mut x[1]`

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:38:25
   |
LL |     let p: *const i32 = &val;
   |                         ^^^^
   |
help: use a raw pointer instead
   |
LL |     let p: *const i32 = &raw const val;
   |                          +++++++++

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:42:23
   |
---

error: implicit borrow as raw pointer
##[error]  --> tests/ui/borrow_as_ptr.rs:47:19
   |
LL |     core::ptr::eq(&val, &1);
   |                   ^^^^
   |
help: use a raw pointer instead
   |
LL |     core::ptr::eq(&raw const val, &1);
   |                    +++++++++

error: aborting due to 8 previous errors


full stdout:



FAILED TEST: tests/ui/byte_char_slices.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/byte_char_slices.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/byte_char_slices.stderr` to the actual output
--- tests/ui/byte_char_slices.stderr
+++ <stderr output>
 error: can be more succinctly written as a byte str
   --> tests/ui/byte_char_slices.rs:5:15
... 23 lines skipped ...
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b"\x42Esc"`
 
-error: useless use of `vec!`
-  --> tests/ui/byte_char_slices.rs:15:16
-   |
-LL |     let good = vec![b'a', b'a'];
-   |                ^^^^^^^^^^^^^^^^ help: you can use an array directly: `[b'a', b'a']`
-   |
-   = note: `-D clippy::useless-vec` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`
+error: aborting due to 4 previous errors
 
-error: aborting due to 5 previous errors
-

Full unnormalized output:
error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:5:15
   |
LL |     let bad = &[b'a', b'b', b'c'];
   |               ^^^^^^^^^^^^^^^^^^^ help: try: `b"abc"`
   |
   = note: `-D clippy::byte-char-slices` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::byte_char_slices)]`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:7:18
   |
LL |     let quotes = &[b'"', b'H', b'i'];
   |                  ^^^^^^^^^^^^^^^^^^^ help: try: `b"\"Hi"`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:9:18
   |
LL |     let quotes = &[b'\'', b'S', b'u', b'p'];
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b"'Sup"`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:11:19
   |
LL |     let escapes = &[b'\x42', b'E', b's', b'c'];
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b"\x42Esc"`

error: aborting due to 4 previous errors



---
full stderr:
error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:5:15
   |
LL |     let bad = &[b'a', b'b', b'c'];
   |               ^^^^^^^^^^^^^^^^^^^ help: try: `b"abc"`
   |
   = note: `-D clippy::byte-char-slices` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::byte_char_slices)]`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:7:18
   |
LL |     let quotes = &[b'"', b'H', b'i'];
   |                  ^^^^^^^^^^^^^^^^^^^ help: try: `b"\"Hi"`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:9:18
   |
LL |     let quotes = &[b'\'', b'S', b'u', b'p'];
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b"'Sup"`

error: can be more succinctly written as a byte str
##[error]  --> tests/ui/byte_char_slices.rs:11:19
   |
LL |     let escapes = &[b'\x42', b'E', b's', b'c'];
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `b"\x42Esc"`

error: aborting due to 4 previous errors


full stdout:



FAILED TEST: tests/ui/iter_out_of_bounds.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/iter_out_of_bounds.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/iter_out_of_bounds.stderr` to the actual output
--- tests/ui/iter_out_of_bounds.stderr
+++ <stderr output>
 error: this `.skip()` call skips more items than the iterator will produce
   --> tests/ui/iter_out_of_bounds.rs:10:14
... 42 lines skipped ...
 
 error: this `.skip()` call skips more items than the iterator will produce
-  --> tests/ui/iter_out_of_bounds.rs:34:14
-   |
-LL |     for _ in vec![1, 2, 3].iter().skip(4) {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: this operation is useless and will create an empty iterator
-
-error: this `.skip()` call skips more items than the iterator will produce
   --> tests/ui/iter_out_of_bounds.rs:37:14
    |
... 59 lines skipped ...
    = note: this operation is useless and the returned iterator will simply yield the same items
 
-error: aborting due to 14 previous errors
+error: aborting due to 13 previous errors
 

Full unnormalized output:
error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:10:14
   |
LL |     for _ in [1, 2, 3].iter().skip(4) {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator
note: the lint level is defined here
  --> tests/ui/iter_out_of_bounds.rs:1:9
   |
LL | #![deny(clippy::iter_out_of_bounds)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:15:19
   |
LL |     for (i, _) in [1, 2, 3].iter().take(4).enumerate() {
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:22:14
   |
LL |     for _ in (&&&&&&[1, 2, 3]).iter().take(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:25:14
   |
LL |     for _ in [1, 2, 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:28:14
   |
LL |     for _ in [1; 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:37:14
   |
LL |     for _ in vec![1; 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:41:14
   |
LL |     for _ in x.iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:45:14
   |
LL |     for _ in x.iter().skip(n) {}
   |              ^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:50:14
   |
LL |     for _ in empty().skip(1) {}
   |              ^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:53:14
   |
LL |     for _ in empty().take(1) {}
   |              ^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:56:14
   |
LL |     for _ in std::iter::once(1).skip(2) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.take()` call takes more items than the iterator will produce
---

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:62:14
   |
LL |     for x in [].iter().take(1) {
   |              ^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: aborting due to 13 previous errors
---
   |          ^^^^^^^^^^^^^^^^^^ expected because of this pattern
   |

full stderr:
error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:10:14
   |
LL |     for _ in [1, 2, 3].iter().skip(4) {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator
note: the lint level is defined here
  --> tests/ui/iter_out_of_bounds.rs:1:9
   |
LL | #![deny(clippy::iter_out_of_bounds)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:15:19
   |
LL |     for (i, _) in [1, 2, 3].iter().take(4).enumerate() {
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:22:14
   |
LL |     for _ in (&&&&&&[1, 2, 3]).iter().take(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:25:14
   |
LL |     for _ in [1, 2, 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:28:14
   |
LL |     for _ in [1; 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:37:14
   |
LL |     for _ in vec![1; 3].iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:41:14
   |
LL |     for _ in x.iter().skip(4) {}
   |              ^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:45:14
   |
LL |     for _ in x.iter().skip(n) {}
   |              ^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:50:14
   |
LL |     for _ in empty().skip(1) {}
   |              ^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:53:14
   |
LL |     for _ in empty().take(1) {}
   |              ^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: this `.skip()` call skips more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:56:14
   |
LL |     for _ in std::iter::once(1).skip(2) {}
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and will create an empty iterator

error: this `.take()` call takes more items than the iterator will produce
---

error: this `.take()` call takes more items than the iterator will produce
##[error]  --> tests/ui/iter_out_of_bounds.rs:62:14
   |
LL |     for x in [].iter().take(1) {
   |              ^^^^^^^^^^^^^^^^^
   |
   = note: this operation is useless and the returned iterator will simply yield the same items

error: aborting due to 13 previous errors


full stdout:



FAILED TEST: tests/ui/manual_map_option.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/manual_map_option.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/manual_map_option.stderr` to the actual output
--- tests/ui/manual_map_option.stderr
+++ <stderr output>
---
 error: manual implementation of `Option::map`
+  --> tests/ui/manual_map_option.rs:185:5
+   |
+LL | /     match Some(0) {
+LL | |         Some(x) => Some(vec![x]),
+LL | |         None => None,
+LL | |     };
+   | |_____^ help: try: `Some(0).map(|x| vec![x])`
+
+error: manual implementation of `Option::map`
   --> tests/ui/manual_map_option.rs:196:5
    |
... 29 lines skipped ...
    | |_____^ help: try: `{ Some(0).map(|x| x + 1) }`
 
-error: aborting due to 20 previous errors
+error: aborting due to 21 previous errors
 

---
LL | |
LL | |         Some(_) => Some(2),
LL | |         None::<u32> => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|_| 2)`
   |
   = note: `-D clippy::manual-map` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::manual_map)]`

error: manual implementation of `Option::map`
---
##[error]  --> tests/ui/manual_map_option.rs:40:5
   |
LL | /     match Some(0) {
LL | |
LL | |         Some(x) => { Some(std::convert::identity(x)) }
LL | |         None => { None }
LL | |     };
   | |_____^ help: try: `Some(0).map(std::convert::identity)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:46:5
   |
LL | /     match Some(&String::new()) {
LL | |
LL | |         Some(x) => Some(str::len(x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(&String::new()).map(|x| str::len(x))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:57:5
   |
LL | /     match &Some([0, 1]) {
LL | |
LL | |         Some(x) => Some(x[0]),
LL | |         &None => None,
LL | |     };
   | |_____^ help: try: `Some([0, 1]).as_ref().map(|x| x[0])`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:63:5
   |
LL | /     match &Some(0) {
LL | |
LL | |         &Some(x) => Some(x * 2),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| x * 2)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:69:5
   |
LL | /     match Some(String::new()) {
LL | |
LL | |         Some(ref x) => Some(x.is_empty()),
LL | |         _ => None,
LL | |     };
   | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())`

error: manual implementation of `Option::map`
---
##[error]  --> tests/ui/manual_map_option.rs:81:5
   |
LL | /     match &&Some(0) {
LL | |
LL | |         &&Some(x) => Some(x + x),
LL | |         &&_ => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| x + x)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:95:9
   |
LL | /         match &mut Some(String::new()) {
LL | |
LL | |             Some(x) => Some(x.push_str("")),
LL | |             None => None,
LL | |         };
   | |_________^ help: try: `Some(String::new()).as_mut().map(|x| x.push_str(""))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:102:5
   |
LL | /     match &mut Some(String::new()) {
LL | |
LL | |         &mut Some(ref x) => Some(x.len()),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())`

error: manual implementation of `Option::map`
---

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:114:5
   |
LL | /     match Some((0, 1, 2)) {
LL | |
LL | |         Some((x, y, z)) => Some(x + y + z),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:120:5
   |
LL | /     match Some([1, 2, 3]) {
LL | |
LL | |         Some([first, ..]) => Some(first),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some([1, 2, 3]).map(|[first, ..]| first)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:126:5
   |
LL | /     match &Some((String::new(), "test")) {
LL | |
LL | |         Some((x, y)) => Some((y, x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:185:5
   |
LL | /     match Some(0) {
LL | |         Some(x) => Some(vec![x]),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| vec![x])`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:196:5
   |
LL | /     match option_env!("") {
LL | |
LL | |         Some(x) => Some(String::from(x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `option_env!("").map(String::from)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:217:12
   |
LL |       } else if let Some(x) = Some(0) {
   |  ____________^
LL | |
LL | |         Some(x + 1)
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^ help: try: `{ Some(0).map(|x| x + 1) }`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:226:12
   |
LL |       } else if let Some(x) = Some(0) {
   |  ____________^
LL | |
LL | |         Some(x + 1)
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^ help: try: `{ Some(0).map(|x| x + 1) }`

error: aborting due to 21 previous errors



error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/manual_map_option.rs:185:5
    |
185 | /     match Some(0) {
186 | |         Some(x) => Some(vec![x]),
187 | |         None => None,
188 | |     };
    | |_____^ Error[clippy::manual_map]: manual implementation of `Option::map`
    |

full stderr:
error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:14:5
   |
LL | /     match Some(0) {
LL | |
LL | |         Some(_) => Some(2),
LL | |         None::<u32> => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|_| 2)`
   |
   = note: `-D clippy::manual-map` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::manual_map)]`

error: manual implementation of `Option::map`
---
##[error]  --> tests/ui/manual_map_option.rs:40:5
   |
LL | /     match Some(0) {
LL | |
LL | |         Some(x) => { Some(std::convert::identity(x)) }
LL | |         None => { None }
LL | |     };
   | |_____^ help: try: `Some(0).map(std::convert::identity)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:46:5
   |
LL | /     match Some(&String::new()) {
LL | |
LL | |         Some(x) => Some(str::len(x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(&String::new()).map(|x| str::len(x))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:57:5
   |
LL | /     match &Some([0, 1]) {
LL | |
LL | |         Some(x) => Some(x[0]),
LL | |         &None => None,
LL | |     };
   | |_____^ help: try: `Some([0, 1]).as_ref().map(|x| x[0])`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:63:5
   |
LL | /     match &Some(0) {
LL | |
LL | |         &Some(x) => Some(x * 2),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| x * 2)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:69:5
   |
LL | /     match Some(String::new()) {
LL | |
LL | |         Some(ref x) => Some(x.is_empty()),
LL | |         _ => None,
LL | |     };
   | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.is_empty())`

error: manual implementation of `Option::map`
---
##[error]  --> tests/ui/manual_map_option.rs:81:5
   |
LL | /     match &&Some(0) {
LL | |
LL | |         &&Some(x) => Some(x + x),
LL | |         &&_ => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| x + x)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:95:9
   |
LL | /         match &mut Some(String::new()) {
LL | |
LL | |             Some(x) => Some(x.push_str("")),
LL | |             None => None,
LL | |         };
   | |_________^ help: try: `Some(String::new()).as_mut().map(|x| x.push_str(""))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:102:5
   |
LL | /     match &mut Some(String::new()) {
LL | |
LL | |         &mut Some(ref x) => Some(x.len()),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(String::new()).as_ref().map(|x| x.len())`

error: manual implementation of `Option::map`
---

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:114:5
   |
LL | /     match Some((0, 1, 2)) {
LL | |
LL | |         Some((x, y, z)) => Some(x + y + z),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:120:5
   |
LL | /     match Some([1, 2, 3]) {
LL | |
LL | |         Some([first, ..]) => Some(first),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some([1, 2, 3]).map(|[first, ..]| first)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:126:5
   |
LL | /     match &Some((String::new(), "test")) {
LL | |
LL | |         Some((x, y)) => Some((y, x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:185:5
   |
LL | /     match Some(0) {
LL | |         Some(x) => Some(vec![x]),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `Some(0).map(|x| vec![x])`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:196:5
   |
LL | /     match option_env!("") {
LL | |
LL | |         Some(x) => Some(String::from(x)),
LL | |         None => None,
LL | |     };
   | |_____^ help: try: `option_env!("").map(String::from)`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:217:12
   |
LL |       } else if let Some(x) = Some(0) {
   |  ____________^
LL | |
LL | |         Some(x + 1)
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^ help: try: `{ Some(0).map(|x| x + 1) }`

error: manual implementation of `Option::map`
##[error]  --> tests/ui/manual_map_option.rs:226:12
   |
LL |       } else if let Some(x) = Some(0) {
   |  ____________^
LL | |
LL | |         Some(x + 1)
LL | |     } else {
LL | |         None
LL | |     };
   | |_____^ help: try: `{ Some(0).map(|x| x + 1) }`

error: aborting due to 21 previous errors


full stdout:



FAILED TEST: tests/ui/methods_fixable.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/methods_fixable.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/methods_fixable.stderr` to the actual output
--- tests/ui/methods_fixable.stderr
+++ <stderr output>
 error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
   --> tests/ui/methods_fixable.rs:9:13
... 17 lines skipped ...
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec![1].into_iter().rfind(|&x| x < 0)`
 
-error: aborting due to 3 previous errors
+error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.36.0`
+  --> tests/ui/methods_fixable.rs:18:13
+   |
+LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
+   |             ^^^^^^^
+   |
+   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
+error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.82.0`
+  --> tests/ui/methods_fixable.rs:18:13
+   |
+LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
+   |             ^^^^^^^
+   |
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.36.0`
+  --> tests/ui/methods_fixable.rs:24:13
+   |
+LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
+   |             ^^^^^^^
+   |
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.82.0`
+  --> tests/ui/methods_fixable.rs:24:13
+   |
+LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
+   |             ^^^^^^^
+   |
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 7 previous errors
+

Full unnormalized output:
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:9:13
   |
LL |     let _ = v.iter().filter(|&x| *x < 0).next();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `v.iter().find(|&x| *x < 0)`
   |
   = note: `-D clippy::filter-next` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::filter_next)]`

error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:12:13
   |
LL |     let _ = v.iter().filter(|&x| *x < 0).next_back();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `v.iter().rfind(|&x| *x < 0)`

error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec![1].into_iter().rfind(|&x| x < 0)`

error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.36.0`
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.36.0`
##[error]  --> tests/ui/methods_fixable.rs:24:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/methods_fixable.rs:24:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 7 previous errors



error: there were 2 unmatched diagnostics
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
18 |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |             |
   |             Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.36.0`
   |             Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.82.0`
   |

error: there were 2 unmatched diagnostics
##[error]  --> tests/ui/methods_fixable.rs:24:13
   |
24 |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |             |
   |             Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.36.0`
   |             Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.82.0`
   |

full stderr:
error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:9:13
   |
LL |     let _ = v.iter().filter(|&x| *x < 0).next();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `v.iter().find(|&x| *x < 0)`
   |
   = note: `-D clippy::filter-next` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::filter_next)]`

error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:12:13
   |
LL |     let _ = v.iter().filter(|&x| *x < 0).next_back();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `v.iter().rfind(|&x| *x < 0)`

error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `vec![1].into_iter().rfind(|&x| x < 0)`

error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.36.0`
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.27.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/methods_fixable.rs:18:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.36.0`
##[error]  --> tests/ui/methods_fixable.rs:24:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.26.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/methods_fixable.rs:24:13
   |
LL |     let _ = vec![1].into_iter().filter(|&x| x < 0).next_back();
   |             ^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 7 previous errors


full stdout:



FAILED TEST: tests/ui/or_fun_call.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/or_fun_call.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/or_fun_call.stderr` to the actual output
--- tests/ui/or_fun_call.stderr
+++ <stderr output>
---
 
-error: use of `unwrap_or` to construct default value
-  --> tests/ui/or_fun_call.rs:57:14
-   |
-LL |     with_new.unwrap_or(Vec::new());
-   |              ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
-   |
-   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`
-
 error: function call inside of `unwrap_or`
   --> tests/ui/or_fun_call.rs:61:21
... 19 lines skipped ...
 LL |     with_default_trait.unwrap_or(Default::default());
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
+   |
+   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`
 
 error: use of `unwrap_or` to construct default value
---
 
 error: use of `unwrap_or_else` to construct default value
-  --> tests/ui/or_fun_call.rs:333:18
-   |
-LL |         with_new.unwrap_or_else(Vec::new);
-   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
-
-error: use of `unwrap_or_else` to construct default value
   --> tests/ui/or_fun_call.rs:337:28
    |
... 141 lines skipped ...
---

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:65:14
   |
LL |     with_err.unwrap_or(make());
   |              ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:69:19
   |
LL |     with_err_args.unwrap_or(Vec::with_capacity(12));
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:73:24
   |
LL |     with_default_trait.unwrap_or(Default::default());
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
   |
   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`

error: use of `unwrap_or` to construct default value
---

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:97:18
   |
LL |     self_default.unwrap_or(<FakeDefault>::default());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(<FakeDefault>::default)`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:101:18
   |
LL |     real_default.unwrap_or(<FakeDefault as Default>::default());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:109:21
   |
LL |     without_default.unwrap_or(Foo::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:113:19
   |
LL |     map.entry(42).or_insert(String::new());
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:117:23
   |
LL |     map_vec.entry(42).or_insert(Vec::new());
   |                       ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:121:21
   |
LL |     btree.entry(42).or_insert(String::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:125:25
   |
LL |     btree_vec.entry(42).or_insert(Vec::new());
   |                         ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:129:21
   |
LL |     let _ = stringy.unwrap_or(String::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `ok_or`
##[error]  --> tests/ui/or_fun_call.rs:134:17
   |
LL |     let _ = opt.ok_or(format!("{} world.", hello));
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:139:21
   |
LL |     let _ = Some(1).unwrap_or(map[&1]);
   |                     ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:142:21
   |
LL |     let _ = Some(1).unwrap_or(map[&1]);
   |                     ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`

error: function call inside of `or`
##[error]  --> tests/ui/or_fun_call.rs:167:35
   |
LL |     let _ = Some("a".to_string()).or(Some("b".to_string()));
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:210:18
   |
LL |             None.unwrap_or(ptr_to_ref(s));
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:218:14
   |
LL |         None.unwrap_or(unsafe { ptr_to_ref(s) });
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:221:14
   |
LL |         None.unwrap_or( unsafe { ptr_to_ref(s) }    );
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:297:25
   |
LL |         let _ = Some(4).map_or(g(), |v| v);
   |                         ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:299:25
   |
LL |         let _ = Some(4).map_or(g(), f);
   |                         ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:302:25
   |
LL |         let _ = Some(4).map_or("asd".to_string().len() as i32, f);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| "asd".to_string().len() as i32, f)`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:337:28
   |
LL |         with_default_trait.unwrap_or_else(Default::default);
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:341:27
   |
LL |         with_default_type.unwrap_or_else(u64::default);
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:345:22
   |
LL |         real_default.unwrap_or_else(<FakeDefault as Default>::default);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:349:23
   |
LL |         map.entry(42).or_insert_with(String::new);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:353:25
   |
LL |         btree.entry(42).or_insert_with(String::new);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:357:25
   |
LL |         let _ = stringy.unwrap_or_else(String::new);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:399:17
   |
LL |     let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)`
   |                 ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:404:17
   |
LL |     let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)`
   |                 ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:409:17
   |
LL |       let _ = opt.unwrap_or({
   |  _________________^
LL | |
LL | |         let x = f();
LL | |         x + 1
LL | |     });
   | |______^
   |
help: try
   |
LL ~     let _ = opt.unwrap_or_else(|| {
LL +
LL +         let x = f();
LL +         x + 1
LL ~     });
   |

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:415:17
   |
LL |     let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)`
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| f() + 1, |v| v)`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:420:17
   |
LL |     let _ = opt.unwrap_or({ i32::default() });
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:427:21
   |
LL |     let _ = opt_foo.unwrap_or(Foo { val: String::default() });
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:442:19
   |
LL |         let _ = x.map_or(g(), |v| v);
   |                   ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), |v| v)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:444:19
   |
LL |         let _ = x.map_or(g(), f);
   |                   ^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), f)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:447:19
   |
LL |         let _ = x.map_or("asd".to_string().len() as i32, f);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| "asd".to_string().len() as i32, f)`

error: function call inside of `get_or_insert`
##[error]  --> tests/ui/or_fun_call.rs:458:15
   |
LL |     let _ = x.get_or_insert(g());
   |               ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)`

error: function call inside of `and`
##[error]  --> tests/ui/or_fun_call.rs:468:15
   |
LL |     let _ = x.and(g());
   |               ^^^^^^^^ help: try: `and_then(|_| g())`

error: function call inside of `and`
##[error]  --> tests/ui/or_fun_call.rs:478:15
   |
LL |     let _ = x.and(g());
   |               ^^^^^^^^ help: try: `and_then(|_| g())`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:484:17
   |
LL |     let _ = opt.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:486:17
   |
LL |     let _ = res.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Default::default())`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:492:17
   |
LL |     let _ = opt.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:494:17
   |
LL |     let _ = res.unwrap_or(Default::default());
---

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:65:14
   |
LL |     with_err.unwrap_or(make());
   |              ^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| make())`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:69:19
   |
LL |     with_err_args.unwrap_or(Vec::with_capacity(12));
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Vec::with_capacity(12))`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:73:24
   |
LL |     with_default_trait.unwrap_or(Default::default());
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
   |
   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`

error: use of `unwrap_or` to construct default value
---

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:97:18
   |
LL |     self_default.unwrap_or(<FakeDefault>::default());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(<FakeDefault>::default)`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:101:18
   |
LL |     real_default.unwrap_or(<FakeDefault as Default>::default());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:109:21
   |
LL |     without_default.unwrap_or(Foo::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(Foo::new)`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:113:19
   |
LL |     map.entry(42).or_insert(String::new());
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:117:23
   |
LL |     map_vec.entry(42).or_insert(Vec::new());
   |                       ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:121:21
   |
LL |     btree.entry(42).or_insert(String::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:125:25
   |
LL |     btree_vec.entry(42).or_insert(Vec::new());
   |                         ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:129:21
   |
LL |     let _ = stringy.unwrap_or(String::new());
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `ok_or`
##[error]  --> tests/ui/or_fun_call.rs:134:17
   |
LL |     let _ = opt.ok_or(format!("{} world.", hello));
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ok_or_else(|| format!("{} world.", hello))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:139:21
   |
LL |     let _ = Some(1).unwrap_or(map[&1]);
   |                     ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:142:21
   |
LL |     let _ = Some(1).unwrap_or(map[&1]);
   |                     ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| map[&1])`

error: function call inside of `or`
##[error]  --> tests/ui/or_fun_call.rs:167:35
   |
LL |     let _ = Some("a".to_string()).or(Some("b".to_string()));
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_else(|| Some("b".to_string()))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:210:18
   |
LL |             None.unwrap_or(ptr_to_ref(s));
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| ptr_to_ref(s))`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:218:14
   |
LL |         None.unwrap_or(unsafe { ptr_to_ref(s) });
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:221:14
   |
LL |         None.unwrap_or( unsafe { ptr_to_ref(s) }    );
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| unsafe { ptr_to_ref(s) })`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:297:25
   |
LL |         let _ = Some(4).map_or(g(), |v| v);
   |                         ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(g, |v| v)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:299:25
   |
LL |         let _ = Some(4).map_or(g(), f);
   |                         ^^^^^^^^^^^^^^ help: try: `map_or_else(g, f)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:302:25
   |
LL |         let _ = Some(4).map_or("asd".to_string().len() as i32, f);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| "asd".to_string().len() as i32, f)`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:337:28
   |
LL |         with_default_trait.unwrap_or_else(Default::default);
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:341:27
   |
LL |         with_default_type.unwrap_or_else(u64::default);
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:345:22
   |
LL |         real_default.unwrap_or_else(<FakeDefault as Default>::default);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:349:23
   |
LL |         map.entry(42).or_insert_with(String::new);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:353:25
   |
LL |         btree.entry(42).or_insert_with(String::new);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:357:25
   |
LL |         let _ = stringy.unwrap_or_else(String::new);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:399:17
   |
LL |     let _ = opt.unwrap_or({ f() }); // suggest `.unwrap_or_else(f)`
   |                 ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(f)`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:404:17
   |
LL |     let _ = opt.unwrap_or(f() + 1); // suggest `.unwrap_or_else(|| f() + 1)`
   |                 ^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| f() + 1)`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:409:17
   |
LL |       let _ = opt.unwrap_or({
   |  _________________^
LL | |
LL | |         let x = f();
LL | |         x + 1
LL | |     });
   | |______^
   |
help: try
   |
LL ~     let _ = opt.unwrap_or_else(|| {
LL +
LL +         let x = f();
LL +         x + 1
LL ~     });
   |

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:415:17
   |
LL |     let _ = opt.map_or(f() + 1, |v| v); // suggest `.map_or_else(|| f() + 1, |v| v)`
   |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|| f() + 1, |v| v)`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:420:17
   |
LL |     let _ = opt.unwrap_or({ i32::default() });
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:427:21
   |
LL |     let _ = opt_foo.unwrap_or(Foo { val: String::default() });
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|| Foo { val: String::default() })`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:442:19
   |
LL |         let _ = x.map_or(g(), |v| v);
   |                   ^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), |v| v)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:444:19
   |
LL |         let _ = x.map_or(g(), f);
   |                   ^^^^^^^^^^^^^^ help: try: `map_or_else(|_| g(), f)`

error: function call inside of `map_or`
##[error]  --> tests/ui/or_fun_call.rs:447:19
   |
LL |         let _ = x.map_or("asd".to_string().len() as i32, f);
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `map_or_else(|_| "asd".to_string().len() as i32, f)`

error: function call inside of `get_or_insert`
##[error]  --> tests/ui/or_fun_call.rs:458:15
   |
LL |     let _ = x.get_or_insert(g());
   |               ^^^^^^^^^^^^^^^^^^ help: try: `get_or_insert_with(g)`

error: function call inside of `and`
##[error]  --> tests/ui/or_fun_call.rs:468:15
   |
LL |     let _ = x.and(g());
   |               ^^^^^^^^ help: try: `and_then(|_| g())`

error: function call inside of `and`
##[error]  --> tests/ui/or_fun_call.rs:478:15
   |
LL |     let _ = x.and(g());
   |               ^^^^^^^^ help: try: `and_then(|_| g())`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:484:17
   |
LL |     let _ = opt.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: function call inside of `unwrap_or`
##[error]  --> tests/ui/or_fun_call.rs:486:17
   |
LL |     let _ = res.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_else(|_| Default::default())`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:492:17
   |
LL |     let _ = opt.unwrap_or(Default::default());
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or` to construct default value
##[error]  --> tests/ui/or_fun_call.rs:494:17
   |
LL |     let _ = res.unwrap_or(Default::default());
---



FAILED TEST: tests/ui/ptr_offset_with_cast.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/ptr_offset_with_cast.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/ptr_offset_with_cast.stderr` to the actual output
--- tests/ui/ptr_offset_with_cast.stderr
+++ <stderr output>
---
-error: aborting due to 4 previous errors
+error: this lint expectation is unfulfilled
+  --> tests/ui/ptr_offset_with_cast.rs:1:37
+   |
+LL | #![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)]
+   |                                     ^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D unfulfilled-lint-expectations` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`
 
---
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = ptr.wrapping_offset(offset_usize as isize);
LL +         let _ = ptr.wrapping_add(offset_usize);
   |

error: use of `offset` with a `usize` casted to an `isize`
##[error]  --> tests/ui/ptr_offset_with_cast.rs:25:17
   |
LL |         let _ = (&ptr).offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `add` instead
   |
LL -         let _ = (&ptr).offset(offset_usize as isize);
LL +         let _ = (&ptr).add(offset_usize);
   |

error: use of `wrapping_offset` with a `usize` casted to an `isize`
##[error]  --> tests/ui/ptr_offset_with_cast.rs:27:17
   |
LL |         let _ = (&ptr).wrapping_offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = (&ptr).wrapping_offset(offset_usize as isize);
LL +         let _ = (&ptr).wrapping_add(offset_usize);
   |

error: this lint expectation is unfulfilled
##[error]  --> tests/ui/ptr_offset_with_cast.rs:1:37
   |
LL | #![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)]
   |                                     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unfulfilled-lint-expectations` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`

error: aborting due to 5 previous errors



error: there were 1 unmatched diagnostics
##[error] --> tests/ui/ptr_offset_with_cast.rs:1:37
  |
1 | #![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)]
  |                                     ^^^^^^^^^^^^^^^^^^^ Error[unfulfilled_lint_expectations]: this lint expectation is unfulfilled
  |

full stderr:
error: use of `offset` with a `usize` casted to an `isize`
##[error]  --> tests/ui/ptr_offset_with_cast.rs:12:17
---
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = ptr.wrapping_offset(offset_usize as isize);
LL +         let _ = ptr.wrapping_add(offset_usize);
   |

error: use of `offset` with a `usize` casted to an `isize`
##[error]  --> tests/ui/ptr_offset_with_cast.rs:25:17
   |
LL |         let _ = (&ptr).offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `add` instead
   |
LL -         let _ = (&ptr).offset(offset_usize as isize);
LL +         let _ = (&ptr).add(offset_usize);
   |

error: use of `wrapping_offset` with a `usize` casted to an `isize`
##[error]  --> tests/ui/ptr_offset_with_cast.rs:27:17
   |
LL |         let _ = (&ptr).wrapping_offset(offset_usize as isize);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use `wrapping_add` instead
   |
LL -         let _ = (&ptr).wrapping_offset(offset_usize as isize);
LL +         let _ = (&ptr).wrapping_add(offset_usize);
   |

error: this lint expectation is unfulfilled
##[error]  --> tests/ui/ptr_offset_with_cast.rs:1:37
   |
LL | #![expect(clippy::unnecessary_cast, clippy::useless_vec, clippy::needless_borrow)]
   |                                     ^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unfulfilled-lint-expectations` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unfulfilled_lint_expectations)]`

---



FAILED TEST: tests/ui/single_range_in_vec_init.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/single_range_in_vec_init.rs" "--extern" "proc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary/libproc_macros.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui/auxiliary" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/single_range_in_vec_init.stderr` to the actual output
--- tests/ui/single_range_in_vec_init.stderr
+++ <stderr output>
---
-   |     ^^^^^^^^^^^^
-   |
-help: if you wanted a `Vec` that contains the entire range, try
-   |
-LL -     vec![0..200];
-LL +     (0..200).collect::<std::vec::Vec<i32>>();
-   |
-help: if you wanted a `Vec` of len 200, try
-   |
-LL -     vec![0..200];
-LL +     vec![0; 200];
-   |
-
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:29:5
... 47 lines skipped ...
    |
 
-error: a `Vec` of `Range` that is only one element
-  --> tests/ui/single_range_in_vec_init.rs:35:5
-   |
-LL |     vec![0u8..200];
-   |     ^^^^^^^^^^^^^^
-   |
-help: if you wanted a `Vec` that contains the entire range, try
-   |
-LL -     vec![0u8..200];
-LL +     (0u8..200).collect::<std::vec::Vec<u8>>();
-   |
-help: if you wanted a `Vec` of len 200, try
-   |
-LL -     vec![0u8..200];
-LL +     vec![0u8; 200];
-   |
-
-error: a `Vec` of `Range` that is only one element
-  --> tests/ui/single_range_in_vec_init.rs:37:5
-   |
-LL |     vec![0usize..200];
-   |     ^^^^^^^^^^^^^^^^^
-   |
-help: if you wanted a `Vec` that contains the entire range, try
-   |
-LL -     vec![0usize..200];
-LL +     (0usize..200).collect::<std::vec::Vec<usize>>();
-   |
-help: if you wanted a `Vec` of len 200, try
-   |
-LL -     vec![0usize..200];
-LL +     vec![0usize; 200];
-   |
-
-error: a `Vec` of `Range` that is only one element
-  --> tests/ui/single_range_in_vec_init.rs:39:5
-   |
-LL |     vec![0..200usize];
-   |     ^^^^^^^^^^^^^^^^^
-   |
-help: if you wanted a `Vec` that contains the entire range, try
-   |
-LL -     vec![0..200usize];
-LL +     (0..200usize).collect::<std::vec::Vec<usize>>();
-   |
-help: if you wanted a `Vec` of len 200usize, try
-   |
-LL -     vec![0..200usize];
-LL +     vec![0; 200usize];
-   |
-
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:42:5
... 8 lines skipped ...
    |
 
-error: a `Vec` of `Range` that is only one element
-  --> tests/ui/single_range_in_vec_init.rs:44:5
-   |
-LL |     vec![0..200isize];
-   |     ^^^^^^^^^^^^^^^^^
-   |
-help: if you wanted a `Vec` that contains the entire range, try
-   |
-LL -     vec![0..200isize];
-LL +     (0..200isize).collect::<std::vec::Vec<isize>>();
-   |
+error: aborting due to 5 previous errors
 
-error: aborting due to 10 previous errors
-
---
   = note: `-D clippy::single-range-in-vec-init` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_range_in_vec_init)]`
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200];
LL +     (0..200).collect::<std::vec::Vec<i32>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0..200];
LL +     [0; 200];
---
   |     ^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0u8..200];
LL +     (0u8..200).collect::<std::vec::Vec<u8>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0u8..200];
LL +     [0u8; 200];
   |

error: an array of `Range` that is only one element
##[error]  --> tests/ui/single_range_in_vec_init.rs:31:5
   |
LL |     [0usize..200];
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0usize..200];
LL +     (0usize..200).collect::<std::vec::Vec<usize>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0usize..200];
LL +     [0usize; 200];
---
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200usize];
LL +     (0..200usize).collect::<std::vec::Vec<usize>>();
   |
help: if you wanted an array of len 200usize, try
   |
LL -     [0..200usize];
LL +     [0; 200usize];
   |

error: an array of `Range` that is only one element
##[error]  --> tests/ui/single_range_in_vec_init.rs:42:5
   |
LL |     [0..200isize];
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200isize];
LL +     (0..200isize).collect::<std::vec::Vec<isize>>();
   |

error: aborting due to 5 previous errors


---
   = note: `-D clippy::single-range-in-vec-init` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::single_range_in_vec_init)]`
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200];
LL +     (0..200).collect::<std::vec::Vec<i32>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0..200];
LL +     [0; 200];
---
   |     ^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0u8..200];
LL +     (0u8..200).collect::<std::vec::Vec<u8>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0u8..200];
LL +     [0u8; 200];
   |

error: an array of `Range` that is only one element
##[error]  --> tests/ui/single_range_in_vec_init.rs:31:5
   |
LL |     [0usize..200];
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0usize..200];
LL +     (0usize..200).collect::<std::vec::Vec<usize>>();
   |
help: if you wanted an array of len 200, try
   |
LL -     [0usize..200];
LL +     [0usize; 200];
---
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200usize];
LL +     (0..200usize).collect::<std::vec::Vec<usize>>();
   |
help: if you wanted an array of len 200usize, try
   |
LL -     [0..200usize];
LL +     [0; 200usize];
   |

error: an array of `Range` that is only one element
##[error]  --> tests/ui/single_range_in_vec_init.rs:42:5
   |
LL |     [0..200isize];
   |     ^^^^^^^^^^^^^
   |
help: if you wanted a `Vec` that contains the entire range, try
   |
LL -     [0..200isize];
LL +     (0..200isize).collect::<std::vec::Vec<isize>>();
   |

error: aborting due to 5 previous errors


full stdout:



FAILED TEST: tests/ui/unwrap_or_else_default.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/unwrap_or_else_default.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/unwrap_or_else_default.stderr` to the actual output
--- tests/ui/unwrap_or_else_default.stderr
+++ <stderr output>
 error: use of `unwrap_or_else` to construct default value
-  --> tests/ui/unwrap_or_else_default.rs:46:14
+  --> tests/ui/unwrap_or_else_default.rs:61:23
    |
-LL |     with_new.unwrap_or_else(Vec::new);
+LL |     with_real_default.unwrap_or_else(<HasDefaultAndDuplicate as Default>::default);
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
    |
    = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`
 
 error: use of `unwrap_or_else` to construct default value
-  --> tests/ui/unwrap_or_else_default.rs:61:23
-   |
-LL |     with_real_default.unwrap_or_else(<HasDefaultAndDuplicate as Default>::default);
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
-
-error: use of `unwrap_or_else` to construct default value
   --> tests/ui/unwrap_or_else_default.rs:65:24
    |
... 79 lines skipped ...
---
Full unnormalized output:
error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:61:23
   |
LL |     with_real_default.unwrap_or_else(<HasDefaultAndDuplicate as Default>::default);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
   |
   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`

error: use of `unwrap_or_else` to construct default value
---

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:69:23
   |
LL |     with_default_type.unwrap_or_else(u64::default);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:73:23
   |
LL |     with_default_type.unwrap_or_else(Vec::new);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:77:18
   |
LL |     empty_string.unwrap_or_else(|| "".to_string());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:82:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:86:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:90:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:94:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:98:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:102:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:106:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:110:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:127:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:145:32
   |
LL |     let _ = inner_map.entry(0).or_insert_with(Default::default);
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: aborting due to 15 previous errors



---
full stderr:
error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:61:23
   |
LL |     with_real_default.unwrap_or_else(<HasDefaultAndDuplicate as Default>::default);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`
   |
   = note: `-D clippy::unwrap-or-default` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::unwrap_or_default)]`

error: use of `unwrap_or_else` to construct default value
---

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:69:23
   |
LL |     with_default_type.unwrap_or_else(u64::default);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:73:23
   |
LL |     with_default_type.unwrap_or_else(Vec::new);
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:77:18
   |
LL |     empty_string.unwrap_or_else(|| "".to_string());
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:82:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:86:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:90:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:94:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:98:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:102:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:106:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:110:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `unwrap_or_else` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:127:12
   |
LL |     option.unwrap_or_else(Vec::new).push(1);
   |            ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()`

error: use of `or_insert_with` to construct default value
##[error]  --> tests/ui/unwrap_or_else_default.rs:145:32
   |
LL |     let _ = inner_map.entry(0).or_insert_with(Default::default);
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`

error: aborting due to 15 previous errors


full stdout:



FAILED TEST: tests/ui/useless_vec.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/useless_vec.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: no output was emitted
Execute `./x test src/tools/clippy --bless` to remove `tests/ui/useless_vec.stderr`

error: diagnostic code `clippy::useless_vec` not found on line 8
---



FAILED TEST: tests/ui/vec.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/vec.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/vec.stderr` to the actual output
--- tests/ui/vec.stderr
+++ <stderr output>
-error: useless use of `vec!`
+error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
-  --> tests/ui/vec.rs:30:14
+  --> tests/ui/vec.rs:177:14
    |
-LL |     on_slice(&vec![]);
+LL |     for a in vec![1, 2, 3] {
-   |              ^^^^^^^ help: you can use a slice directly: `&[]`
+   |              ^^^^^^^^^^^^^
    |
-   = note: `-D clippy::useless-vec` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`
+   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: useless use of `vec!`
+error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
-  --> tests/ui/vec.rs:33:18
+  --> tests/ui/vec.rs:182:14
    |
-LL |     on_mut_slice(&mut vec![]);
-   |                  ^^^^^^^^^^^ help: you can use a slice directly: `&mut []`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:36:14
+LL |     for a in vec![String::new(), String::new()] {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-LL |     on_slice(&vec![1, 2]);
-   |              ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: useless use of `vec!`
+error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
-  --> tests/ui/vec.rs:39:18
+  --> tests/ui/vec.rs:190:14
    |
-LL |     on_mut_slice(&mut vec![1, 2]);
-   |                  ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:42:14
+LL |     for a in vec![1, 2, 3] {
+   |              ^^^^^^^^^^^^^
    |
-LL |     on_slice(&vec![1, 2]);
-   |              ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: useless use of `vec!`
+error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
-  --> tests/ui/vec.rs:45:18
+  --> tests/ui/vec.rs:194:14
    |
-LL |     on_mut_slice(&mut vec![1, 2]);
-   |                  ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
+LL |     for a in vec![String::new(), String::new()] {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: useless use of `vec!`
-  --> tests/ui/vec.rs:48:14
+  --> tests/ui/vec.rs:30:14
    |
-LL |     on_slice(&vec!(1, 2));
-   |              ^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
+LL |     on_slice(&vec![]);
+   |              ^^^^^^^ help: you can use a slice directly: `&[]`
+   |
+   = note: `-D clippy::useless-vec` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`
 
 error: useless use of `vec!`
-  --> tests/ui/vec.rs:51:18
+  --> tests/ui/vec.rs:33:18
    |
-LL |     on_mut_slice(&mut vec![1, 2]);
+LL |     on_mut_slice(&mut vec![]);
-   |                  ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1, 2]`
+   |                  ^^^^^^^^^^^ help: you can use a slice directly: `&mut []`
 
 error: useless use of `vec!`
... 10 lines skipped ...
 
 error: useless use of `vec!`
-  --> tests/ui/vec.rs:84:19
-   |
-LL |     let _x: i32 = vec![1, 2, 3].iter().sum();
-   |                   ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:88:17
-   |
-LL |     let mut x = vec![1, 2, 3];
-   |                 ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:95:22
-   |
-LL |     let _x: &[i32] = &vec![1, 2, 3];
-   |                      ^^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2, 3]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:98:14
-   |
-LL |     for _ in vec![1, 2, 3] {}
-   |              ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:138:20
-   |
-LL |     for _string in vec![repro!(true), repro!(null)] {
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[repro!(true), repro!(null)]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:156:18
-   |
-LL |     in_macro!(1, vec![1, 2], vec![1; 2]);
-   |                  ^^^^^^^^^^ help: you can use an array directly: `[1, 2]`
-
-error: useless use of `vec!`
   --> tests/ui/vec.rs:156:30
    |
... 2 lines skipped ...
 
 error: useless use of `vec!`
-  --> tests/ui/vec.rs:177:14
-   |
-LL |     for a in vec![1, 2, 3] {
-   |              ^^^^^^^^^^^^^ help: you can use an array directly: `[1, 2, 3]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:182:14
-   |
-LL |     for a in vec![String::new(), String::new()] {
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[String::new(), String::new()]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:215:33
-   |
-LL |     this_macro_doesnt_need_vec!(vec![1]);
-   |                                 ^^^^^^^ help: you can use an array directly: `[1]`
-
-error: useless use of `vec!`
-  --> tests/ui/vec.rs:242:14
-   |
-LL |     for a in &(vec![1, 2]) {}
-   |              ^^^^^^^^^^^^^ help: you can use a slice directly: `&[1, 2]`
-
-error: useless use of `vec!`
   --> tests/ui/vec.rs:250:13
    |
 LL |     let v = &vec![];
    |             ^^^^^^^ help: you can use a slice directly: `&[]`
 
-error: aborting due to 22 previous errors
+error: aborting due to 10 previous errors
 

Full unnormalized output:
error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:177:14
   |
LL |     for a in vec![1, 2, 3] {
   |              ^^^^^^^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:182:14
   |
LL |     for a in vec![String::new(), String::new()] {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:190:14
   |
LL |     for a in vec![1, 2, 3] {
   |              ^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:194:14
   |
LL |     for a in vec![String::new(), String::new()] {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:30:14
   |
LL |     on_slice(&vec![]);
   |              ^^^^^^^ help: you can use a slice directly: `&[]`
   |
   = note: `-D clippy::useless-vec` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`

error: useless use of `vec!`
---

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:54:14
   |
LL |     on_slice(&vec![1; 2]);
   |              ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:57:18
   |
LL |     on_mut_slice(&mut vec![1; 2]);
   |                  ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:156:30
   |
LL |     in_macro!(1, vec![1, 2], vec![1; 2]);
   |                              ^^^^^^^^^^ help: you can use an array directly: `[1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:250:13
   |
LL |     let v = &vec![];
   |             ^^^^^^^ help: you can use a slice directly: `&[]`

error: aborting due to 10 previous errors



---

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/vec.rs:177:14
    |
177 |     for a in vec![1, 2, 3] {
    |              ^^^^^^^^^^^^^ Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
    |

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/vec.rs:182:14
    |
182 |     for a in vec![String::new(), String::new()] {
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
    |

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/vec.rs:190:14
    |
190 |     for a in vec![1, 2, 3] {
    |              ^^^^^^^^^^^^^ Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
    |

error: there were 1 unmatched diagnostics
##[error]   --> tests/ui/vec.rs:194:14
    |
194 |     for a in vec![String::new(), String::new()] {
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error[clippy::incompatible_msrv]: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
    |

full stderr:
error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:177:14
   |
LL |     for a in vec![1, 2, 3] {
   |              ^^^^^^^^^^^^^
   |
   = note: `-D clippy::incompatible-msrv` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::incompatible_msrv)]`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.53.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:182:14
   |
LL |     for a in vec![String::new(), String::new()] {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:190:14
   |
LL |     for a in vec![1, 2, 3] {
   |              ^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: current MSRV (Minimum Supported Rust Version) is `1.52.0` but this item is stable since `1.82.0`
##[error]  --> tests/ui/vec.rs:194:14
   |
LL |     for a in vec![String::new(), String::new()] {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:30:14
   |
LL |     on_slice(&vec![]);
   |              ^^^^^^^ help: you can use a slice directly: `&[]`
   |
   = note: `-D clippy::useless-vec` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::useless_vec)]`

error: useless use of `vec!`
---

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:54:14
   |
LL |     on_slice(&vec![1; 2]);
   |              ^^^^^^^^^^^ help: you can use a slice directly: `&[1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:57:18
   |
LL |     on_mut_slice(&mut vec![1; 2]);
   |                  ^^^^^^^^^^^^^^^ help: you can use a slice directly: `&mut [1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:156:30
   |
LL |     in_macro!(1, vec![1, 2], vec![1; 2]);
   |                              ^^^^^^^^^^ help: you can use an array directly: `[1; 2]`

error: useless use of `vec!`
##[error]  --> tests/ui/vec.rs:250:13
   |
LL |     let v = &vec![];
   |             ^^^^^^^ help: you can use a slice directly: `&[]`

error: aborting due to 10 previous errors


full stdout:

@RalfJung
Copy link
Member Author

RalfJung commented Nov 5, 2025

I'm going to wait with fixing Clippy until we agree we even want this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.