-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a new check-pass UI test for returning impl Fn(T) -> impl Trait
#136971
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
Conversation
r? WaffleLapkin |
I need some ideas for what to call this test. I thought |
impl Fn(T) -> impl Trait
impl Fn(T) -> impl Trait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test should be placed under tests/ui/impl-trait/
.
Regarding naming, it would help to bisect the reprogression (e.g., with cargo-bisect-rustc
) and see what PR made it compile and more importantly why (it didn't compile and now does). Moreover, looking at that PR could help us determine if we need extra regression tests at all or if it's sufficiently covered already.
I ran the bisection bisect-rustc results
RESULT: nightly-2024-04-10, ===> Successfully compiled searched toolchains nightly-2023-02-10 through nightly-2024-07-20 Regression in nightly-2024-04-10 fetching https://static.rust-lang.org/dist/2024-04-09/channel-rust-nightly-git-commit-hash.txt |
Likely #122077 |
I've begun doing a manual bisect to be sure. |
Output when compiling the test with b234e44 Errorsrustc +stage1 ../bisect-test
error: concrete type differs from previous defining opaque type use
--> ../bisect-test:9:10
|
9 | |_x| 15
| ^^ expected `impl Debug`, got `i32`
|
note: previous use here
--> ../bisect-test:9:5
|
9 | |_x| 15
| ^^^^^^^
error[E0720]: cannot resolve opaque type
--> ../bisect-test:8:28
|
8 | fn f<T>() -> impl Fn(T) -> impl Debug {
| ^^^^^^^^^^ cannot resolve opaque type
error: concrete type differs from previous defining opaque type use
--> ../bisect-test:25:10
|
25 | |_x| 15
| ^^ expected `impl Debug`, got `i32`
|
note: previous use here
--> ../bisect-test:25:5
|
25 | |_x| 15
| ^^^^^^^
error[E0720]: cannot resolve opaque type
--> ../bisect-test:24:37
|
24 | fn h<T>() -> impl Fn<(T,), Output = impl Debug> {
| ^^^^^^^^^^ cannot resolve opaque type
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0720`.` Now it's a matter of deciding what the test name should be. |
@WaffleLapkin It's ready @fmease I implemented your feedback, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a single nitpick and this can be merged :)
Change description from compiletest to regression test Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> Improve test name, location, and description Update tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs Co-authored-by: waffle <waffle.lapkin@gmail.com>
Thanks! |
@bors r+ rollup |
Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait` This PR closes rust-lang#107883 by adding a ui test.
Rollup of 11 pull requests Successful merges: - rust-lang#133312 (triagebot: automatically add more rustdoc related labels) - rust-lang#134016 (Stabilize `const_is_char_boundary` and `const_str_split_at`.) - rust-lang#135813 (CI: split i686-mingw job to three free runners) - rust-lang#136879 (Add safe new() to NotAllOnes) - rust-lang#136971 (Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait`) - rust-lang#136983 (Prepare standard library for Rust 2024 migration) - rust-lang#137002 (Fix early lint check desc in query) - rust-lang#137006 (borrowck diagnostics cleanup: remove an unused and a barely-used field) - rust-lang#137026 (Stabilize (and const-stabilize) `integer_sign_cast`) - rust-lang#137028 (mir_build: Clarify some code for lowering `hir::PatExpr` to THIR) - rust-lang#137032 (Decode metadata buffer in one go) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#133312 (triagebot: automatically add more rustdoc related labels) - rust-lang#134016 (Stabilize `const_is_char_boundary` and `const_str_split_at`.) - rust-lang#136971 (Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait`) - rust-lang#136983 (Prepare standard library for Rust 2024 migration) - rust-lang#137002 (Fix early lint check desc in query) - rust-lang#137006 (borrowck diagnostics cleanup: remove an unused and a barely-used field) - rust-lang#137032 (Decode metadata buffer in one go) - rust-lang#137035 (Normalize closure instance before eagerly monomorphizing it) - rust-lang#137037 (add x86-sse2 (32bit) ABI that requires SSE2 target feature) - rust-lang#137038 (llvm: Tolerate captures in tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136971 - HypheX:patch1, r=WaffleLapkin Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait` This PR closes rust-lang#107883 by adding a ui test.
This PR closes #107883 by adding a ui test.