Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
master
rust/tests/ui/async-await/default-struct-update.rs

22 lines
288 B
Rust
Raw Permalink Normal View History

[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives
2024-02-16 20:02:50 +00:00
//@ build-pass
//@ edition:2018
Fix drop-tracking ICE when a struct containing a field with a `Drop` impl is used across an await Previously, drop-tracking would incorrectly assume the struct would be dropped immediately, which was not true: when the field had a type with a manual `Drop` impl, the drop becomes observable and has to be dropped after the await instead. For reasons I don't understand, this also fixes another error crater popped up related to type parameters. #98476
2022-07-01 00:05:00 -05:00
fn main() {
let _ = foo();
}
async fn from_config(_: Config) {}
async fn foo() {
from_config(Config {
nickname: None,
..Default::default()
})
.await;
}
#[derive(Default)]
struct Config {
nickname: Option<Box<u8>>,
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 811ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API