Skip to content

Add a new type parameter to new Range types#155457

Open
nik-rev wants to merge 1 commit intorust-lang:mainfrom
nik-contrib:range-with-end
Open

Add a new type parameter to new Range types#155457
nik-rev wants to merge 1 commit intorust-lang:mainfrom
nik-contrib:range-with-end

Conversation

@nik-rev
Copy link
Copy Markdown
Contributor

@nik-rev nik-rev commented Apr 17, 2026

This adds a new type parameter to the Range types:

pub struct Range<
    Start,
    #[unstable(feature = "new_range_end_bound", issue = "155456")]
    End = Start
>

Previous attempt:

ACP:

Tracking Issue:

Question: Should this be a beta backport? See comment by @pitaj:

If we want this we should probably add it quickly, before the new range types start getting used.

Let's add the type parameter unstably just to the new range types, which is extremely unlikely to break anyone since they just stabilized. Plus RangeBounds as if they don't break anything.

If we need to, we can always remove it later. If RangeBounds causes problems, we can handle that later. Even without RangeBounds we can enable indexing with things like 5..FromEnd(2) and such.

This change may cause type inference failures for those upgrading from 1.95 to 1.97, assuming this PR hits stable by then. If we instead do a beta backport, this will halve the time window for possible inference regressions.

r? pitaj

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

rustbot commented Apr 17, 2026

This PR was rebased onto a different main 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.

@asder8215
Copy link
Copy Markdown
Contributor

asder8215 commented Apr 17, 2026

I want to mention that without resolving the issue that occurs in the attempt I made, it's possible that certain things might not compile correctly within the rust repo when we upgrade or switch to the new range types. For example this was a failure from my draft PR:

image

