rust/tests/ui/polymorphization/inline-tainted-body.rs

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

22 lines
561 B
Rust
Raw Normal View History

//@ compile-flags: -Zvalidate-mir -Zinline-mir=yes
2024-08-03 14:33:02 -05:00
#![feature(unboxed_closures)]
2024-08-03 14:33:02 -05:00
use std::sync::Arc;
pub struct WeakOnce<T>();
2024-08-03 14:33:02 -05:00
//~^ ERROR type parameter `T` is never used
impl<T> WeakOnce<T> {
extern "rust-call" fn try_get(&self) -> Option<Arc<T>> {}
2024-08-03 14:33:02 -05:00
//~^ 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>()))
}
}
2024-08-03 14:33:02 -05:00
fn main() {}