Skip to content

Add regression test for #140545 #140568

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

Merged
merged 1 commit into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Regression test for ICE from issue #140545
// The error message is confusing and wrong, but that's a different problem (#139350)
//@ edition:2018

trait Foo {}
fn a(x: impl Foo) -> impl Foo {
if true { x } else { a(a(x)) }
//~^ ERROR: expected generic type parameter, found `impl Foo` [E0792]
//~| ERROR: type parameter `impl Foo` is part of concrete type but not used in parameter list for the `impl Trait` type alias
}

fn main(){}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0792]: expected generic type parameter, found `impl Foo`
--> $DIR/double-wrap-with-defining-use.rs:7:26
|
LL | fn a(x: impl Foo) -> impl Foo {
| -------- this generic parameter must be used with a generic type parameter
LL | if true { x } else { a(a(x)) }
| ^^^^^^^

error: type parameter `impl Foo` is part of concrete type but not used in parameter list for the `impl Trait` type alias
--> $DIR/double-wrap-with-defining-use.rs:7:26
|
LL | if true { x } else { a(a(x)) }
| ^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0792`.
Loading