Skip to content

Commit

Permalink
Make a previously unreachable UI test reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
fmease committed Jan 26, 2025
1 parent 9373f98 commit a0e0571
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 36 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/issues.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,6 @@ ui/issue-18502.rs
ui/issue-24106.rs
ui/issue-76387-llvm-miscompile.rs
ui/issues-71798.rs
ui/issues/auxiliary/issue-111011.rs
ui/issues/auxiliary/issue-11224.rs
ui/issues/auxiliary/issue-11508.rs
ui/issues/auxiliary/issue-11529.rs
Expand Down
34 changes: 0 additions & 34 deletions tests/ui/issues/auxiliary/issue-111011.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//@ edition:2021
// issue: https://github.com/rust-lang/rust/issues/111011

fn foo<X>(x: impl FnOnce() -> Box<X>) {}
// just to make sure async closures can still be suggested for boxing.
fn bar<X>(x: Box<dyn FnOnce() -> X>) {}

fn main() {
foo(async move || {}); //~ ERROR mismatched types
foo(async move || {});
//~^ ERROR expected `{async [email protected]:9:9}` to be a closure that returns `Box<_>`
bar(async move || {}); //~ ERROR mismatched types
}
41 changes: 41 additions & 0 deletions tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
error[E0271]: expected `{async [email protected]:9:9}` to be a closure that returns `Box<_>`, but it returns `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}`
--> $DIR/dont-suggest-boxing-async-closure-body.rs:9:9
|
LL | foo(async move || {});
| --- ^^^^^^^^^^^^^^^^ expected `Box<_>`, found `async` closure body
| |
| required by a bound introduced by this call
|
= note: expected struct `Box<_>`
found `async` closure body `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}`
note: required by a bound in `foo`
--> $DIR/dont-suggest-boxing-async-closure-body.rs:4:31
|
LL | fn foo<X>(x: impl FnOnce() -> Box<X>) {}
| ^^^^^^ required by this bound in `foo`

error[E0308]: mismatched types
--> $DIR/dont-suggest-boxing-async-closure-body.rs:11:9
|
LL | bar(async move || {});
| --- ^^^^^^^^^^^^^^^^ expected `Box<dyn FnOnce() -> _>`, found `{async [email protected]:11:9}`
| |
| arguments to this function are incorrect
|
= note: expected struct `Box<(dyn FnOnce() -> _ + 'static)>`
found closure `{async closure@$DIR/dont-suggest-boxing-async-closure-body.rs:11:9: 11:22}`
= note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html
note: function defined here
--> $DIR/dont-suggest-boxing-async-closure-body.rs:6:4
|
LL | fn bar<X>(x: Box<dyn FnOnce() -> X>) {}
| ^^^ -------------------------
help: store this in the heap by calling `Box::new`
|
LL | bar(Box::new(async move || {}));
| +++++++++ +

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0271, E0308.
For more information about an error, try `rustc --explain E0271`.

0 comments on commit a0e0571

Please sign in to comment.