Add regression test for ICE with undefined type in async fn
This commit is contained in:
parent
44e34e1ac6
commit
565b772fa5
2 changed files with 35 additions and 0 deletions
16
tests/ui/mir/gvn-opt-138225.rs
Normal file
16
tests/ui/mir/gvn-opt-138225.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//! Regression test for <https://github.com/rust-lang/rust/issues/138225>
|
||||
|
||||
pub struct A {
|
||||
name: NestedOption<Option<String>>,
|
||||
//~^ ERROR cannot find type `NestedOption` in this scope
|
||||
}
|
||||
|
||||
impl A {
|
||||
pub async fn func1() -> &'static A {
|
||||
//~^ ERROR `async fn` is not permitted in Rust 2015
|
||||
static RES: A = A { name: None };
|
||||
&RES
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
19
tests/ui/mir/gvn-opt-138225.stderr
Normal file
19
tests/ui/mir/gvn-opt-138225.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||
--> $DIR/gvn-opt-138225.rs:9:9
|
||||
|
|
||||
LL | pub async fn func1() -> &'static A {
|
||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||
|
|
||||
= help: pass `--edition 2024` to `rustc`
|
||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||
|
||||
error[E0425]: cannot find type `NestedOption` in this scope
|
||||
--> $DIR/gvn-opt-138225.rs:4:11
|
||||
|
|
||||
LL | name: NestedOption<Option<String>>,
|
||||
| ^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0425, E0670.
|
||||
For more information about an error, try `rustc --explain E0425`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue