Skip to content

Commit 2f5334d

Browse files
forgot a return in drop tracking handle_uninhabited_return
1 parent 1d12c3c commit 2f5334d

File tree

4 files changed

+92
-11
lines changed

4 files changed

+92
-11
lines changed

compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/cfg_build.rs

+1
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ impl<'a, 'tcx> DropRangeVisitor<'a, 'tcx> {
233233
self.tcx()
234234
.sess
235235
.delay_span_bug(expr.span, format!("could not resolve infer vars in `{ty}`"));
236+
return;
236237
}
237238
let ty = self.tcx().erase_regions(ty);
238239
let m = self.tcx().parent_module(expr.hir_id).to_def_id();

src/test/ui/generator/unresolved-ct-var.stderr renamed to src/test/ui/generator/unresolved-ct-var.drop_tracking.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: `[(); _]` is not a future
2-
--> $DIR/unresolved-ct-var.rs:6:44
2+
--> $DIR/unresolved-ct-var.rs:8:44
33
|
44
LL | let s = std::array::from_fn(|_| ()).await;
55
| ---------------------------^^^^^^
@@ -13,61 +13,61 @@ LL | let s = std::array::from_fn(|_| ()).await;
1313
= note: required for `[(); _]` to implement `IntoFuture`
1414

1515
error[E0698]: type inside `async` block must be known in this context
16-
--> $DIR/unresolved-ct-var.rs:6:17
16+
--> $DIR/unresolved-ct-var.rs:8:17
1717
|
1818
LL | let s = std::array::from_fn(|_| ()).await;
1919
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
2020
|
2121
note: the type is part of the `async` block because of this `await`
22-
--> $DIR/unresolved-ct-var.rs:6:44
22+
--> $DIR/unresolved-ct-var.rs:8:44
2323
|
2424
LL | let s = std::array::from_fn(|_| ()).await;
2525
| ^^^^^^
2626

2727
error[E0698]: type inside `async` block must be known in this context
28-
--> $DIR/unresolved-ct-var.rs:6:17
28+
--> $DIR/unresolved-ct-var.rs:8:17
2929
|
3030
LL | let s = std::array::from_fn(|_| ()).await;
3131
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
3232
|
3333
note: the type is part of the `async` block because of this `await`
34-
--> $DIR/unresolved-ct-var.rs:6:44
34+
--> $DIR/unresolved-ct-var.rs:8:44
3535
|
3636
LL | let s = std::array::from_fn(|_| ()).await;
3737
| ^^^^^^
3838

3939
error[E0698]: type inside `async` block must be known in this context
40-
--> $DIR/unresolved-ct-var.rs:6:17
40+
--> $DIR/unresolved-ct-var.rs:8:17
4141
|
4242
LL | let s = std::array::from_fn(|_| ()).await;
4343
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
4444
|
4545
note: the type is part of the `async` block because of this `await`
46-
--> $DIR/unresolved-ct-var.rs:6:44
46+
--> $DIR/unresolved-ct-var.rs:8:44
4747
|
4848
LL | let s = std::array::from_fn(|_| ()).await;
4949
| ^^^^^^
5050

5151
error[E0698]: type inside `async` block must be known in this context
52-
--> $DIR/unresolved-ct-var.rs:6:17
52+
--> $DIR/unresolved-ct-var.rs:8:17
5353
|
5454
LL | let s = std::array::from_fn(|_| ()).await;
5555
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
5656
|
5757
note: the type is part of the `async` block because of this `await`
58-
--> $DIR/unresolved-ct-var.rs:6:44
58+
--> $DIR/unresolved-ct-var.rs:8:44
5959
|
6060
LL | let s = std::array::from_fn(|_| ()).await;
6161
| ^^^^^^
6262

6363
error[E0698]: type inside `async` block must be known in this context
64-
--> $DIR/unresolved-ct-var.rs:6:17
64+
--> $DIR/unresolved-ct-var.rs:8:17
6565
|
6666
LL | let s = std::array::from_fn(|_| ()).await;
6767
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
6868
|
6969
note: the type is part of the `async` block because of this `await`
70-
--> $DIR/unresolved-ct-var.rs:6:44
70+
--> $DIR/unresolved-ct-var.rs:8:44
7171
|
7272
LL | let s = std::array::from_fn(|_| ()).await;
7373
| ^^^^^^

src/test/ui/generator/unresolved-ct-var.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// incremental
22
// edition:2021
3+
// revisions: drop_tracking stock
4+
//[drop_tracking] compile-flags: -Zdrop-tracking
35

46
fn main() {
57
let _ = async {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
error[E0277]: `[(); _]` is not a future
2+
--> $DIR/unresolved-ct-var.rs:8:44
3+
|
4+
LL | let s = std::array::from_fn(|_| ()).await;
5+
| ---------------------------^^^^^^
6+
| | |
7+
| | `[(); _]` is not a future
8+
| | help: remove the `.await`
9+
| this call returns `[(); _]`
10+
|
11+
= help: the trait `Future` is not implemented for `[(); _]`
12+
= note: [(); _] must be a future or must implement `IntoFuture` to be awaited
13+
= note: required for `[(); _]` to implement `IntoFuture`
14+
15+
error[E0698]: type inside `async` block must be known in this context
16+
--> $DIR/unresolved-ct-var.rs:8:17
17+
|
18+
LL | let s = std::array::from_fn(|_| ()).await;
19+
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
20+
|
21+
note: the type is part of the `async` block because of this `await`
22+
--> $DIR/unresolved-ct-var.rs:8:44
23+
|
24+
LL | let s = std::array::from_fn(|_| ()).await;
25+
| ^^^^^^
26+
27+
error[E0698]: type inside `async` block must be known in this context
28+
--> $DIR/unresolved-ct-var.rs:8:17
29+
|
30+
LL | let s = std::array::from_fn(|_| ()).await;
31+
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
32+
|
33+
note: the type is part of the `async` block because of this `await`
34+
--> $DIR/unresolved-ct-var.rs:8:44
35+
|
36+
LL | let s = std::array::from_fn(|_| ()).await;
37+
| ^^^^^^
38+
39+
error[E0698]: type inside `async` block must be known in this context
40+
--> $DIR/unresolved-ct-var.rs:8:17
41+
|
42+
LL | let s = std::array::from_fn(|_| ()).await;
43+
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
44+
|
45+
note: the type is part of the `async` block because of this `await`
46+
--> $DIR/unresolved-ct-var.rs:8:44
47+
|
48+
LL | let s = std::array::from_fn(|_| ()).await;
49+
| ^^^^^^
50+
51+
error[E0698]: type inside `async` block must be known in this context
52+
--> $DIR/unresolved-ct-var.rs:8:17
53+
|
54+
LL | let s = std::array::from_fn(|_| ()).await;
55+
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
56+
|
57+
note: the type is part of the `async` block because of this `await`
58+
--> $DIR/unresolved-ct-var.rs:8:44
59+
|
60+
LL | let s = std::array::from_fn(|_| ()).await;
61+
| ^^^^^^
62+
63+
error[E0698]: type inside `async` block must be known in this context
64+
--> $DIR/unresolved-ct-var.rs:8:17
65+
|
66+
LL | let s = std::array::from_fn(|_| ()).await;
67+
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
68+
|
69+
note: the type is part of the `async` block because of this `await`
70+
--> $DIR/unresolved-ct-var.rs:8:44
71+
|
72+
LL | let s = std::array::from_fn(|_| ()).await;
73+
| ^^^^^^
74+
75+
error: aborting due to 6 previous errors
76+
77+
Some errors have detailed explanations: E0277, E0698.
78+
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)