2 #![feature(never_type)]
3 #![allow(unused_mut, clippy::redundant_allocation)]
4 #![warn(clippy::must_use_candidate)]
6 use std::sync::atomic::{AtomicBool, Ordering};
9 pub struct MyAtomic(AtomicBool);
12 pub fn pure(i: u8) -> u8 {
17 pub fn inherent_pure(&self) -> u8 {
22 pub trait MyPureTrait {
23 fn trait_pure(&self, i: u32) -> u32 {
24 self.trait_impl_pure(i) + 1
27 fn trait_impl_pure(&self, i: u32) -> u32;
30 impl MyPureTrait for MyPure {
31 fn trait_impl_pure(&self, i: u32) -> u32 {
36 pub fn without_result() {
40 pub fn impure_primitive(i: &mut u8) -> u8 {
44 pub fn with_callback<F: Fn(u32) -> bool>(f: &F) -> bool {
48 pub fn with_marker(_d: std::marker::PhantomData<&mut u32>) -> bool {
52 pub fn quoth_the_raven(_more: !) -> u32 {
56 pub fn atomics(b: &AtomicBool) -> bool {
57 b.load(Ordering::SeqCst)
60 pub fn rcd(_x: Rc<u32>) -> bool {
64 pub fn rcmut(_x: Rc<&mut u32>) -> bool {
68 pub fn arcd(_x: Arc<u32>) -> bool {
72 pub fn inner_types(_m: &MyAtomic) -> bool {
76 static mut COUNTER: usize = 0;
80 /// Don't ever call this from multiple threads
81 pub unsafe fn mutates_static() -> usize {
87 pub fn unmangled(i: bool) -> bool {
92 assert_eq!(1, pure(1));