You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
#[splat] is allowed in closures and does nothing. #158605
This definitely shouldn't work, it only typechecks due to the hidden tuple in the closure Fn trait call.
I wonder if we should ban all splats within closures, even if they are applied to a tuple type or the Tuple trait?
This was an open question that we didn't get to as part of the initial impl.
#![feature(splat, unboxed_closures, tuple_trait)]#![expect(incomplete_features)]use std::marker::Tuple;traitTrait:Tuple + Sized{extern"rust-call"fnmethod(#[splat]self:Self);}implTraitfor(i32,i64){extern"rust-call"fnmethod(#[splat]self:Self){println!("{self:?}");}}fnmain(){(1_i32,2_i64).method();// Delete the below line to make it not compile.// Trait::method(3_i32, 4_i64);}
Activity
teor2345 commentedon Jun 30, 2026
This definitely shouldn't work, it only typechecks due to the hidden tuple in the closure Fn trait call.
I wonder if we should ban all splats within closures, even if they are applied to a tuple type or the Tuple trait?
This was an open question that we didn't get to as part of the initial impl.
theemathas commentedon Jun 30, 2026
#[splat] self: Selfalso results in some strange compiler behavior, especially in anextern "rust-call"method.teor2345 commentedon Jun 30, 2026
I'd expect splatting self to work, regardless of how the arguments are declared. Do you have an example?
This should probably be banned along with the closure ban, because it's the internal implementation of closures.
theemathas commentedon Jun 30, 2026
This compiles:
This compiles:
teor2345 commentedon Jun 30, 2026
I think the first is fine, the second is probably something we should reject until we decide semantics.
teor2345 commentedon Jul 1, 2026
@rustbot claim
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of #158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Rollup merge of rust-lang#158645 - teor2345:splat-fn-fixes, r=folkertdev
Unrolled build for #158645
Rollup merge of rust-lang#159629 - teor2345:splat-closure-test, r=Joh…
Rollup merge of rust-lang#159629 - teor2345:splat-closure-test, r=Joh…
Unrolled build for #159629
Rollup merge of #159629 - teor2345:splat-closure-test, r=JohnTitor