Fix ICE in label_fn_like for splatted args and add UI tests#157434
Fix ICE in label_fn_like for splatted args and add UI tests#157434Ajay-singh1 wants to merge 13 commits into
label_fn_like for splatted args and add UI tests#157434Conversation
fixup! Add splat builtin attribute & feature gate
fixup! Add AST validation for #[splat]
fixup! Add HIR FnDecl for #[splat]
fixup! Impl HIR typeck for #[splat]
fixup! Impl TypeInfo for splat
|
Some changes occurred in compiler/rustc_hir/src/attrs cc @jdonszelmann, @JonathanBrouwer Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer 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 HIR ty lowering was modified cc @fmease Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri The reflection data structures are tied exactly to the implementation cc @oli-obk Some changes occurred to the CTFE machinery The Miri subtree was changed cc @rust-lang/miri This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a, @makai410 Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer The Cranelift subtree was changed cc @bjorn3 |
|
Failed to set assignee to
|
|
I'd recommend opening such PRs as a draft until they are ready for review. That avoids pinging everyone. :) |
There was a problem hiding this comment.
Looks good, just a few tweaks to improve the test coverage. Feel free to edit your existing commits and force-push, or add fixup commits.
(Normally we use fixup commits to make reviews easier when there are rebases, then squash when the PR is ready. But in this case it doesn't matter.)
| @@ -0,0 +1,31 @@ | |||
| // tests/ui/splat/splat-generics-inside-tuple.rs | |||
There was a problem hiding this comment.
This test looks good, but no need to repeat the file path at the top of the file. The comment describing the purpose of the test is enough.
(This comment applies to each test file.)
| // tests/ui/splat/splat-generics-inside-tuple.rs |
|
|
||
| impl FooTrait for Foo { | ||
| fn method(#[splat] _: (u32, f32)) {} | ||
| //~^ ERROR |
There was a problem hiding this comment.
Please add part of the error text here (and below), so we know if we accidentally change the error type
| //~^ ERROR | |
| //~^ ERROR method `method` has an incompatible type for trait |
|
r? teor2345 |
This PR builds on top of #153697 (teor's
#[splat]implementation).Bug Fix
While writing UI tests for the unhappy path of the
overload-at-homeexample, I discovered an ICE when calling a splatted function with an argument combination that has no registered impl:The condition
!tuple_arguments.is_splatted()inlabel_fn_likewas inverted , the safeuse_splat_fallbackpath ran for non-splatted functions, and thespan_bug!fired for splatted ones. Fix is removing the!.After the fix the compiler gives a clean error instead:
error[E0308]: mismatched types expected String, found i32CC: @teor2345