rustc_codegen_cranelift has code that uses Range, which runs into the problem of not automatically inferring the ambiguous type of Start with that of a concrete End. It treats the literal 0 here as an i32 (as that's what rust compiler naturally does) instead of treating it as a u64. We'd need to resolve those issues first in the compiler before a change like this could be accepted or made for the new range types.

We need to give some sort of treatment to Range to infer literal values like 0 or non-concrete types like None to take from the End parameter if possible

@nik-rev
Copy link
Copy Markdown
Contributor Author

nik-rev commented Apr 17, 2026

We need to give some sort of treatment to Range to infer literal values like 0 or non-concrete types like None to take from the End parameter if possible

In your example, this was the problematic line:

Box::new(0..lane_count)

Issue is that lane_count is an i64 and 0 is a numeric literal, which defaults to i32 when type inference can't decide. This used to infer to Range<i64>, the 0 would infer to i64. But now, the 0 infers to i32 which causes Range<i32, i64>

I think this is fine, however, because unlike the previous attempt - this PR does not break any existing code. You have to manually upgrade to use the new type in editions older than Edition 2027, at which point it can just be fixed manually

For Edition 2027, yes, code like 0..lane_count will need to be updated, but considering this is changing the type over an edition, it should be fine, especially because the type of 0..lane_count will be updated anyways from ops::Range to range::Range

Even if that is still a problem for us, we should still merge this PR as soon as possible, to minimize how many people could possibly be broken by this who are on 1.95

@asder8215
Copy link
Copy Markdown
Contributor

asder8215 commented Apr 17, 2026

For Edition 2027, yes, code like 0..lane_count will need to be updated, but considering this is changing the type over an edition, it should be fine, especially because the type of 0..lane_count will be updated anyways from ops::Range to range::Range

But that's the thing, 0..lane_count should not need to be updated over an edition. We don't need to make someone change this piece of code from 0..lane_count to 0u64..lane_count; this feels like it goes against people's expectation to how Range previously worked.

I feel like if we want to have this PR merged, this need to handle those inference failures in the compiler as well.

Someone from the libs team or compiler team may want to chime in on whether or not it's acceptable for us to have this behavior in the new Range types.

@nik-rev
Copy link
Copy Markdown
Contributor Author

nik-rev commented Apr 17, 2026

We don't need to make someone change this piece of code from 0..lane_count to 0u64..lane_count

Edition 2027 is still a while away, and we can revert these changes before we stabilize that edition.

Merging this PR as fast as possible means:

  • If we do decide we want this in the end, we will have less users broken, because we added this new type parameter earlier

    Let's say we deny this PR, and we figure out in version 1.105 how we want to handle this, then we merge it to nightly.

    At that point, there would have been 10 releases (1.95, 1.96, 1.97, .., 1.105) that could have started using the new Range type, so we'd be breaking more users then, with type inference failures.

  • If we don't want this, we can always roll back the PR before Edition 2027 is stabilized.

We are giving ourselves a safety net by merging this now, even if we don't 100% know how we will deal with the inference failures, we have a lot of time to figure out.

@asder8215
Copy link
Copy Markdown
Contributor

asder8215 commented Apr 17, 2026

Okay... I really think this is where libs or compiler team has to chime in for their thoughts.

Also, as far as I'm aware from the Rust Project team @pitaj is a clippy contributor and on the triage team, I don't think he should be the one approving this PR since this is a libs change (correct me if I'm wrong). Someone from the libs team on review rotation should be reviewing/approving this PR.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 17, 2026

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added the T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. label Apr 17, 2026
@tgross35
Copy link
Copy Markdown
Contributor

tgross35 commented Apr 17, 2026

Nominating for @rust-lang/libs-api: half a year ago you said you'd be fine to add this if inference doesn't blow up rust-lang/libs-team#653 (comment). Based on the comments here it seems like there are cases that this can make less ergonomic once we have the stable range syntax.

It's probably not-impossible (though unlikely) to break use of RangeInclusive that somebody could be using since yesterday's stabilization (though would be nice to confirm that if you have a repro @asder8215). Think it might be worth considering this for beta if accepted to minimize that and for Range coming in the next release.

Anyway, seems like a now-or-never decision whether we want to carve this out now or require specialized compiler support to land first. Personally I'm +0.9, not +1 because I don't know what rustfix will be able to do at the edition change in cases where inference doesn't work (guess it could be fine to require manual intervention?).

Some discussion at the ACP rust-lang/libs-team#653

@rustbot label +I-libs-api-nominated

@rust-log-analyzer
Copy link
Copy Markdown
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/needless_pass_by_value.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/needless_pass_by_value.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-56d08952fc731bea.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-56d08952fc731bea.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-24136d5c079f4e21.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-24136d5c079f4e21.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-adbbc2ec6ab180d7.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-adbbc2ec6ab180d7.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e7a854d28663587f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e7a854d28663587f.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d63e5dd1fbddafee.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d63e5dd1fbddafee.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-0e1211bd5a740196.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-0e1211bd5a740196.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-73b36f011214edb4.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-73b36f011214edb4.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-1736c5b7ef9682b0.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-1736c5b7ef9682b0.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-8c0facb9d0b56834.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-8c0facb9d0b56834.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/needless_pass_by_value.stderr` to the actual output
--- tests/ui/needless_pass_by_value.stderr
+++ <stderr output>
-error: this argument is passed by value, but not consumed in the function body
##[error]+error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
-  --> tests/ui/needless_pass_by_value.rs:19:23
+                                    std::vec::Vec<T/#0, std::alloc::Global>,
-   |
+                                    ?0t,
-LL | fn foo<T: Default>(v: Vec<T>, w: Vec<T>, mut x: Vec<T>, y: Vec<T>) -> Vec<T> {
+                                ], generics=[
-   |                       ^^^^^^ help: consider changing the type to: `&[T]`
+                                    Self/#0,
-   |
+                                    Start/#1,
-   = note: `-D clippy::needless-pass-by-value` implied by `-D warnings`
+                                    End/#2,
-   = help: to override `-D warnings` add `#[allow(clippy::needless_pass_by_value)]`
---
-   |                      ^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn bar(x: String, y: &Wrapper) {
-   |                      +
+thread 'rustc' (51681) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
+Box<dyn Any>
+stack backtrace:
+   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
+   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
+   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
+   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
+   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
+   5: rustc_middle::util::bug::bug_fmt
+   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
+   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
+   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
+   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
+  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
+  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
+  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
+  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
+  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
+  15: rustc_lint::late::check_crate
+  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
+  17: rustc_data_structures::sync::parallel::par_fns
+  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
+  19: rustc_data_structures::sync::parallel::par_fns
+  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
+  21: rustc_interface::passes::analysis
+      [... omitted 1 frame ...]
+  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
+  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
+  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
+  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
+  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
+  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
+note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:44:71
-   |
-LL | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: V) {
-   |                                                                       ^
-   |
-help: consider taking a reference instead
-   |
-LL | fn test_borrow_trait<T: Borrow<str>, U: AsRef<str>, V>(t: T, u: U, v: &V) {
-   |                                                                       +
+note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:58:18
-   |
-LL | fn test_match(x: Option<Option<String>>, y: Option<Option<String>>) {
-   |                  ^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn test_match(x: Option<Option<&String>>, y: Option<Option<String>>) {
-   |                                +
+note: please make sure that you have updated to the latest nightly
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:73:24
-   |
-LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
-   |                        ^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn test_destructure(x: &Wrapper, y: Wrapper, z: Wrapper) {
-   |                        +
+note: rustc 1.97.0-nightly (804e74ed6 2026-04-17) running on x86_64-unknown-linux-gnu
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:73:36
-   |
-LL | fn test_destructure(x: Wrapper, y: Wrapper, z: Wrapper) {
-   |                                    ^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn test_destructure(x: Wrapper, y: &Wrapper, z: Wrapper) {
-   |                                    +
+note: compiler flags: -Z ui-testing -Z deduplicate-diagnostics=no
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:92:49
-   |
-LL | fn test_blanket_ref<T: Foo, S: Serialize>(vals: T, serializable: S) {}
-   |                                                 ^
-   |
-help: consider taking a reference instead
-   |
-LL | fn test_blanket_ref<T: Foo, S: Serialize>(vals: &T, serializable: S) {}
-   |                                                 +
+query stack during panic:
+#0 [analysis] running analysis passes on crate `needless_pass_by_value`
+end of query stack
+note: Clippy version: clippy 0.1.96 (804e74ed68 2026-04-17)
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:95:18
-   |
-LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-   |                  ^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn issue_2114(s: &String, t: String, u: Vec<i32>, v: Vec<i32>) {
-   |                  +
+error: aborting due to 1 previous error
 
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:95:29
-   |
-LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-   |                             ^^^^^^
-   |
-help: consider changing the type to
-   |
-LL - fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-LL + fn issue_2114(s: String, t: &str, u: Vec<i32>, v: Vec<i32>) {
-   |
-help: change `t.clone()` to
-   |
-LL -     let _ = t.clone();
-LL +     let _ = t.to_string();
-   |
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:95:40
-   |
-LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-   |                                        ^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn issue_2114(s: String, t: String, u: &Vec<i32>, v: Vec<i32>) {
-   |                                        +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:95:53
-   |
-LL | fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-   |                                                     ^^^^^^^^
-   |
-help: consider changing the type to
-   |
-LL - fn issue_2114(s: String, t: String, u: Vec<i32>, v: Vec<i32>) {
-LL + fn issue_2114(s: String, t: String, u: Vec<i32>, v: &[i32]) {
-   |
-help: change `v.clone()` to
-   |
-LL -     let _ = v.clone();
-LL +     let _ = v.to_owned();
-   |
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:113:12
-   |
---
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:125:23
-   |
-LL |     fn baz(&self, uu: U, ss: Self) {}
-   |                       ^
-   |
-help: consider taking a reference instead
-   |
-LL |     fn baz(&self, uu: &U, ss: Self) {}
-   |                       +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:125:30
-   |
-LL |     fn baz(&self, uu: U, ss: Self) {}
-   |                              ^^^^
-   |
-help: consider taking a reference instead
-   |
-LL |     fn baz(&self, uu: U, ss: &Self) {}
-   |                              +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:149:24
-   |
-LL | fn bar_copy(x: u32, y: CopyWrapper) {
-   |                        ^^^^^^^^^^^
-   |
-help: or consider marking this type as `Copy`
-  --> tests/ui/needless_pass_by_value.rs:147:1
-   |
-LL | struct CopyWrapper(u32);
-   | ^^^^^^^^^^^^^^^^^^
-help: consider taking a reference instead
-   |
-LL | fn bar_copy(x: u32, y: &CopyWrapper) {
-   |                        +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:157:29
-   |
-LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
-   |                             ^^^^^^^^^^^
-   |
-help: or consider marking this type as `Copy`
-  --> tests/ui/needless_pass_by_value.rs:147:1
-   |
-LL | struct CopyWrapper(u32);
-   | ^^^^^^^^^^^^^^^^^^
-help: consider taking a reference instead
-   |
-LL | fn test_destructure_copy(x: &CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
-   |                             +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:157:45
-   |
-LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
-   |                                             ^^^^^^^^^^^
-   |
-help: or consider marking this type as `Copy`
-  --> tests/ui/needless_pass_by_value.rs:147:1
-   |
-LL | struct CopyWrapper(u32);
-   | ^^^^^^^^^^^^^^^^^^
-help: consider taking a reference instead
-   |
-LL | fn test_destructure_copy(x: CopyWrapper, y: &CopyWrapper, z: CopyWrapper) {
-   |                                             +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:157:61
-   |
-LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: CopyWrapper) {
-   |                                                             ^^^^^^^^^^^
-   |
-help: or consider marking this type as `Copy`
-  --> tests/ui/needless_pass_by_value.rs:147:1
-   |
-LL | struct CopyWrapper(u32);
-   | ^^^^^^^^^^^^^^^^^^
-help: consider taking a reference instead
-   |
-LL | fn test_destructure_copy(x: CopyWrapper, y: CopyWrapper, z: &CopyWrapper) {
-   |                                                             +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:173:40
-   |
-LL | fn some_fun<'b, S: Bar<'b, ()>>(items: S) {}
-   |                                        ^
-   |
-help: consider taking a reference instead
-   |
-LL | fn some_fun<'b, S: Bar<'b, ()>>(items: &S) {}
-   |                                        +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:179:20
-   |
-LL | fn more_fun(items: impl Club<'static, i32>) {}
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn more_fun(items: &impl Club<'static, i32>) {}
-   |                    +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:194:24
-   |
---
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:204:27
-   |
-LL | fn non_standard_option(x: non_standard::Option<String>) {
-   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn non_standard_option(x: &non_standard::Option<String>) {
-   |                           +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:209:22
-   |
-LL | fn option_by_name(x: Option<std::option::Option<core::option::Option<non_standard::Option<String>>>>) {
-   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn option_by_name(x: Option<std::option::Option<core::option::Option<&non_standard::Option<String>>>>) {
-   |                                                                      +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:216:18
-   |
-LL | fn non_option(x: OptStr) {
-   |                  ^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn non_option(x: &OptStr) {
-   |                  +
-
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/needless_pass_by_value.rs:223:25
-   |
-LL | fn non_option_either(x: Opt<String>) {
-   |                         ^^^^^^^^^^^
-   |
-help: consider taking a reference instead
-   |
-LL | fn non_option_either(x: &Opt<String>) {
-   |                         +
-
-error: aborting due to 27 previous errors
-

Full unnormalized output:
##[error]error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
                                    std::vec::Vec<T/#0, std::alloc::Global>,
                                    ?0t,
                                ], generics=[
                                    Self/#0,
                                    Start/#1,
                                    End/#2,
                                ]


thread 'rustc' (51681) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
  15: rustc_lint::late::check_crate
  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
  17: rustc_data_structures::sync::parallel::par_fns
  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
  19: rustc_data_structures::sync::parallel::par_fns
  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
  21: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
224 |     //~^ needless_pass_by_value
    |          ^^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
    |

error: there was 1 unmatched diagnostic that occurred outside the testfile and had no pattern
    Ice: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
    std::vec::Vec<T/#0, std::alloc::Global>,
    ?0t,
], generics=[
    Self/#0,
    Start/#1,
    End/#2,
]

full stderr:
##[error]error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
                                    std::vec::Vec<T/#0, std::alloc::Global>,
                                    ?0t,
                                ], generics=[
                                    Self/#0,
                                    Start/#1,
                                    End/#2,
                                ]


thread 'rustc' (51681) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
  15: rustc_lint::late::check_crate
  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
  17: rustc_data_structures::sync::parallel::par_fns
  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
  19: rustc_data_structures::sync::parallel::par_fns
  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
  21: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---



FAILED TEST: tests/ui/crashes/needless_pass_by_value-w-late-bound.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/crashes" "tests/ui/crashes/needless_pass_by_value-w-late-bound.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-56d08952fc731bea.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-56d08952fc731bea.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-24136d5c079f4e21.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-24136d5c079f4e21.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-adbbc2ec6ab180d7.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-adbbc2ec6ab180d7.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e7a854d28663587f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e7a854d28663587f.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d63e5dd1fbddafee.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-d63e5dd1fbddafee.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-0e1211bd5a740196.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-0e1211bd5a740196.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-73b36f011214edb4.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-73b36f011214edb4.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-1736c5b7ef9682b0.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-1736c5b7ef9682b0.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-8c0facb9d0b56834.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-8c0facb9d0b56834.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/crashes/needless_pass_by_value-w-late-bound.stderr` to the actual output
--- tests/ui/crashes/needless_pass_by_value-w-late-bound.stderr
+++ <stderr output>
-error: this argument is passed by value, but not consumed in the function body
-  --> tests/ui/crashes/needless_pass_by_value-w-late-bound.rs:7:12
-   |
-LL | fn test(x: Foo<'_>) {}
-   |            ^^^^^^^
-   |
-help: or consider marking this type as `Copy`
-  --> tests/ui/crashes/needless_pass_by_value-w-late-bound.rs:5:1
-   |
---
-help: consider taking a reference instead
-   |
-LL | fn test(x: &Foo<'_>) {}
-   |            +
##[error]+error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
+                                    Foo<'{erased}>,
+                                    ?0t,
+                                ], generics=[
+                                    Self/#0,
+                                    Start/#1,
+                                    End/#2,
+                                ]
 
+
+thread 'rustc' (54209) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
+Box<dyn Any>
+stack backtrace:
+   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
+   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
+   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
+   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
+   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
+   5: rustc_middle::util::bug::bug_fmt
+   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
+   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
+   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
+   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
+  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
+  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
+  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
+  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
+  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
+  15: rustc_lint::late::check_crate
+  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
+  17: rustc_data_structures::sync::parallel::par_fns
+  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
+  19: rustc_data_structures::sync::parallel::par_fns
+  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
+  21: rustc_interface::passes::analysis
+      [... omitted 1 frame ...]
+  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
+  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
+  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
+  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
+  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
+  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
+note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
+
 error: aborting due to 1 previous error
 

Full unnormalized output:
##[error]error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
                                    Foo<'{erased}>,
                                    ?0t,
                                ], generics=[
                                    Self/#0,
                                    Start/#1,
                                    End/#2,
                                ]


thread 'rustc' (54209) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
  15: rustc_lint::late::check_crate
  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
  17: rustc_data_structures::sync::parallel::par_fns
  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
  19: rustc_data_structures::sync::parallel::par_fns
  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
  21: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
8 | //~^ needless_pass_by_value
  |      ^^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
  |

error: there was 1 unmatched diagnostic that occurred outside the testfile and had no pattern
    Ice: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
    Foo<'{erased}>,
    ?0t,
], generics=[
    Self/#0,
    Start/#1,
    End/#2,
]

full stderr:
##[error]error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2258:17: args not compatible with generics for std::ops::RangeBounds: args=[
                                    Foo<'{erased}>,
                                    ?0t,
                                ], generics=[
                                    Self/#0,
                                    Start/#1,
                                    End/#2,
                                ]


thread 'rustc' (54209) panicked at compiler/rustc_middle/src/ty/context.rs:2258:17:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   3: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   4: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_middle::ty::context::TyCtxt>::debug_assert_args_compatible
   7: clippy_utils::ty::implements_trait_with_env_from_iter::<core::option::Option<rustc_middle::ty::generic_args::GenericArg>, [core::option::Option<rustc_middle::ty::generic_args::GenericArg>; 1]>
   8: <core::slice::iter::Iter<rustc_span::def_id::DefId> as core::iter::traits::iterator::Iterator>::any::<<clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn::{closure#5}>
   9: <clippy_lints::needless_pass_by_value::NeedlessPassByValue as rustc_lint::passes::LateLintPass>::check_fn
  10: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_fn
  11: rustc_hir::intravisit::walk_item::<rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass>>
  12: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_nested_item
  13: <rustc_lint::late::LateContextAndPass<rustc_lint::late::RuntimeCombinedLateLintPass> as rustc_hir::intravisit::Visitor>::visit_mod
  14: <rustc_session::session::Session>::time::<(), rustc_lint::late::check_crate::{closure#0}::{closure#0}>
  15: rustc_lint::late::check_crate
  16: rustc_interface::passes::analysis::{closure#0}::{closure#0}::{closure#2}
  17: rustc_data_structures::sync::parallel::par_fns
  18: rustc_interface::passes::analysis::{closure#0}::{closure#0}
  19: rustc_data_structures::sync::parallel::par_fns
  20: <rustc_session::session::Session>::time::<(), rustc_interface::passes::analysis::{closure#0}>
  21: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  22: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  23: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}>
  24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  25: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  26: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
  27: rustc_span::create_session_globals_then::<(), rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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

Labels

I-libs-api-nominated Nominated for discussion during a libs-api team meeting. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants