Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/ui/mir/gvn-opt-138225.rs
Original file line number Diff line number Diff line change
@@ -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 };
Comment on lines 9 to 11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub async fn func1() -> &'static A {
static RES: A = A { name: None };
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 changes: 19 additions & 0 deletions tests/ui/mir/gvn-opt-138225.stderr
Original file line number Diff line number Diff line change
@@ -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