From eeb26a57b9afdcfafdaa4c7626a883c296d04ef6 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 11 Jan 2018 11:08:18 +0200 Subject: [PATCH] Revert "Stubs for unsupported platforms" Reverting, because this makes me uneasy in multiple ways. It seems to me that not compiling on unsupported platforms is strictly superior than failing at runtime. It should be up to the end users to make sure that they do cfg-out libloading on platforms where libloading is not supported. --- src/lib.rs | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b42c87d..648be55 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,58 +46,6 @@ use self::os::unix as imp; #[cfg(windows)] use self::os::windows as imp; -// When running on an unsupported OS, libloading will compile but panic on any calls. -#[cfg(not(any(unix, windows)))] -mod imp { - use std::{fmt, marker}; - use std::ffi::OsStr; - - pub struct Library; - - impl Library { - pub fn new>(_filename: P) -> ::Result { - unimplemented!() - } - - pub unsafe fn get(&self, _symbol: &[u8]) -> ::Result> { - unimplemented!() - } - } - - impl fmt::Debug for Library { - fn fmt(&self, _fmt: &mut fmt::Formatter) -> fmt::Result { - unimplemented!() - } - } - - pub struct Symbol(marker::PhantomData); - - impl Symbol> { - pub fn lift_option(self) -> Option> { - unimplemented!() - } - } - - impl Clone for Symbol { - fn clone(&self) -> Self { - unimplemented!() - } - } - - impl fmt::Debug for Symbol { - fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { - unimplemented!() - } - } - - impl ::std::ops::Deref for Symbol { - type Target = T; - fn deref(&self) -> &T { - unimplemented!() - } - } -} - pub mod os; pub mod changelog; mod util;