Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error on clippy::redudant_clone in async function call #9847

Closed
Lut99 opened this issue Nov 14, 2022 · 1 comment
Closed

Compiler error on clippy::redudant_clone in async function call #9847

Lut99 opened this issue Nov 14, 2022 · 1 comment

Comments

@Lut99
Copy link

Lut99 commented Nov 14, 2022

Hi!

I've run into the compiler crashing when I attempt to run clippy on my project. The specific error appears to be:

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:626:9: type parameter `Self/#0` (Self/0) out of range when substituting, substs=[]

To reproduce, you can create a main.rs with the following:

pub async fn function(_argument: impl AsRef<str>) {}

#[tokio::main]
async fn main() {
    let argument: String = "Hello there!".into();
    function(argument.to_string()).await;
}

and a matching Cargo.toml:

[package]
name = "clippy-test"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["rt-multi-thread","macros"] }

Running cargo clippy then gives me the error, which occurs only if the function call is uncommented (so it seems to occur there). In full:

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:626:9: type parameter `Self/#0` (Self/0) out of range when substituting, substs=[]

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/897e37553bba8b42751c67658967889d11ecd120/compiler/rustc_errors/src/lib.rs:1462:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.1.65 (897e375 2022-11-02)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `clippy-test`

(I'm hoping the error is reproducible, but I can post with RUST_BACKTRACE=1 as well)

The versions of the tools I'm using:

  • rustc: rustc 1.65.0 (897e37553 2022-11-02)
  • Cargo: cargo 1.65.0 (4bc8f24d3 2022-10-20)
  • Clippy: clippy 0.1.65 (897e375 2022-11-02)

To be complete, I'm using the stable toolchain (unlike some other issues with panics I've seen on the first page).

Hopefully, this helps! If you need any more information, please let me know :)

@Lut99 Lut99 changed the title Compiler error on clippy::redudant_clone in async function Compiler error on clippy::redudant_clone in async function call Nov 14, 2022
@giraffate
Copy link
Contributor

Thanks for the report!

It's a duplicate of #9504, so I'm closing this.

from #9781 (comment)

The fix for this hasn't made it to stable yet. From a quick check, it should be in beta and should get into 1.66 stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants