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/coroutine/issue-45729-unsafe-in-coroutine.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
204 B
Rust
Raw Permalink Normal View History

Error on using `yield` without also using `#[coroutine]` on the closure And suggest adding the `#[coroutine]` to the closure
2024-04-11 13:15:34 +00:00
#![feature(coroutines, stmt_expr_attributes)]
fix unsafety checking for generators Fixes #45729
2017-11-05 16:48:22 +02:00
fn main() {
Error on using `yield` without also using `#[coroutine]` on the closure And suggest adding the `#[coroutine]` to the closure
2024-04-11 13:15:34 +00:00
let _ = #[coroutine]
|| {
fix unsafety checking for generators Fixes #45729
2017-11-05 16:48:22 +02:00
*(1 as *mut u32) = 42;
improve error message shown for unsafe operations: explain why undefined behavior could arise Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-10 10:52:05 +02:00
//~^ ERROR dereference of raw pointer is unsafe
fix unsafety checking for generators Fixes #45729
2017-11-05 16:48:22 +02:00
yield;
};
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 2897ms 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