File: issue-72470-llvm-dominate.rs

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,245,420 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (66 lines) | stat: -rw-r--r-- 1,750 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//@ compile-flags: -C opt-level=3
//@ aux-build: issue-72470-lib.rs
//@ edition:2018
//@ build-pass

// Regression test for issue #72470, using the minimization
// in https://github.com/jonas-schievink/llvm-error

extern crate issue_72470_lib;

use std::future::Future;
use std::pin::Pin;
use std::sync::Mutex;
use std::task::Poll::{Pending, Ready};

#[allow(dead_code)]
enum Msg {
    A(Vec<()>),
    B,
}

#[allow(dead_code)]
enum Out {
    _0(Option<Msg>),
    Disabled,
}

#[allow(unused_must_use)]
fn main() {
    let mut rx = issue_72470_lib::unbounded_channel::<Msg>();
    let entity = Mutex::new(());
    issue_72470_lib::run(async move {
        {
            let output = {
                let mut fut = rx.recv();
                issue_72470_lib::poll_fn(|cx| {
                    loop {
                        let fut = unsafe { Pin::new_unchecked(&mut fut) };
                        let out = match fut.poll(cx) {
                            Ready(out) => out,
                            Pending => {
                                break;
                            }
                        };
                        #[allow(unused_variables)]
                        match &out {
                            Some(_msg) => {}
                            _ => break,
                        }
                        return Ready(Out::_0(out));
                    }
                    Ready(Out::_0(None))
                })
                .await
            };
            match output {
                Out::_0(Some(_msg)) => {
                    entity.lock();
                }
                Out::_0(None) => unreachable!(),
                _ => unreachable!(),
            }
        }
        entity.lock();
    });
}