summary refs log tree commit diff
path: root/tests/ui/polymorphization/inline-tainted-body.rs
blob: 13aec97e22bdd816f14533e131d6e70bfa51a2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes

#![feature(unboxed_closures)]

use std::sync::Arc;

pub struct WeakOnce<T>();
//~^ ERROR type parameter `T` is never used

impl<T> WeakOnce<T> {
    extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
    //~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
    //~| ERROR mismatched types

    pub fn get(&self) -> Arc<T> {
        self.try_get()
            .unwrap_or_else(|| panic!("Singleton {} not available", std::any::type_name::<T>()))
    }
}

fn main() {}