Clearer error on importing both gpui and gpui2
This commit is contained in:
parent
9c10152c89
commit
51aa0d6a94
3 changed files with 18 additions and 0 deletions
|
@ -13,6 +13,7 @@ use std::{
|
|||
ops::{AddAssign, Range, RangeInclusive},
|
||||
panic::Location,
|
||||
pin::Pin,
|
||||
sync::atomic::AtomicU32,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
|
@ -410,6 +411,20 @@ impl<T: Ord + Clone> RangeExt<T> for RangeInclusive<T> {
|
|||
}
|
||||
}
|
||||
|
||||
static GPUI_LOADED: AtomicU32 = AtomicU32::new(0);
|
||||
|
||||
pub fn gpui2_loaded() {
|
||||
if GPUI_LOADED.fetch_add(2, std::sync::atomic::Ordering::SeqCst) != 0 {
|
||||
panic!("=========\nYou are loading both GPUI1 and GPUI2 in the same build!\nFix Your Dependencies with cargo tree!\n=========")
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gpui1_loaded() {
|
||||
if GPUI_LOADED.fetch_add(1, std::sync::atomic::Ordering::SeqCst) != 0 {
|
||||
panic!("=========\nYou are loading both GPUI1 and GPUI2 in the same build!\nFix Your Dependencies with cargo tree!\n=========")
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue