diff --git a/.travis.yml b/.travis.yml index 7796110e..f29188a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -118,4 +118,4 @@ script: - cd "${TRAVIS_BUILD_DIR}/testing/version_compatibility/user_0" - - cargo run --features run + - cargo run diff --git a/testing/version_compatibility/impl_0/Cargo.toml b/testing/version_compatibility/impl_0/Cargo.toml index 44cd3a90..51e80e35 100644 --- a/testing/version_compatibility/impl_0/Cargo.toml +++ b/testing/version_compatibility/impl_0/Cargo.toml @@ -5,8 +5,8 @@ authors = ["rodrimati1992 "] edition = "2018" [dependencies] -abi_stable={path="../../../abi_stable",package="abi_stable"} -# abi_stable={version="*"} +# abi_stable={path="../../../abi_stable",package="abi_stable"} +abi_stable={version="*"} [dependencies.version_compatibility_interface] version="0.1" diff --git a/testing/version_compatibility/interface/Cargo.toml b/testing/version_compatibility/interface/Cargo.toml index 97dbefb8..7a7a2c17 100644 --- a/testing/version_compatibility/interface/Cargo.toml +++ b/testing/version_compatibility/interface/Cargo.toml @@ -11,5 +11,5 @@ old=[] new=[] [dependencies] -# old_abi_stable={version="*",package="abi_stable"} +old_abi_stable={version="*",package="abi_stable"} new_abi_stable={path="../../../abi_stable",package="abi_stable"} diff --git a/testing/version_compatibility/interface/src/lib.rs b/testing/version_compatibility/interface/src/lib.rs index cce0b52b..c6d7a189 100644 --- a/testing/version_compatibility/interface/src/lib.rs +++ b/testing/version_compatibility/interface/src/lib.rs @@ -1,12 +1,12 @@ -// #[cfg(feature="new")] +#[cfg(feature="new")] extern crate new_abi_stable as abi_stable; -// #[cfg(not(feature="new"))] -// extern crate old_abi_stable as abi_stable; +#[cfg(not(feature="new"))] +extern crate old_abi_stable as abi_stable; -// #[cfg(all(feature="new",feature="old"))] -// compile_error!{"the new and old feature can't be enabled at the same time"} +#[cfg(all(feature="new",feature="old"))] +compile_error!{"the new and old feature can't be enabled at the same time"} use abi_stable::{ diff --git a/testing/version_compatibility/user_0/Cargo.toml b/testing/version_compatibility/user_0/Cargo.toml index 40cab46c..775079a5 100644 --- a/testing/version_compatibility/user_0/Cargo.toml +++ b/testing/version_compatibility/user_0/Cargo.toml @@ -4,18 +4,11 @@ version = "0.1.0" authors = ["rodrimati1992 "] edition = "2018" -[features] -"run" = [ - "version_compatibility_interface/new", - "version_compatibility_interface/old", -] - [dependencies] abi_stable={path="../../../abi_stable"} core_extensions={ version = "0.1.18", default_features = false } - - [dependencies.version_compatibility_interface] version="0.1" path="../interface" +features = ["new"] \ No newline at end of file diff --git a/testing/version_compatibility/user_0/src/main.rs b/testing/version_compatibility/user_0/src/main.rs index 8511d36d..55506fdb 100644 --- a/testing/version_compatibility/user_0/src/main.rs +++ b/testing/version_compatibility/user_0/src/main.rs @@ -37,32 +37,35 @@ fn compute_library_dir()->io::Result{ fn main()-> io::Result<()> { - if cfg!(not(feature = "run")) { - panic!(r#"Please compile this with --feature run "#); - } - let library_dir=compute_library_dir().unwrap(); (||->Result<(),LibraryError>{ let header=abi_header_from_path(&RootMod_Ref::get_library_path(&library_dir))?; + println!("header: {:?}", header); + println!(); println!("Executable's AbiHeader {:?}", AbiHeader::VALUE); + println!(); println!("Executable's abi_stable version {:?}", abi_stable::ABI_STABLE_VERSION); - println!(); if header.is_valid() { let lib_header=header.upgrade()?; - - println!("Loaded AbiHeader {:?}", header); unsafe{ let root=lib_header.init_root_module_with_unchecked_layout::()?; println!("Loaded abi_stable version {:?}", root.abi_stable_version()); + println!(); } lib_header.check_layout::()?; + println!("\ + The types in abi_stable on crates.io are compatible with those on \ + the \"local\" repository\ + "); + } else { + println!("The abi_stable on crates.io isn't semver compatible with this one"); } Ok(()) })().unwrap_or_else(|e| panic!("{}", e) );