mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
41 lines
884 B
Rust
41 lines
884 B
Rust
//@aux-build:proc_macros.rs
|
|
#![warn(clippy::arc_with_non_send_sync)]
|
|
#![allow(unused_variables)]
|
|
|
|
#[macro_use]
|
|
extern crate proc_macros;
|
|
|
|
use std::cell::RefCell;
|
|
use std::ptr::{null, null_mut};
|
|
use std::sync::{Arc, Mutex};
|
|
|
|
fn foo<T>(x: T) {
|
|
// Should not lint - purposefully ignoring generic args.
|
|
let a = Arc::new(x);
|
|
}
|
|
fn issue11076<T>() {
|
|
let a: Arc<Vec<T>> = Arc::new(Vec::new());
|
|
}
|
|
|
|
fn issue11232() {
|
|
external! {
|
|
let a: Arc<*const u8> = Arc::new(null());
|
|
let a: Arc<*mut u8> = Arc::new(null_mut());
|
|
}
|
|
with_span! {
|
|
span
|
|
let a: Arc<*const u8> = Arc::new(null());
|
|
let a: Arc<*mut u8> = Arc::new(null_mut());
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let _ = Arc::new(42);
|
|
|
|
let _ = Arc::new(RefCell::new(42));
|
|
|
|
let mutex = Mutex::new(1);
|
|
let _ = Arc::new(mutex.lock().unwrap());
|
|
|
|
let _ = Arc::new(&42 as *const i32);
|
|
}
|