Skip to content

Commit e800b99

Browse files
committed
add tests for ICE in mir building with captured value of unresolved type, None in compiler/rustc_mir_build/src/build/expr/as_place.rs rust-lang#110453
Fixes rust-lang#110453
1 parent 56ea366 commit e800b99

4 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// ICE in mir building with captured value of unresolved type
2+
// None in compiler/rustc_mir_build/src/build/expr/as_place.rs
3+
// issue: rust-lang/rust#110453
4+
//@ edition:2021
5+
6+
#![crate_type="lib"]
7+
8+
pub struct B;
9+
pub fn a() -> B { B }
10+
11+
mod handlers {
12+
pub struct C(B);
13+
//~^ ERROR cannot find type `B` in this scope
14+
pub fn c() -> impl Fn() -> C {
15+
let a1 = ();
16+
|| C((crate::a(), a1).into())
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0412]: cannot find type `B` in this scope
2+
--> $DIR/mir-build-2021-closure-capture-ice-110453-1.rs:12:18
3+
|
4+
LL | pub struct C(B);
5+
| ^ not found in this scope
6+
|
7+
help: consider importing this struct
8+
|
9+
LL + use crate::B;
10+
|
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0412`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// ICE in mir building with captured value of unresolved type
2+
// None in compiler/rustc_mir_build/src/build/expr/as_place.rs
3+
// issue: rust-lang/rust#110453
4+
//@ edition:2021
5+
6+
#![crate_type="lib"]
7+
8+
pub fn dup(f: impl Fn(i32) -> i32) -> impl Fn(as_str) -> i32 {
9+
//~^ ERROR cannot find type `as_str` in this scope
10+
move |a| f(a * 2)
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `as_str` in this scope
2+
--> $DIR/mir-build-2021-closure-capture-ice-110453-2.rs:8:47
3+
|
4+
LL | pub fn dup(f: impl Fn(i32) -> i32) -> impl Fn(as_str) -> i32 {
5+
| ^^^^^^ not found in this scope
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)