Skip to content

Fix splat ICEs and ban it in closures#158645

Open
teor2345 wants to merge 10 commits into
rust-lang:mainfrom
teor2345:splat-fn-fixes
Open

Fix splat ICEs and ban it in closures#158645
teor2345 wants to merge 10 commits into
rust-lang:mainfrom
teor2345:splat-fn-fixes

Conversation

@teor2345

@teor2345 teor2345 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This PR is part of the splat lang experiment #153629.

It fixes one ICE, and cleans up the surrounding error handling to avoid future ICEs:
Close #158482

Improves the message and error handling in another ICE (but doesn't fix it):
cc #158603

And bans splat on closures and rust-call, because they already de-tuple arguments:
Close #158605

In the process I discovered another symbol mangling bug with splatting, which I added a test for (but didn't fix yet):
cc #158644
This test might be flaky, I'll drop it from this PR if it fails in CI.

@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. labels Jul 1, 2026
@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

rustbot has assigned @folkertdev.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 16 candidates

(*fn_ptr)(1u32, 2i8);
let fn_pp: *const fn(#[splat] (u32, i8)) = tuple_args as *const fn(#[splat] (u32, i8));
(*fn_pp)(1, 2);
(*fn_pp)(1u32, 2i8);

@programmerjake programmerjake Jul 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd expect this to need unsafe, you are reading from a raw pointer.

View changes since the review

@folkertdev folkertdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A first pass. Overall this PR seems kind of large, it would be easier to review if split up into smaller chunks.

View changes since this review

}

if !splatted_arg_indexes.is_empty() {
if let SplatSemantic::NoClosures(closure_span) = splat_semantic {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is this not a match (together with the other if let below)?

Comment on lines +1788 to +1793
Extern::Explicit(abi_str, span)
if abi_str.symbol_unescaped.as_str() == "rust-call" =>
{
SplatSemantic::NoRustCall(span)
}
Extern::Explicit(_abi_str, _span) => SplatSemantic::Yes,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Extern::Explicit(abi_str, span)
if abi_str.symbol_unescaped.as_str() == "rust-call" =>
{
SplatSemantic::NoRustCall(span)
}
Extern::Explicit(_abi_str, _span) => SplatSemantic::Yes,
Extern::Explicit(abi_str, span) => match abi_str.symbol_unescaped {
sym::rust_dash_call => SplatSemantic::NoRustCall(span),
_ => SplatSemantic::Yes,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and add a comment on why here too perhaps?

Comment on lines +1786 to +1787
// FIXME(splat): should splatting extern "C" fns be allowed?
Extern::Implicit(_) => SplatSemantic::Yes,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

well extern "C" probably yes? but for most other extern "CC"s probably not actually? Anyhow, not for this PR.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 1, 2026
@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-log-analyzer

This comment has been minimized.

LL | dyn_asref_splat(&s);
| ^^^^^^^^^^^^^^^^^^^

error[E0277]: cannot use splat attribute; the splatted argument type must be a tuple or unit, not a Trait(std::convert::AsRef<(u8

@Ajay-singh1 Ajay-singh1 Jul 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The tuple case (AsRef<(u8, f32)>) renders truncated Trait(std::convert::AsRef<(u8 with no closing , f32)>). Is this expected, or a bug in how the diagnostic formats tuple types?

View changes since the review

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/argument-suggestions/basic.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/basic/basic.stderr`
diff of stderr:

84 LL +     permuted(X {}, Y {}, Z {});
85    |
86 
- error[E0057]: this function takes 1 argument but 0 arguments were supplied
+ error[E0061]: this function takes 1 argument but 0 arguments were supplied
88   --> $DIR/basic.rs:27:5
---
To only update this specific test, also pass `--test-args argument-suggestions/basic.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/basic.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/basic" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:20:13
   |
LL |     invalid(1.0); //~ ERROR mismatched types
   |     ------- ^^^ expected `u32`, found floating-point number
   |     |
   |     arguments to this function are incorrect
   |
note: function defined here
  --> /checkout/tests/ui/argument-suggestions/basic.rs:13:4
   |
LL | fn invalid(_i: u32) {}
   |    ^^^^^^^ -------

error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:21:5
   |
LL |     extra(""); //~ ERROR function takes
   |     ^^^^^ -- unexpected argument of type `&'static str`
   |
note: function defined here
  --> /checkout/tests/ui/argument-suggestions/basic.rs:14:4
   |
LL | fn extra() {}
   |    ^^^^^
help: remove the extra argument
   |
LL -     extra(""); //~ ERROR function takes
LL +     extra(); //~ ERROR function takes
   |

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:22:5
   |
LL |     missing(); //~ ERROR function takes
   |     ^^^^^^^-- argument #1 of type `u32` is missing
   |
note: function defined here
  --> /checkout/tests/ui/argument-suggestions/basic.rs:15:4
   |
LL | fn missing(_i: u32) {}
   |    ^^^^^^^ -------
help: provide the argument
   |
LL |     missing(/* u32 */); //~ ERROR function takes
   |             +++++++++

error[E0308]: arguments to this function are incorrect
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:23:5
   |
LL |     swapped("", 1); //~ ERROR arguments to this function are incorrect
   |     ^^^^^^^ --  - expected `&str`, found `{integer}`
   |             |
   |             expected `u32`, found `&'static str`
   |
note: function defined here
  --> /checkout/tests/ui/argument-suggestions/basic.rs:16:4
   |
LL | fn swapped(_i: u32, _s: &str) {}
   |    ^^^^^^^
help: swap these arguments
   |
LL -     swapped("", 1); //~ ERROR arguments to this function are incorrect
LL +     swapped(1, ""); //~ ERROR arguments to this function are incorrect
   |

error[E0308]: arguments to this function are incorrect
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:24:5
   |
LL |     permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect
   |     ^^^^^^^^ ----  ----  ---- expected `Z`, found `X`
   |              |     |
   |              |     expected `Y`, found `Z`
   |              expected `X`, found `Y`
   |
note: function defined here
  --> /checkout/tests/ui/argument-suggestions/basic.rs:17:4
   |
LL | fn permuted(_x: X, _y: Y, _z: Z) {}
   |    ^^^^^^^^
help: reorder these arguments
   |
LL -     permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect
LL +     permuted(X {}, Y {}, Z {}); //~ ERROR arguments to this function are incorrect
   |

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/basic.rs:27:5
   |
---
LL |     let closure = |x| x;
   |                   ^^^
help: provide the argument
   |
LL |     closure(/* x */); //~ ERROR function takes
   |             +++++++

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0061, E0308.
---
- error[E0057]: this function takes 0 arguments but 1 argument was supplied
+ error[E0061]: this function takes 0 arguments but 1 argument was supplied
19   --> $DIR/exotic-calls.rs:12:9
20    |
21 LL |     |t| f(t);

32 LL +     |t| f();
33    |
34 
- error[E0057]: this function takes 0 arguments but 1 argument was supplied
+ error[E0061]: this function takes 0 arguments but 1 argument was supplied
36   --> $DIR/exotic-calls.rs:17:5
---
53   --> $DIR/exotic-calls.rs:26:5
54    |
55 LL |     baz()(1i32)

66 LL +     baz()()
67    |
68 
- error[E0057]: this function takes 0 arguments but 1 argument was supplied
+ error[E0061]: this function takes 0 arguments but 1 argument was supplied
70   --> $DIR/exotic-calls.rs:32:5
---
To only update this specific test, also pass `--test-args argument-suggestions/exotic-calls.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/exotic-calls.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/exotic-calls" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:6:5
   |
LL |     t(1i32);
   |     ^ ---- unexpected argument of type `i32`
   |
note: callable defined here
  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:5:11
   |
LL | fn foo<T: Fn()>(t: T) {
   |           ^^^^
help: remove the extra argument
   |
LL -     t(1i32);
LL +     t();
   |

error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:12:9
   |
LL |     |t| f(t);
   |         ^ - unexpected argument
   |
note: callable defined here
  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:11:12
   |
LL | fn foo2<T: Fn()>(f: T) {
   |            ^^^^
help: remove the extra argument
   |
LL -     |t| f(t);
LL +     |t| f();
   |

error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:17:5
   |
---
LL | fn baz() -> impl Fn() {
   |             ^^^^^^^^^
help: remove the extra argument
   |
LL -     baz()(1i32)
LL +     baz()()
   |

error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/exotic-calls.rs:32:5
   |
---
- error[E0057]: this function takes 2 arguments but 1 argument was supplied
+ error[E0061]: this function takes 2 arguments but 1 argument was supplied
2   --> $DIR/issue-98894.rs:2:5
3    |
4 LL |     (|_, ()| ())(if true {} else {return;});

16 
17 error: aborting due to 1 previous error
18 
- For more information about this error, try `rustc --explain E0057`.
---
To only update this specific test, also pass `--test-args argument-suggestions/issue-98894.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/issue-98894.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/issue-98894" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 2 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/issue-98894.rs:2:5
   |
LL |     (|_, ()| ())(if true {} else {return;});
   |     ^^^^^^^^^^^^--------------------------- argument #2 of type `()` is missing
   |
note: closure defined here
  --> /checkout/tests/ui/argument-suggestions/issue-98894.rs:2:6
   |
LL |     (|_, ()| ())(if true {} else {return;});
   |      ^^^^^^^
help: provide the argument
   |
LL |     (|_, ()| ())(if true {} else {return;}, ());
   |                                           ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0061`.
---
- error[E0057]: this function takes 2 arguments but 1 argument was supplied
+ error[E0061]: this function takes 2 arguments but 1 argument was supplied
2   --> $DIR/issue-98897.rs:2:5
3    |
4 LL |     (|_, ()| ())([return, ()]);

16 
17 error: aborting due to 1 previous error
18 
- For more information about this error, try `rustc --explain E0057`.
---
To only update this specific test, also pass `--test-args argument-suggestions/issue-98897.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/issue-98897.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/issue-98897" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 2 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/issue-98897.rs:2:5
   |
LL |     (|_, ()| ())([return, ()]);
   |     ^^^^^^^^^^^^-------------- argument #2 of type `()` is missing
   |
note: closure defined here
  --> /checkout/tests/ui/argument-suggestions/issue-98897.rs:2:6
   |
LL |     (|_, ()| ())([return, ()]);
   |      ^^^^^^^
help: provide the argument
   |
LL |     (|_, ()| ())([return, ()], ());
   |                              ++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0061`.
---
- error[E0057]: this function takes 2 arguments but 1 argument was supplied
+ error[E0061]: this function takes 2 arguments but 1 argument was supplied
2   --> $DIR/issue-99482.rs:3:14
3    |
4 LL |     let _f = f(main);

16 
17 error: aborting due to 1 previous error
18 
- For more information about this error, try `rustc --explain E0057`.
---
To only update this specific test, also pass `--test-args argument-suggestions/issue-99482.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/argument-suggestions/issue-99482.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/argument-suggestions/issue-99482" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 2 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/argument-suggestions/issue-99482.rs:3:14
   |
LL |     let _f = f(main);
   |              ^ ---- argument #1 of type `()` is missing
   |
note: closure defined here
  --> /checkout/tests/ui/argument-suggestions/issue-99482.rs:2:13
   |
LL |     let f = |_: (), f: fn()| f;
   |             ^^^^^^^^^^^^^^^^
help: provide the argument
   |
LL |     let _f = f((), main);
   |                +++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0061`.
---
2   --> $DIR/E0057.rs:3:13
3    |
4 LL |     let a = f();

14 LL |     let a = f(/* x */);
15    |               +++++++
16 
- error[E0057]: this function takes 1 argument but 2 arguments were supplied
+ error[E0061]: this function takes 1 argument but 2 arguments were supplied
18   --> $DIR/E0057.rs:5:13
---
To only update this specific test, also pass `--test-args error-codes/E0057.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/error-codes/E0057.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/error-codes/E0057" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/error-codes/E0057.rs:3:13
   |
LL |     let a = f(); //~ ERROR E0057
   |             ^-- argument #1 is missing
   |
note: closure defined here
  --> /checkout/tests/ui/error-codes/E0057.rs:2:13
   |
LL |     let f = |x| x * 3;
   |             ^^^
help: provide the argument
   |
LL |     let a = f(/* x */); //~ ERROR E0057
   |               +++++++

error[E0061]: this function takes 1 argument but 2 arguments were supplied
##[error]  --> /checkout/tests/ui/error-codes/E0057.rs:5:13
   |
LL |     let c = f(2, 3); //~ ERROR E0057
   |             ^    - unexpected argument #2 of type `{integer}`
   |
note: closure defined here
  --> /checkout/tests/ui/error-codes/E0057.rs:2:13
   |
LL |     let f = |x| x * 3;
   |             ^^^
help: remove the extra argument
   |
LL -     let c = f(2, 3); //~ ERROR E0057
LL +     let c = f(2); //~ ERROR E0057
   |

error: aborting due to 2 previous errors

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

---- [ui] tests/ui/error-codes/E0057.rs stdout end ----
---- [ui] tests/ui/mismatched_types/overloaded-calls-bad.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/mismatched_types/overloaded-calls-bad/overloaded-calls-bad.stderr`
diff of stderr:

12 LL | impl FnMut<(isize,)> for S {
13    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
14 
- error[E0057]: this function takes 1 argument but 0 arguments were supplied
+ error[E0061]: this function takes 1 argument but 0 arguments were supplied
16   --> $DIR/overloaded-calls-bad.rs:35:15
17    |
18 LL |     let ans = s();

28 LL |     let ans = s(/* isize */);
29    |                 +++++++++++
30 
- error[E0057]: this function takes 1 argument but 2 arguments were supplied
+ error[E0061]: this function takes 1 argument but 2 arguments were supplied
32   --> $DIR/overloaded-calls-bad.rs:37:15
33    |
34 LL |     let ans = s("burma", "shave");

63 
64 error: aborting due to 4 previous errors
65 
- Some errors have detailed explanations: E0057, E0308.
---
To only update this specific test, also pass `--test-args mismatched_types/overloaded-calls-bad.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/mismatched_types/overloaded-calls-bad" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:33:17
   |
LL |     let ans = s("what");
   |               - ^^^^^^ expected `isize`, found `&str`
   |               |
   |               arguments to this function are incorrect
   |
note: implementation defined here
  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:10:1
   |
LL | impl FnMut<(isize,)> for S {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:35:15
   |
LL |     let ans = s();
   |               ^-- argument #1 of type `isize` is missing
   |
note: implementation defined here
  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:10:1
   |
LL | impl FnMut<(isize,)> for S {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: provide the argument
   |
LL |     let ans = s(/* isize */);
   |                 +++++++++++

error[E0061]: this function takes 1 argument but 2 arguments were supplied
##[error]  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:37:15
   |
LL |     let ans = s("burma", "shave");
   |               ^ -------  ------- unexpected argument #2 of type `&'static str`
   |                 |
   |                 expected `isize`, found `&str`
   |
note: implementation defined here
  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:10:1
   |
LL | impl FnMut<(isize,)> for S {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
   |
LL -     let ans = s("burma", "shave");
LL +     let ans = s(/* isize */);
   |

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:40:7
   |
---
   |
note: implementation defined here
  --> /checkout/tests/ui/mismatched_types/overloaded-calls-bad.rs:25:1
   |
LL | impl FnOnce<(i32,)> for F {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0061, E0308.
---
---- [ui] tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951/deferred-closure-call-recovery-issue-157951.stderr`
diff of stderr:

17 LL |     let f = |f: dyn Fn()| f;
18    |                           ^ doesn't have a size known at compile-time
19 
- error[E0057]: this function takes 1 argument but 0 arguments were supplied
+ error[E0061]: this function takes 1 argument but 0 arguments were supplied
21   --> $DIR/deferred-closure-call-recovery-issue-157951.rs:8:5
---
To only update this specific test, also pass `--test-args traits/next-solver/deferred-closure-call-recovery-issue-157951.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver=globally"
stdout: none
--- stderr -------------------------------
error[E0277]: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time
##[error]  --> /checkout/tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs:5:17
   |
LL |     let f = |f: dyn Fn()| f;
   |                 ^^^^^^^^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `(dyn Fn() + 'static)`
   = help: unsized fn params are gated as an unstable feature
help: function arguments must have a statically known size, borrowed types always have a known size
   |
LL |     let f = |f: &dyn Fn()| f;
   |                 +

error[E0746]: return type cannot be a trait object without pointer indirection
##[error]  --> /checkout/tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs:5:27
   |
LL |     let f = |f: dyn Fn()| f;
   |                           ^ doesn't have a size known at compile-time

error[E0061]: this function takes 1 argument but 0 arguments were supplied
##[error]  --> /checkout/tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs:8:5
   |
LL |     f();
   |     ^-- argument #1 of type `(dyn Fn() + 'static)` is missing
   |
note: closure defined here
  --> /checkout/tests/ui/traits/next-solver/deferred-closure-call-recovery-issue-157951.rs:5:13
   |
LL |     let f = |f: dyn Fn()| f;
   |             ^^^^^^^^^^^^^
help: provide the argument
   |
LL |     f(/* (dyn Fn() + 'static) */);
   |       ++++++++++++++++++++++++++

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0061, E0277, E0746.
---
- error[E0057]: this function takes 0 arguments but 1 argument was supplied
+ error[E0061]: this function takes 0 arguments but 1 argument was supplied
2   --> $DIR/wrong_argument_ice-4.rs:2:5
3    |
4 LL |       (|| {})(|| {

24 
25 error: aborting due to 1 previous error
26 
- For more information about this error, try `rustc --explain E0057`.
---
To only update this specific test, also pass `--test-args tuple/wrong_argument_ice-4.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/tuple/wrong_argument_ice-4.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/tuple/wrong_argument_ice-4" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0061]: this function takes 0 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/tuple/wrong_argument_ice-4.rs:2:5
   |
LL |       (|| {})(|| {
   |  _____^^^^^^^_-
LL | |         //~^ ERROR function takes 0 arguments but 1 argument was supplied
LL | |         let b = 1;
LL | |     });
   | |_____- unexpected argument of type `{closure@/checkout/tests/ui/tuple/wrong_argument_ice-4.rs:2:13: 2:15}`
   |
note: closure defined here
  --> /checkout/tests/ui/tuple/wrong_argument_ice-4.rs:2:6
   |
LL |     (|| {})(|| {
   |      ^^
help: remove the extra argument
   |
LL -     (|| {})(|| {
LL -         //~^ ERROR function takes 0 arguments but 1 argument was supplied
LL -         let b = 1;
LL -     });
LL +     (|| {})();
   |

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0061`.
---
To only update this specific test, also pass `--test-args typeck/cyclic_type_ice.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/typeck/cyclic_type_ice.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/typeck/cyclic_type_ice" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0644]: closure/coroutine type that references itself
##[error]  --> /checkout/tests/ui/typeck/cyclic_type_ice.rs:3:7
   |
LL |     f(f); //~ ERROR: closure/coroutine type that references itself
   |       ^ recursive type with infinite-size name
   |
   = note: closures cannot capture themselves or take themselves as argument;
           this error may be the result of a recent compiler bug-fix,
           see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
           for more information

error[E0061]: this function takes 2 arguments but 1 argument was supplied
##[error]  --> /checkout/tests/ui/typeck/cyclic_type_ice.rs:3:5
   |
LL |     f(f); //~ ERROR: closure/coroutine type that references itself
   |     ^--- argument #2 is missing
   |
note: closure defined here
  --> /checkout/tests/ui/typeck/cyclic_type_ice.rs:2:13
   |
LL |     let f = |_, _| ();
   |             ^^^^^^
help: provide the argument
   |
LL -     f(f); //~ ERROR: closure/coroutine type that references itself
LL +     f(/* _ */, /* _ */); //~ ERROR: closure/coroutine type that references itself
   |

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0061, E0644.

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

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[splat] is allowed in closures and does nothing. [ICE]: None in tupled_args_count.unwrap().try_into().unwrap()

6 participants